Reputation: 41
I want to create a dialog with the bot framework. My steps:
Create a new Conversation using the Direct Line API (Works without problems) (Clientside)
The following Dialog gets triggered in the Bot framework (Serverside):
bot.dialog('*:notification', [
function (session, args) {
builder.Prompts.text(session, args)
},
function (session, results) {
logger.info('Results', results)
}])
I want to send a reply to the incoming Message (Clientside)
method:'post',
url:'conversations/' + conversationId + '/activities',
headers:{
'Authorization': 'Bearer' + token
}
body:{
replyToId: replyToId,
type:'message',
from: {
id:'myId'
},
text: 'Some simple text',
textFormat: 'plain'
}
conversationId: I use the one i recieved when i created the conversation
token: I use the one i recieved when i created the conversation
replyToId: The one from the activity Object
Actual Result:
Expected Result:
Upvotes: 4
Views: 721
Reputation: 16652
For the first thing, your dialog '*:notification'
don't have a triggerAction
, you can for example modify your dialog like this:
bot.dialog('*:notification', [
function (session, args) {
builder.Prompts.text(session, args)
},
function (session, results) {
logger.info('Results', results)
}]).triggerAction({matches: /^notification/i});
Then you may use DL to send message from your client side to your bot and trigger this dialog like this:
method:'post',
url:'conversations/' + conversationId + '/activities',
headers:{
'Authorization': 'Bearer' + token
}
body:{
type:'message',
from: {
"id": "1234",
"firstname": "fname",
"lastname": "lname"
},
text: 'notification',
textFormat: 'plain'
}
Upvotes: 2