问题
I am looking to build a multi Chanel bot service in my application using Microsoft Bot Framework, I cant find out the documentation for managing creating bot app, adding and updating channels in bot. is it possible to do those activities programmatically?
回答1:
No, it's not possible. There is no API for that yet.
回答2:
I found the solution. There is an API Microsoft Azure Management Bot Service Library Install-Package Microsoft.Azure.Management.BotService -Version 0.9.1-preview
public string RegisterFbChanelTest()
{
var credentials = SdkContext.AzureCredentialsFactory.FromFile("azureauth.json");
var client = new AzureBotServiceClient(credentials){SubscriptionId = "xxxxx"};
var fbChanel = new FacebookChannel();
fbChanel.Properties = new FacebookChannelProperties()
{
AppId = "xxxxxxxxxxxx",
AppSecret = "xxxxxxxxxxxxxxxxxxx",
IsEnabled = true,
Pages = new List<FacebookPage>()
{
new FacebookPage()
{
Id ="xxxxxxxxxxxxxxxxxx",
AccessToken = "xxxxxxxxxxxxxx"
}
}
};
var chanel = new BotChannel(
name: @"buttlerbot/FacebookChannel",
type: "Microsoft.BotService/botServices/channels",
location: "global",
properties: fbChanel,
type: "Microsoft.BotService/botServices/channels",
);
var chanels = client.Channels.ListByResourceGroup("bots", "xbuttlerbot");
// client.Channels.Delete("bots", "xbuttlerbot", "FacebookChannel");
var result = client.Channels.Create("bots", "xbuttlerbot", Microsoft.Azure.Management.BotService.Models.ChannelName.FacebookChannel,
chanel
);
return "";
}
Make sure to check the bot Activity In Azure portal.
来源:https://stackoverflow.com/questions/47183423/is-there-any-management-api-for-bot-framework