Embed an Azure AI Health Bot instance in your client application using Direct Line channel

Key concepts in Direct Line API

You can enable communication between your bot and your client application by using the Direct Line API. This article introduces key concepts in Direct Line API 3.0 and provides information about relevant developer resources.

Authentication

Direct Line API 3.0 requests can be authenticated either by using a secret that you obtain from the Direct Line channel configuration page in the Azure AI Health Bot Management Portal or by using a token that you obtain at runtime. For more information, see Authentication.

Starting a conversation

Direct Line conversations are explicitly opened by clients and can run as long as the bot and client participate and have valid credentials. For more information, see Start a conversation.

Sending messages

Using Direct Line API 3.0, a client can send messages to your bot by issuing HTTP POST requests. A client can send a single message per request. For more information, see Send an activity to the bot.

Receiving messages

Using Direct Line API 3.0, a client can receive messages from your bot either via WebSocket stream or by issuing HTTP GET requests. Using either of these techniques, a client can receive multiple messages from the bot at a time as part of an ActivitySet. For more information, see Receive activities from the bot.

Developer resources

The Bot Framework provides client libraries that facilitate access to Direct Line API 3.0 via C# and Node.js. For more information, see Direct line API resources

Web chat control

The Azure AI Health Bot provides a control that enables you to embed a Direct-Line-powered bot into your client application. For more information, see the WebChat channel.

Enable communication using the Direct Line channel

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

  1. Sign-in to the Azure AI Health Bot Management Portal
  2. In the left menu blade, select Channels under Integration.
  3. Select the View action of the Direct Line channel.
  4. Copy and securely store the secret key that is shown.
  5. 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.

A screenshot of the directline channel

Next steps

Azure AI Health Bot Channels