Connect your bot to channels with Azure CLI

A channel is a connection between a communication application and a bot. A bot, registered with Azure, uses channels to enable communication with users. The commands in this article connect a bot to various channels. For more information, see Connect a bot to channels.

Prerequisites

Sample commands

The following sections use Azure CLI commands to connect a bot to a channel. These examples use a bot named ContosoBot in the ContosoBotRG resource group.

Some of these channels require the command to connect with the application to authenticate. If you're running these commands for testing purposes, they can fail if you don't use real values.

Direct Line

Direct Line integrates your bot into a mobile app, web page, or other applications. For more information, see About Direct Line.

These sample commands create a connection to the Direct Line channel by using az bot directline create. The example shows the connection in the console and deletes the connection.

az bot directline create --resource-group ContosoBotRG --name ContosoBot --disablev1
az bot directline show --resource-group ContosoBotRG --name ContosoBot
az bot directline delete --resource-group ContosoBotRG --name ContosoBot

Office 365 email

You can enable your bot to communicate with users by using Office 365 email. For more information, see Connect a bot to Office 365 email.

These sample commands create a connection to the channel for Office 365 email by using az bot email create. The example shows the connection in the console and deletes the connection.

az bot email create --resource-group ContosoBotRG --name ContosoBot \
   --email-address ContosoBot@outlook.com --password <password>
az bot email show --resource-group ContosoBotRG --name ContosoBot
az bot email delete --resource-group ContosoBotRG --name ContosoBot

Facebook

You can connect your bot to both Facebook Messenger and Facebook Workplace. It can communicate with users on both platforms. For more information, see Connect a bot to Facebook.

These sample commands create a connection to the channel for Facebook by using az bot facebook create. The example shows the connection in the console and deletes the connection.

az bot facebook create --resource-group ContosoBotRG --name ContosoBot --appid <myAppId> \
   --page-id <myPageId> --secret <secret> --token <token>
az bot facebook show --resource-group ContosoBotRG --name ContosoBot
az bot facebook delete --resource-group ContosoBotRG --name ContosoBot 

Microsoft Teams

You can configure your bot to communicate with Microsoft Teams. For more information, see Connect a bot to Microsoft Teams.

These sample commands create a connection to the channel for Microsoft Teams by using az bot msteams create. The example shows the connection in the console and deletes the connection.

az bot msteams create --resource-group ContosoBotRG --name ContosoBot --calling-web-hook https://www.contosoapp.com/ \
   --enable-calling 
az bot msteams show --resource-group ContosoBotRG --name ContosoBot 
az bot msteams delete --resource-group ContosoBotRG --name ContosoBot

Skype

You can configure your bot to communicate with Skype. For more information, see Connect a bot to Skype.

These sample commands create a connection to the channel for Skype by using az bot skype create. The example shows the connection in the console and deletes the connection.

az bot skype create --resource-group ContosoBotRG --name ContosoBot --enable-messaging --enable-screen-sharing
az bot skype show --resource-group ContosoBotRG --name ContosoBot 
az bot skype delete --resource-group ContosoBotRG --name ContosoBot

Slack

You can configure your bot to communicate with users through Slack. For more information, see Connect a bot to Slack.

These sample commands create a connection to the channel for Slack by using az bot slack create. The example shows the connection in the console and deletes the connection.

az bot slack create --resource-group ContosoBotRG --name ContosoBot --client-id <clientid> \
   --client-secret <secret> --verification-token <token>
az bot slack show --resource-group ContosoBotRG --name ContosoBot
az bot slack delete --resource-group ContosoBotRG --name ContosoBot

SMS

These sample commands create a connection to the channel for SMS by using az bot sms create. The example shows the connection in the console and deletes the connection.

az bot sms create --resource-group ContosoBotRG --name ContosoBot --account-sid <sid> --auth-token <token> \
   --phone <smsphonenumber> --is-validated
az bot sms show --resource-group BotRG
az bot sms delete --resource-group BotRG

Telegram

You can configure your bot to communicate with users through Telegram. For more information, see Connect a bot to Telegram.

These sample commands create a connection to the channel for Telegram by using az bot telegram create. The example shows the connection in the console and deletes the connection.

az bot telegram create --resource-group ContosoBotRG --name ContosoBot --access-token <token> --is-validated
az bot telegram show --resource-group ContosoBotRG --name ContosoBot 
az bot telegram delete --resource-group ContosoBotRG --name ContosoBot 

Clean up deployment

If you created a resource group for testing, run the az group delete command to remove the resource group and everything it contains.

az group delete --name ContosoBotRG

To remove a connection to a channel, use the appropriate delete command.

Azure CLI commands used in this article

This article uses the following Azure CLI commands:

Next steps