Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The context key is not initialised if it’s not in reply #118

Open
newdev7 opened this issue Dec 2, 2016 · 0 comments
Open

The context key is not initialised if it’s not in reply #118

newdev7 opened this issue Dec 2, 2016 · 0 comments

Comments

@newdev7
Copy link

newdev7 commented Dec 2, 2016

I have created a new app in wit.ai. In stories, after the 'User says', I have added a function getReply() using 'Bot executes' and added two context keys with branch in it. If both the keys are available, I'm sending a reply to the user using the 'Bot says' and it will go to the next step else it will ask the missing key to the user.

The issue is, in the reply I'm using only one of the context key. The flow works if that key is available. It doesn't considers about the other key. It is checking both keys only if we add both the keys in the reply.

In the code I'm checking those keys in the function getReply() and then adding it to the context.

const actions = {
send(request, response) {
...
...
...
return new Promise(function(resolve, reject) {
...
return resolve();
})
.then()) => null)
.catch((err) => {
'Error occurred',
id,
':',
err.stack || err
);
});
},
function getReply({context, entities}) {
return new Promise(function(resolve, reject) {
...
...
...
context.key1 = value1;
context.key2 = value2;
return resolve(context);
}
}

Is everything correct or am I missing something? Why the context key is not initiated if its not in the reply.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant