Last active
August 13, 2021 13:22
-
-
Save gittimos/9e772e531422628deb58f18c44d272b4 to your computer and use it in GitHub Desktop.
Alexa skills kit (ASK): remove SSML for speech output in cards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strip = require('./strip.js'); | |
this.emit(":askWithCard", speechOutput, repromptText, this.t("MESSAGE"), strip.stripTags(repromptText)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.stripTags = (someTextWithSSMLTags) => { | |
var regex = /(<([^>]+)>)/ig; | |
return someTextWithSSMLTags.replace(regex, ""); | |
} |
where to paste this code in index.js?
where do i adjust in the following code such that the tag is removed
callback(sessionAttributes,
buildSpeechletResponse(CARD_TITLE, speechOutput, repromptText, shouldEndSession));
callback(sessionAttributes,
buildSpeechletResponse(CARD_TITLE.replace(/(<([^>]+)>)/ig, ''), speechOutput, repromptText, shouldEndSession));
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I was looking for! Thank you very much!