Varun Mathur
Varun Mathur

Reputation: 21

Issue in create a Azure BOT using Rest API

I am trying to create an Azure bot using Azure Rest API.

I am hitting this API (PUT Request) via the code by replacing the subscription id, resource group name

https://management.azure.com/subscriptions/{subscription id}/resourceGroups/{resourcegroupId}
/providers/Microsoft.BotService/botServices/{botName}?api-version=2018-07-12

Request body as follows

{"location":"global","properties":{"displayName":"{botName}","description":"{botName}","iconUrl":"https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png","endpoint":"{endPoint}","msaAppId":"{app ID}"}}

However I am getting the error as

{
    "error": {
        "code": "InvalidBotData",
        "message": "Bot is not valid. Errors: RuntimeVersion is required.  See https://aka.ms/bot-requirements for detailed requirements."
    }
}

I tried using nodejs (arm-botservice SDK) to create the bot using the same parameters (of course changing the parameters according to our azure portal ids) but I am still getting the same error. I guess internally it will call the same API as above.

Any help would be appreciated to resolve this issue.

Upvotes: 1

Views: 348

Answers (3)

Wesam
Wesam

Reputation: 1070

To create a Microsoft.BotService/botServices/channels resource, add the following JSON to the resources section of your template.

{
"name": "string",
"type": "Microsoft.BotService/botServices/channels",
"apiVersion": "2018-07-12",
"location": "string",
"tags": {},
"sku": {
"name": "string"
},
"kind": "string",
"properties": {
"channelName": "string"
 }
}

Source : https://learn.microsoft.com/en-us/azure/templates/microsoft.botservice/2018-07-12/botservices/channels

Upvotes: 0

Varun Mathur
Varun Mathur

Reputation: 21

Finally, I was able to do it.

I added the kind parameter and then it worked.

Following is the request

{"location":"global",kind="registration","properties":{"displayName":"{botName}","description":"{botName}","iconUrl":"https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png","endpoint":"{endPoint}","msaAppId":"{app ID}"}}

Upvotes: 1

Dana V
Dana V

Reputation: 1347

Programmatic bot creation can not be done with REST at this time.

How to create Web App bot in azure using programmatically?

Use az cli as @joey-cai mentioned.

Upvotes: 0

Related Questions