1. Home
  2. Docs
  3. Code
  4. ConversationRequest

ConversationRequest

ConversationRequest(chName, chObject)

This class represent the request and response to the user device

Constructor

new ConversationRequest(chName, chObject)

Parameters:
Name Type Description
chName string channel name
chObject object

Methods

card(opt)

set the response text implementation is channel dependent opt attributes:
type values Simple, Standard – implemented only for Alexa
title – string
subtitle – string – implemented for Google
content – string – implemented for Simple Alexa card and Google in Google map to the bodyText
text – string – implemented for Standard Alexa card and Google
image – object – Alexa includes smallImageUrl and largeImageUrl Google url or smallImageUrl
optional – implemented for Google – accessibilityText, width, height
useProxy – boolean true , false
button object – implemented for Google includes text, url
Parameters:
Name Type Description
opt object

clearStoredNextRequest()

clear the stored request

done()

the request / response flow was done after calling this function response will be send to the user device this method is called automatically by the system

getAccessToken() → {string}

return the request authorization token (account linking flow)
Returns:
token
Type
string

getChannel() → {string}

return the channel name
Returns:
channel name (e.g alexa, google etc)
Type
string

getCloseNoTextMessage() → {string}

return a message send to the user when we close the session and no text message defined
Returns:
the message
Type
string

getIntentName() → {string}

return the request intent
Returns:
intent name
Type
string

getLinkAccountAgainMessage() → {string}

return a channel message for requesting account linking again
Returns:
the message
Type
string

getLinkAccountMessage() → {string}

return a channel message for requesting account linking
Returns:
the message
Type
string

getLocale() → {string}

return the request locale
Returns:
locale e.g en
Type
string

getSession() → {object}

return the session information
Returns:
session (key / value)
Type
object

getStoredNextRequestIntentName() → {string}

get the stored request intent name
Returns:
the intent name
Type
string

getUser() → {object}

return the request user object – information is channel dependent
Returns:
user data
Type
object

getUserId() → {string}

return the request user id – information is channel dependent
Returns:
user id
Type
string

isStoredNextRequest() → {boolean}

check if there is stored request
Returns:
true if stored request exist
Type
boolean

linkAccount()

set the user device to account linking request implementation is channel dependent

reprompt(text)

set the response reprompt text using this function will override settings configured in the Interaction
Parameters:
Name Type Description
text string

say(text)

set the response text you may call this function multiple times, all the text will be send to the user device
Parameters:
Name Type Description
text string

shouldEndSession(endSession)

set the response end session behavior
Parameters:
Name Type Description
endSession boolean

slot(slot) → {string}

return the request slot value
Parameters:
Name Type Description
slot slotName name
Returns:
value
Type
string

storeAsNextRequest()

store this request to be use as next request

useSlotValueInRequest(slot, slot)

set the current slot value
Parameters:
Name Type Description
slot string name
slot string value

useStoredNextRequest()

override the current request information with stored request
Was this article helpful to you? Yes No

How can we help?