Skip to content

Instantly share code, notes, and snippets.

@gittimos
Last active August 13, 2021 13:22
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gittimos/9e772e531422628deb58f18c44d272b4 to your computer and use it in GitHub Desktop.
Save gittimos/9e772e531422628deb58f18c44d272b4 to your computer and use it in GitHub Desktop.
Alexa skills kit (ASK): remove SSML for speech output in cards
var strip = require('./strip.js');
this.emit(":askWithCard", speechOutput, repromptText, this.t("MESSAGE"), strip.stripTags(repromptText));
exports.stripTags = (someTextWithSSMLTags) => {
var regex = /(<([^>]+)>)/ig;
return someTextWithSSMLTags.replace(regex, "");
}
@MightyJoe469
Copy link

Exactly what I was looking for! Thank you very much!

@mohaksnghl
Copy link

where to paste this code in index.js?

@adi701
Copy link

adi701 commented Mar 26, 2018

where do i adjust in the following code such that the tag is removed
callback(sessionAttributes,
buildSpeechletResponse(CARD_TITLE, speechOutput, repromptText, shouldEndSession));

@myke11j
Copy link

myke11j commented Jul 12, 2018

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