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.

Alexa Adapter - Session Attributes

See original GitHub issue


I would like to ask for clarification. In documentation Session Attributes, it isn’t quite clear if TurnContext parameters are mapped into Session Attributes automatically.

When bot gets request from Alexa then new attributes are added into TurnContext, like here: image

When this is send back to Alexa these parameters are not mapped into session attributes:

	"body": {
		"version": "1.0",
		"response": {
			"outputSpeech": {
				"type": "PlainText",
				"text": "TEXT_TO_SPEECH"
			"card": {
				"type": "Standard",
				"title": "TITLE",
				"text": "TEXT",
				"image": {
					"smallImageUrl": "https://....................jpg",
					"largeImageUrl": "https://....................jpg"
			"directives": [],
			"shouldEndSession": true,
			"type": "_DEFAULT_RESPONSE"
		"sessionAttributes": {}

Does it means that I need to add code to map parameters from TurnContext and then it will be added as to Session Attributes? My first thought was that all TurnContext parameters are mapped automatically. Could you please clarify?


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

mwnowickicommented, Jun 18, 2019


Yes, I’m using Virtual Assistant template which uses OnTurnAsync. Solution for this problem was to run “SaveChangesAsync” on states objects:

await _conversationState.SaveChangesAsync(turnContext, false, cancellationToken);
await _userState.SaveChangesAsync(turnContext, false, cancellationToken);


mwnowickicommented, Jun 27, 2019

Hi @BeigeBadger

Please download source code for ‘RouterDialog’ then you will see that this functionality is defined there. I made extension to that class but you can have a different solution based on your needs.


Read more comments on GitHub >

github_iconTop Results From Across the Web

Managing Attributes | Alexa Skills Kit
Session attributes persist throughout the lifespan of the current skill session. Session attributes are available for use with any in-session request.
Read more >
Need a beginner lesson for Sessions Attribute in Alexa skill ...
Can someone please guide me to a very basic beginners tutorial for Sessions attribute in Alexa skill development. I want to understand how...
Read more >
How to store data in your Alexa skills - Medium
So as I mentioned previously, there are two main ways to store data for Alexa skills when using the NodeJS SDK. Those are...
Read more >
ask-sdk-v1adapter and Saving Session Attributes #414
I have two skills that use DynamoDB via the dynamoDBTableName property to save session attributes. If using the V1 SDK via require('alexa-sdk') ...
Read more >
Persistence Adapter in a self hosted alexa skill - Forums
Currently I'm implementing a self hosted skill with NodeJS and everything went fine. But now I would like to use session attributes and ......
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 Post

No results found

github_iconTop Related Hashnode Post

No results found