|
| 1 | +--- |
| 2 | +title: include file |
| 3 | +description: include file |
| 4 | +services: azure-communication-services |
| 5 | +author: jjsanchezms |
| 6 | +manager: chpalm |
| 7 | +ms.service: azure-communication-services |
| 8 | +ms.subservice: azure-communication-services |
| 9 | +ms.date: 07/20/2022 |
| 10 | +ms.topic: include |
| 11 | +ms.custom: include file |
| 12 | +ms.author: sanchezjuan |
| 13 | +--- |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- An Azure account with an active subscription, or [create an Azure account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 18 | + |
| 19 | +- An active Azure Communication Services resource, or [create a Communication Services resource](../../create-communication-resource.md). |
| 20 | + |
| 21 | +- An active Azure Logic Apps resource, or [create a blank logic app with the trigger that you want to use](../../../../logic-apps/quickstart-create-first-logic-app-workflow.md). Currently, the Communication Services Chat connector provides only actions, so your logic app requires a trigger, at minimum. |
| 22 | + |
| 23 | +## Create user |
| 24 | + |
| 25 | +Complete these steps in Power Automate with your Power Automate flow open in edit mode. |
| 26 | + |
| 27 | +To add a new step in your workflow by using the Communication Services Identity connector: |
| 28 | + |
| 29 | +1. In the designer, under the step where you want to add the new action, select **New step**. Alternatively, to add the new action between steps, move your pointer over the arrow between those steps, select the plus sign (+), and then select **Add an action**. |
| 30 | + |
| 31 | +1. In the **Choose an operation** search box, enter **Communication Services Identity**. In the list of actions list, select **Create a user**. |
| 32 | + |
| 33 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-create-user.png" alt-text="Screenshot that shows the Azure Communication Services Identity connector Create user action."::: |
| 34 | + |
| 35 | +1. Enter the connection string. To get the connection string URL in the [Azure portal](https://portal.azure.com/), go to the Azure Communication Services resource. In the resource menu, select **Keys**, and then select **Connection string**. Select the copy icon to copy the connection string. |
| 36 | + |
| 37 | + :::image type="content" source="../media/logic-app/azure-portal-connection-string.png" alt-text="Screenshot that shows the Keys pane for an Azure Communication Services resource." lightbox="../media/logic-app/azure-portal-connection-string.png"::: |
| 38 | + |
| 39 | +1. Enter a name for the connection. |
| 40 | + |
| 41 | +1. Select **Show advanced options**, and then select the token scope. The action generates an access token and its expiration time with the specified scope. This action also generates a user ID that's a Communication Services user identity. |
| 42 | + |
| 43 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-create-user-action.png" alt-text="Screenshot that shows the Azure Communication Services Identity connector Create user action options."::: |
| 44 | + |
| 45 | +1. In **Token Scopes Item**, select **chat**. |
| 46 | + |
| 47 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-create-user-action-advanced.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector advanced options."::: |
| 48 | + |
| 49 | +1. Select **Create**. The user ID and an access token are shown. |
| 50 | + |
| 51 | +## Create a chat thread |
| 52 | + |
| 53 | +1. Add a new action. |
| 54 | + |
| 55 | +1. In the **Choose an operation** search box, enter **Communication Services Chat**. In the list of actions, select **Create chat thread**. |
| 56 | + |
| 57 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-create-chat-thread.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector Create a chat thread action."::: |
| 58 | + |
| 59 | +1. Enter the Communication Services endpoint URL. To get the endpoint URL in the [Azure portal](https://portal.azure.com/), go to the Azure Communication Services resource. In the resource menu, select **Keys**, and then select **Endpoint**. |
| 60 | + |
| 61 | +1. Enter a name for the connection. |
| 62 | + |
| 63 | +1. Select the access token that was generated in the preceding section, and then add a chat thread topic description. Add the created user and enter a name for the participant. |
| 64 | + |
| 65 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-create-chat-thread-input.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector Create chat thread action dialog."::: |
| 66 | + |
| 67 | +## Send a message |
| 68 | + |
| 69 | +1. Add a new action. |
| 70 | + |
| 71 | +1. In the **Choose an operation** search box, enter **Communication Services Chat**. In the list of actions, select **Send message to chat thread**. |
| 72 | + |
| 73 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-send-chat-message.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector Send chat message action."::: |
| 74 | + |
| 75 | +1. Enter the access token, thread ID, content, and name. |
| 76 | + |
| 77 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-send-chat-message-input.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector Send chat message action dialog."::: |
| 78 | + |
| 79 | +## List chat thread messages |
| 80 | + |
| 81 | +To verify that you sent a message correctly: |
| 82 | + |
| 83 | +1. Add a new action. |
| 84 | + |
| 85 | +1. In the **Choose an operation** search box, enter **Communication Services Chat**. In the list of actions, select **List chat thread messages**. |
| 86 | + |
| 87 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-list-chat-messages.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector List chat messages action."::: |
| 88 | + |
| 89 | +1. Enter the access token and thread ID. |
| 90 | + |
| 91 | + :::image type="content" source="../media/logic-app/azure-communications-services-connector-list-chat-messages-input.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector List chat messages action dialog."::: |
| 92 | + |
| 93 | +## Test your logic app |
| 94 | + |
| 95 | +To manually start your workflow, on the designer toolbar, select **Run**. The workflow creates a user, issues an access token for that user, and then removes the token and deletes the user. For more information, review [How to run your workflow](../../../../logic-apps/quickstart-create-first-logic-app-workflow.md#run-workflow). |
| 96 | + |
| 97 | +Now, select **List chat thread messages**. In the action outputs, check for the message that was sent. |
| 98 | + |
| 99 | +:::image type="content" source="../media/logic-app/azure-communications-services-connector-list-chat-messages-output.png" alt-text="Screenshot that shows the Azure Communication Services Chat connector Send chat message action results."::: |
| 100 | + |
| 101 | +## Clean up workflow resources |
| 102 | + |
| 103 | +To clean up your logic app workflow and related resources, review [how to clean up Logic Apps resources](../../../../logic-apps/quickstart-create-first-logic-app-workflow.md#clean-up-resources). |
| 104 | + |
0 commit comments