Is the activating a chat bot by the directLine postActivity best practice?
See original GitHub issue🚨 The issue tracker is not for implementation questions 🚨
[Question] I guess this is a couple questions about activating a chat bot once the client enters the endpoint of the chatbot? Upon using the renderChatBot webchat api and creating a directLine instance a directLine.postActivity() method can be fired off to initiate the bot so if there is a welcome card it will trigger and introduce itself to the end-user.
Is posting an event like this best practice? Is there a more official, alternative and or better way of doing this? I ask because in the example below it is an event that is fired off but what about a message and text event. Does username and name even matter for anything useful in terms of the chatbot?
Ultimately, to fire off the bot is using the postActivity the only way of really achieving this?
directLine
.postActivity({
from: { id: this.userId, name: "USER_NAME" },
name: "requestWelcomeDialog",
type: "event",
value: "token"
})
.subscribe(
id => console.log(`Posted activity, assigned ID ${id}`),
error => console.log(`Error posting activity ${error}`)
);
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@xtianus79 Somewhat related to https://github.com/microsoft/BotFramework-DirectLineJS/issues/184#issuecomment-505162246. Might be worth taking a look.
@tdurnford Yes, exactly what I was wondering lol you always have those exact answers. @compulim just to ask there’s no real reason in a production bot to go beyond that initial post activity for a back-channel event starter? Wanted to confirm that.