Node.js alexa sdk传递会话属性
显示sessionAttributes是响应参数之一,不在Node.js alexa sdk传递会话属性,node.js,alexa,alexa-sdk-nodejs,Node.js,Alexa,Alexa Sdk Nodejs,显示sessionAttributes是响应参数之一,不在响应对象内 我使用的是,所有的emit响应生成器只使用response对象的参数。例如: this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech, updatedIntent) 那么,我如何使用Alexa SDK中的emit(),并在响应中传递更新的sessionAttributes?Alexa SDK会自动序列化并包含在调用emit(…)之前在属性对象上设
响应
对象内
我使用的是,所有的emit
响应生成器只使用response
对象的参数。例如:
this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech, updatedIntent)
那么,我如何使用Alexa SDK中的
emit()
,并在响应中传递更新的sessionAttributes?Alexa SDK会自动序列化并包含在调用emit(…)
之前在属性
对象上设置的键值对
更具体地说,你可以说:
this.attributes.myAttribute1 = 'some value';
this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech, updatedIntent);
并且,sessionAttributes
对象将在响应中自动更新,以包括:
'myAttribute1': 'some value`
作为参考,您可以在SDK中看到elicitSlot的实现,如下所示: