Is there any management API for Bot Framework

断了今生、忘了曾经 提交于 2019-12-13 00:23:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!