【问题标题】:How not to display ssml tags on Alexa screen device while sending notification in Alexa在 Alexa 中发送通知时如何在 Alexa 屏幕设备上不显示 ssml 标签
【发布时间】:2021-05-25 11:20:19
【问题描述】:
  1. 我已经实现了 Alexa Proactive 事件来发送通知 通过我们在 Alexa 中的技能。它工作正常。但问题是我们 已添加 SSML 标签说像这样以数字 2212545 说话来处理音频。现在这个标签显示在 Alexa 设备的屏幕上。我们不想显示 SSML 标签。请谁能告诉我们如何在显示时在我们的 Alexa 通知中删除这些 SSML 标签 这是我要发送的正文

    {"timestamp":"2021-02-23T07:06:00.693Z","re​​ferenceId":"db8b343f-5639-431c-a436-e7c6eee604c4","expiryTime":"2021-02-24T07:06: 00.693Z","event":{"name":"AMAZON.MessageAlert.Activated","payload":{"state":{"status":"UNREAD"},"messageGroup":{"creator":{ "name": "用户 ID 2212545 的金额 5000 将记入 2021/10/02"},"count":1}}},"relevantAudience":{"type":"Unicast","payload":{"user": USER_ID}}}

【问题讨论】:

    标签: alexa alexa-skill alexa-app proactive alexa-notification


    【解决方案1】:

    我有一个用于格式化等的小型库,只需通过一个小的正则表达式运行我的显示文本。

    我在这里找到了它并一直使用它。

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

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

    【讨论】:

    • 感谢您的回复。但我正在使用 Alexa Proactive 事件来发送通知。这在我的情况下不起作用。因为 Alexa 通知(主动事件)具有固定模式。请看上面的身体
    • 啊,我不理解 Alexa Proactive Event 部分,如果我仍然遗漏了什么,请原谅我,但是 SSML 在哪里?
    • { "timestamp": "timestamp", "referenceId": "db8b34", "expiryTime": "expiryedate", "event": { "name": "AMAZON.MessageAlert.Activated", "payload": { "state": { "status": "UNREAD" }, "messageGroup": { "creator": { "name": "Order Id 251624 " }, "count": 1 } }}, "relevantAudience": { "type": "Unicast", "payload": { "user": USER_ID } } }
    • 我已经为 Proactive 事件添加了请求正文,并且根据我的用例,当我说 Alexa 时,我在名称参数中添加了 Order Id这 251624 。我不希望该标签显示在屏幕上
    猜你喜欢
    • 1970-01-01
    • 2021-11-16
    • 2016-08-23
    • 2016-12-31
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 2016-10-19
    • 2019-05-09
    相关资源
    最近更新 更多