botframework - Starting a conversation with Microsoft bot builder and microsoft bot framework -
i tried have bot start conversation user don't know in code should send message from. documentation starting convo here, it's not super helpful: http://docs.botframework.com/connector/new-conversations/#navtitle. tried replying in handlesystemmessages (which works emulator if change message type) still won't send first message.
i'm using microsoft bot connector , c#.
// idk how syntax highlighting in stackoverflow // code messagecontroller class
public async task<message> post([frombody]message message) { if (message.type == "message") { return message.createreplymessage($"you said:{message.text}"); } else { return handlesystemmessage(message); } }
i spent lot of time researching issue. result, managed initiate sending message on behalf of bot. example sends message group conversation. code below - rough draft works:
class program { static void main(string[] args) { var connector = new connectorclient(new uri("https://skype.botframework.com")); var conversationid = "19:conversationaccountid@thread.skype"; var conversation = new conversationaccount(true, conversationid); var botaccount = new channelaccount("28:74a05skypebotchannelaccountid", "your bot name"); imessageactivity message = activity.createmessageactivity(); message.from = botaccount; message.conversation = conversation; message.channelid = "skype"; message.text = "some text"; message.locale = "en-en"; connector.conversations.sendtoconversation((activity)message); } }
Comments
Post a Comment