I've successfully request to the Botframework Directline API and I getting this example of json response:
{
"type": "message",
"id": "XXXXXXXXXXXXXXXX|0000022",
"timestamp": "2019-10-02T21:09:25.001296Z",
"channelId": "directline",
"from": {
"id": "LuchoBotV1",
"name": "LuchoBotV1"
},
"conversation": {
"id": "XXXXXXXXXXXXXXXXX"
},
"text": "Hay algo mas en que pueda ayudarte?",
"speak": "Hay algo mas en que pueda ayudarte?",
"inputHint": "expectingInput",
"replyToId": "XXXXXXXXXXXXXXXX|0000020"
}
Now I'm working in a waterfall dialog which asks to the user some personal information (license,address,sales) and I want to add this data to the response and get a json response like this:
{
"type": "message",
"id": "XXXXXXXXXXXXXXXX|0000022",
...
"context": {address: "Street 123", sales: "5000"}
}
I want to know if it is possible to incorporate this information to the API response. I've been searching in the documentation but I didn't found anything except how to send text.
await stepContext.context.sendActivity(messageText, null, InputHints.IgnoringInput);
You can add the context to activity's channel data.
BotFramework SDK v4 (Node)
await stepContext.context.sendActivity({
text: 'Hello, World!',
channelData: {
context: {address: 'Street 123', sales: '5000'}
}
});
Expected Result
{
"type": "message",
"id": "XXXXXXXXXXXXXXXX|XXXXXX",
...
"text": "Hello, World!",
"channelData": {
"context": {"address": "Street 123", "sales": "5000"}
}
}
Hope this helps!