question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

res.say doesn't work for intentRequest

See original GitHub issue
app.intent('tfc', {
  'slots': {
    'phonenumber': 'AMAZON.NUMBER'
  },
  'utterances': ['{|my} {|contact number} {|phone number} {|number} {|is} {-|phonenumber}']
}, (req, res)=>{
  let number - req.slot('phonenumber');
  let login = new TfcLogin();
  login.sendOtp(number).then((data)=>{
    res.say('Enter the otp received on your phone').shouldEndSession(false);
  }).catch((error)=>{
    res.say(`${error.message}`).prompt('What is your registered contact number').shouldEndSession(false);
  })
})

This is a simple intent request, but it isn’t working the way it should. TfcLogin is a class, and whole code is working fine, if there is an error it falls in the catch block, but res.say isn’t working as expected. Here’s the response that I received

{
  "version": "1.0",
  "response": {
    "directives": [],
    "shouldEndSession": true
  },
  "sessionAttributes": {},
  "dummy": "text"
}

What could be the reason for this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dblockcommented, Sep 13, 2017

No, you must return a Promise from the function. Try return login.sendOtp(number).... to begin with?

0reactions
joshianujcommented, Dec 6, 2017

send in promise like this return(Promise.then((res)=> response.say(res.data.name).send())

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Types Reference (LaunchRequest ...
Your service receives a SessionEndedRequest when a currently open session is closed for one of the following reasons: The user says "exit" or...
Read more >
node.js - Amazon Alexa "AskSdk.RequestEnvelopeUtils Error ...
I fixed my problem because I used the playBehavior ENQUEUE instead of REPLACE_ALL , because ENQUEUE expects a token because if it doesn't...
Read more >
alexa-parrot/README.md at master · dblock/alexa-parrot · GitHub
A simple parroting skill for Alexa to grasp basics of creating alexa skills with Alexa-App library and deploying to AWS Lambda Functions. Requires...
Read more >
alexa-app.session JavaScript and Node.js code examples | Tabnine
describe("intent request with malformed session", function() { var mockRequest = mockHelper.load("intent_request_malformed_session.json"); it("responds a ...
Read more >
My Alexa Skill workflow (Part 1/2) | by Simon Fletcher | Medium
res.say(prompt).reprompt(prompt).shouldEndSession(false); });. Next, we want to handle an IntentRequest sent from the Alexa platform.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found