Connect a bot to Direct Line

APPLIES TO: SDK v3

You can enable your own client application to communicate with your bot by using the Direct Line channel.

Add the Direct Line channel

To add the Direct Line channel, open the bot in the Azure Portal, click the Channels blade, and then click Direct Line.

Add Direct Line channel

Add new site

Next, add a new site that represents the client application that you want to connect to your bot. Click Add new site, enter a name for your site, and click Done.

Add Direct Line site

Manage secret keys

When your site is created, the Bot Framework generates secret keys that your client application can use to authenticate the Direct Line API requests that it issues to communicate with your bot. To view a key in plain text, click Show for the corresponding key.

Show Direct Line key

Copy and securely store the key that is shown. Then use the key to authenticate the Direct Line API requests that your client issues to communicate with your bot. Alternatively, use the Direct Line API to exchange the key for a token that your client can use to authenticate its subsequent requests within the scope of a single conversation.

Copy Direct Line key

Configure settings

Finally, configure settings for the site.

  • Select the Direct Line protocol version that your client application will use to communicate with your bot.

Tip

If you are creating a new connection between your client application and bot, use Direct Line API 3.0.

When finished, click Done to save the site configuration. You can repeat this process, beginning with Add new site, for each client application that you want to connect to your bot.

When you have the enhanced authentication enabled, you will see the following behavior for which trusted origins are used:

  • If you configure trusted origins as part of the configuration UI page, then these will always be used as the only set. Sending no or additional trusted origins when generating a token or starting a conversation will be ignored (i.e. they are not appended to the list or cross validated).
  • If you have not configured trusted origins as part of the configuration UI, then any value you send as part of the API calls will be used.