How not to display ssml tags on Alexa screen device while sending notification in Alexa

100 Views Asked by At
  1. I have implemented Alexa Proactive events to send Notification through Our skill in Alexa. It's working fine. But Problem is we have added SSML tag say to speak as digits 2212545 like this to handle Audio. Rightnow this tag is displaying on screen of Alexa device. We don't want to display SSML tag. Please can anyone tell how can we remove these SSML tag in our Alexa notification while displaying This is body i am sending

    {"timestamp":"2021-02-23T07:06:00.693Z","referenceId":"db8b343f-5639-431c-a436-e7c6eee604c4","expiryTime":"2021-02-24T07:06:00.693Z","event":{"name":"AMAZON.MessageAlert.Activated","payload":{"state":{"status":"UNREAD"},"messageGroup":{"creator":{"name": "Amount 5000 for user id 2212545 will be credited on 2021/10/02"},"count":1}}},"relevantAudience":{"type":"Unicast","payload":{"user": USER_ID}}}

1

There are 1 best solutions below

4
On

I have a small library for formatting and such and just run my display text through a small regular expression.

I found this here and have used it ever since.

https://forums.developer.amazon.com/questions/5433/strip-ssml-tags-for-card-output.html

var regex = /(<([^>]+)>)/ig;
cardContent = someTextWithSSMLTags.replace(regex, "");