Last active
January 13, 2021 08:43
-
-
Save eternaltung/f4021774464e7452be90c332a89e17c6 to your computer and use it in GitHub Desktop.
Bot Framework ConnectorClient Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task.Run(async () => | |
{ | |
string appID = "id"; | |
string appPW = "pw"; | |
ChannelAccount botAccount = new ChannelAccount(name: "bot name", id: ""); | |
ChannelAccount userAccount = new ChannelAccount(name: "user name", id: ""); | |
var serviceUri = new Uri("https://facebook.botframework.com"); | |
var connector = new ConnectorClient(serviceUri, appID, appPW); | |
MicrosoftAppCredentials.TrustServiceUrl(serviceUri.AbsoluteUri); | |
var conversationId = await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount); | |
var msg = new Activity() | |
{ | |
Type = ActivityTypes.Message, | |
From = botAccount, | |
ChannelId = "facebook", | |
Recipient = userAccount, | |
Text = "push1", | |
Conversation = new ConversationAccount(id: conversationId.Id) | |
}; | |
await connector.Conversations.SendToConversationAsync(msg); | |
}).Wait(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you , Dr. Tung.