Utilisez SSM
Pour un texte long
intent Yes
AMAZON.YesIntent': function () { // check if we have the phone number to reply a message // check also if we've captured the text message if (this.attributes['toNumber']){ if (this.attributes['message']) { var thisHandler = this platform.post('/account/~/extension/~/sms', { from: {'phoneNumber': this.attributes['ownPhoneNumber']}, to: [{'phoneNumber': this.attributes['toNumber']}], text: this.attributes['message'] }) .then(function (response) { speech_output = "Message is sent. " var count = thisHandler.attributes['textMsgs'].length if (thisHandler.attributes['index'] < count - 1) { speech_output += "You can say next to listen to the next message" reprompt_text = "You can say next to listen to the next message" }else{ speech_output += "No more unread message. You can say get message to check for new unread messages." reprompt_text = "How can I help you?" } thisHandler.emit(':ask', speech_output, reprompt_text); }) .catch(function(e) { console.error(e); thisHandler.emit(':ask', "Failed to send message. Please try again", "Say message body, followed by the text message you want to send."); }); }else{ // no message is missing, prompt the user to say the message speech_output = "Say message body, followed by the text message you want to send." this.emit(':ask', speech_output, speech_output); } }else{ speech_output = 'Sorry, I don\'t understand what you want me to do. Please say help to hear what you can say.'; this.response.speak(speech_output).listen(speech_output); this.emit(':responseReady'); } } ET No :
AMAZON.NoIntent': function () { if (this.attributes['message'] && this.attributes['message'].length > 0){ speech_output = "If the message is incorrect, you can say message body, followed by the text message you want to send." }else{ speech_output = 'How can I help you?' } this.emit(':ask', speech_output, 'How can I help you?') }