[Docs] Jovo Response Object


#1

Learn more about the Jovo $response object.

Learn more about the Request & Response Lifecycle here.


This is a companion discussion topic for the original entry at https://www.jovo.tech/docs/requests-responses/response

#2

I’d like to be able to manipulate the $response object or the $output object to set shouldEndSession to false when using tell. Essentially, I want to be able to say something back to the user before I move on to another intent handler. How should I go about this?


#3

You have a few options:

this.$alexaSkill.shouldEndSession(true);

Or

this.$output.Alexa.shouldEndSession = true

Or

app.middleware('response').use((handleRequest) => {
   handleRequest.$response.response.shouldEndSession = true;
});

#4

For GoogleConv this:

is the same?


#5

I recommend using the SpeechBuilder for this. You can add a string in one intent handler, and then add another one in the next one. Learn more here: https://www.jovo.tech/docs/output/speechbuilder


#6

No, shouldEndSession is an Alexa-specific property. this.tell() does the same, or you can set the next scene to actions.scene.END_CONVERSATION explicitly

this.$googleAction.setNextScene('actions.scene.END_CONVERSATION');

#7

Ok, so if I don’t want the conversation to end after the tell in Google I have to use the setNextScene?


#8

No. you would use ask.


#9

Sometimes I’m in a situation where I want to say something to the user but I don’t need an answer back, is there anything else that I can use?


#10

yes, tell

There’s no way to keep the session open without prompting the user.


#11

Ok, thanks


#12

I’ve ended up using @jan’s idea of using the speech builder. I add some text in one intent, then forward to another, add some more stuff and then call .tell or .ask.