Direct Line for Microsoft Copilot Studio

The Microsoft Copilot Studio platform lets you build a bot without code.

For an introduction to Copilot Studio, including basic concepts which will provide you with a better understanding of how to integrate Live Hub with a Copilot Studio bot, go to Microsoft Copilot Studio overview.

Copilot Studio doesn't rely on Bot Framework Composer because all required functionality is built in.

Connecting bot to Live Hub

You can connect your Copilot bot to Live Hub using one of the following authentication methods:

Connecting to Live Hub via Direct Line speech channel

The following procedure describes how to obtain the token endpoint URL from your Copilot bot and then how to configure it on Live Hub.

  1. Log in to your Microsoft Copilot Studio account.

  2. In the navigation menu, click Copilots, and then select your Copilot bot.

  3. On the toolbar, click the Channels tab, and then select Direct Line Speech; the Direct Line Speech pane appears on the right.

  4. Click the Copy button corresponding to the 'Token Endpoint' field to copy the endpoint URL:

  1. Configure Live Hub with this copied token endpoint: Paste the token in the Bot URL field under the Direct Line option (see Step 4 in Microsoft Copilot Studio).

Connecting to Live Hub via Web channel security token

The following procedure describes how to obtain the secret key and Environment ID from your Copilot bot, and how to configure it on Live Hub. (For Live Hub, this is configured under the Direct line enhanced authentication option.)

  1. Log in to your Microsoft Copilot Studio account.

  2. In the navigation menu, click Copilots, and then select your Copilot bot.

  3. On the toolbar, click the Settings button.

  4. On the Settings page, click Security, then Authentication, and then choose the No authentication option:

  1. On the Settings page, click Security, then Web channel security, and then click the Copy button corresponding to the required secret (token):

  1. Configure Live Hub with this secret key: Paste the secret key in the Secret key field under the Direct line enhanced authentication option (see Step 4 in Microsoft Copilot Studio).

  2. To obtain the Environment-Id, on the Settings page, click Advanced, expand the Metadata group, and then copy the value in the 'Environment ID' field. (This value also appears in your Copilot bot's URL in the your browser's URL field).

  1. Configure Live Hub with this Environment ID: Paste the Environment ID in the Environment ID field under the Direct line enhanced authentication option (see Step 4 in Microsoft Copilot Studio).

Key concepts

Currently, Microsoft Copilot Studio supports only the start conversation event. For more information, see Saving channel data.

Sending messages

When sending messages from a Copilot Studio bot to Live Hub, you can add session params or activity params to the message.

To add one of them to the message, paste the JSON content in the 'Channel data' section of the message:

When asking a question, you can add channel data using the code editor:

  1. After setting the question text and parameters, open the code editor, by clicking the ellipsis button in the top-right corner, and then choosing Open code editor:

  1. The code editor displays the entire topic as a YAML file:

  1. Change the prompt to contain text and channelData:

  1. Add the desired activity parameters to the question:

Example:

Sending event to Live Hub

To send an event without a message to the user:

  1. Use the Copilot Studio Send an event option:

  1. In the 'Name' field, enter the desired event name ("config" in the example) and in the 'Value' field, enter the desired JSON:

Receiving events from Live Hub

To catch events from Live Hub, use the event received as a trigger topic.

The event name property acts as the condition for checking the Activity.name (see Saving channel data).

Saving channel data

Call details are sent in the 'channel' event at the start of the conversation.

To get call details, start a new topic, and then change the default trigger to Event received:

The event name property acts as the condition for checking Activity.name (in this case, it's equal to channel):

To save a value, use the Parse value option:

In the 'Parse value' field, use the formula with System.Activity.ChannelData:

To save the entire response, from the 'Data type' drop-down list, select From sample data, and then paste the channelData JSON from Call initiation:

Save it as a new parameter (select the Global option to use the variable across topics):