I am using bot framework to have a chat bot. I use it in Microsoft Teams.
I want to send a message from user to bot programetically. But i am not able to do that.
I tried using direct line but it didnt help me. I am new to this bot framework.
var directLineSecret = "directlinesecretkey";
var client = new DirectLineClient(directLineSecret);
var conversation = await client.Conversations.StartConversationAsync();
var testActivity = new Activity
{
From = new Microsoft.Bot.Connector.DirectLine.ChannelAccount(objectid, userName),
Type = Microsoft.Bot.Connector.DirectLine.ActivityTypes.Message,
Text = "Hello from the PCE!"
};
var response = await client.Conversations.PostActivityAsync(conversation.ConversationId, testActivity);
Activity userMessage = new Activity
{
From = new Microsoft.Bot.Connector.DirectLine.ChannelAccount(objectid, userName),
Text = "test",
Type = Microsoft.Bot.Schema.ActivityTypes.Message
};
await client.Conversations.PostActivityAsync(conversation.ConversationId, testActivity);
await client.Conversations.PostActivityAsync(conversation.ConversationId, userMessage);
Please help me with this. While executing this code i am getting response in var response but the message is not sent nor i see the log in the bot framework.