Skip to content

Commit

Permalink
not sending the response until sms message succeeds/fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Edwards authored and Chris Edwards committed Jan 14, 2017
1 parent a118a84 commit f268c73
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,26 @@ app.intent('AMAZON.YesIntent', (req, res) => {
}
console.log('-- sending bulk message');
sendBulkMessage(message)
.catch(console.log)
.then((resp) => {
console.log(' -- bulk message callback ', resp);
});
console.log('-- bulk message sent');
res
.say(message)
.card(card)
.shouldEndSession(true)
.send();
console.log('-- bulk message sent');

res
.say(message)
.card(card)
.shouldEndSession(true)
.send();
})
.catch((err => {
console.log('-- error sending bulk message', err);
res
.say('There was an error sending the text')
.say(message)
.card(card)
.shouldEndSession(true)
.send();

}))

})
.catch((err) => {
const { message } = parseErrorToMessage(err);
Expand Down

0 comments on commit f268c73

Please sign in to comment.