Integrate the AI assistant service with Microsoft Teams

Updated at:

The DataWorks AI assistant service can be connected to Microsoft Teams, so that you can use the AI assistant directly in Teams. This topic describes how to configure two integration scenarios: chatting with the AI assistant in a Teams private or group chat, and pushing scheduled task and inspection results to a specified Teams chat or channel.

Overview

The DataWorks AI assistant service supports interaction through the Microsoft Teams channel, covering two independent business scenarios. Configure the scenario that meets your needs. The two scenarios work independently.

Feature

Scenario 1: Chat with the AI assistant in Teams

Scenario 2: Push results to Teams

Interaction direction

Two-way (questions and replies)

One-way (push run results)

Create a Bot

Required

Not required

Configure a callback URL

Required

Not required

Create Workflows

Not required

Required

Typical use

Consultation and O&M Q&A in Teams private or group chats

Scheduled task reports and inspection alerts

How to choose: configure Scenario 1 if you want to ask the AI assistant questions and receive replies in Teams at any time; configure Scenario 2 if you only need scheduled reports or inspection alerts to be sent automatically to a specified chat or channel. The two scenarios are independent and can be configured together.

The following sections describe the configuration steps for the two scenarios. For the complete chains and link diagrams of the two scenarios, see How it worksat the end of this topic.

Core concepts

Before you begin, we recommend that you familiarize yourself with the following core concepts.

Concept

What it is

Where to obtain or configure

Notes

Teams callback URL

The inbound address generated by DataWorks for the instance. When a user sends a message to the Bot in Teams, Bot Framework forwards the message to this URL, and the AI assistant gateway receives and processes it.

Generated and viewed in the instance channel configuration; entered as the Bot's Messaging Endpoint.

Contains a dedicated API Key; reserved first and takes effect after the channel is saved and the instance is running; after rotation, the endpoint must be updated accordingly.

Bot and Messaging Endpoint

The conversation robot created on the Microsoft side and its message receiving address; the Messaging Endpoint is where the callback URL is entered.

Teams Developer Portal or Azure Bot management.

After creation, associate the Bot with the Teams app and enable the Microsoft Teams channel.

Client ID / Client Secret

Microsoft app registration credentials used by DataWorks to verify the Bot identity during conversations.

Microsoft Entra app registration; the secret is created under Certificates & secrets.

The secret is displayed only once at creation; the three values must correspond to the same Bot registration.

Tenant ID

The Microsoft Entra directory ID that identifies the Microsoft 365 tenant the Bot belongs to.

Directory (tenant) ID of the Microsoft Entra app registration.

Not the DataWorks tenant ID.

Private chat pairing and pairing code

The approval mechanism for the first private chat: after a user sends a message, a request with a pairing code is generated, and the user can converse only after the administrator approves it.

The request is initiated in Teams; approved in Private Chat Pairing on the instance card.

The request is valid for about 1 hour; this process applies only to private chats and is not required for group chats.

Workflows webhook URL

The trigger address generated by Teams Workflows; DataWorks calls this address outbound to push run results.

Copied from the Teams Workflows workflow details page.

Keep it confidential as a secret; select Anyone for the trigger caller; used only for the push scenario.

Prerequisites

  • An AI assistant service instance is created and is in the Running state. For more information, see Use the AI assistant service. Only public-cloud AI assistant service instances that support the Teams channel display the Teams configuration entry.

  • Scenario 1: You have DataWorks instance management permissions, and Teams app creation or installation permissions in the target Microsoft 365 tenant.

  • Scenario 2: You have permission to create Workflows in the target Teams chat or channel.

Scenario 1: Chat with the AI assistant in Teams

This scenario lets users ask the AI assistant questions and receive replies in Teams private or group chats. Complete the following five steps. Steps 1 to 4 are completed by the instance administrator; Step 5 requires cooperation between the administrator and the end user.

Step 1: Obtain the Bot's Teams callback URL in DataWorks

The Teams callback URL is the inbound address generated by DataWorks for the current instance: when a user sends a message to the Bot in Teams, Microsoft Bot Framework forwards the message to this URL, and the AI assistant gateway receives and processes it. Therefore, in Step 2 you must enter this URL as the Bot's Messaging Endpoint.

  1. Log on to the DataWorks console. Go to AI Assistant Service > target instance > Basic Information > Channel Configuration, and click Configure on the Microsoft Teams card.

  2. In the configuration dialog box, locate the Teams Callback URL and click Copy. The callback URL is a complete HTTPS address in the following format:

    https://<AI assistant gateway domain>/<instance path>/api/messages?apikey=sk-ai-assistants-...

    Copy the full URL. Keep the path and the apikey query parameter. Do not concatenate the URL manually.

  3. Keep the configuration dialog box open and create the Bot in Microsoft. The callback URL is only reserved for the instance at this point, and takes effect after you save the Teams channel and the instance enters the Running state.

Important

The callback URL contains a dedicated Teams API Key. Keep it confidential as a secret. Do not post it in group chats or include it in screenshots. If you click Regenerate API Key on the instance card, the old URL becomes invalid, and you must update the Bot's messaging endpoint.

Step 2: Create the app and Bot in Teams

  1. Open the Teams Developer Portal and log on to the target Microsoft 365 tenant. In Apps, create a Teams app and enter the app name and basic information.

  2. In the left-side navigation pane, choose Tools > Bot management > New Bot. Enter a Bot name and create the Bot. Return to the app you created, and go to Configure > App features > Bot to associate the Bot. Select the Bot scope based on your needs (private chat, or group/channel). Bots created in the Developer Portal are single-tenant by default.

  3. Set the complete Teams callback URL copied in Step 1 as the Bot's Messaging Endpoint. If you register through Azure Bot management, open Settings > Configuration in the Bot resource in the Azure portal, enter and save the URL, and then turn on Microsoft Teams in Channels.

  4. Obtain the Client ID, Client Secret, and tenant ID for this Bot registration. If you use Microsoft Entra app registration, find the app in App registrations, record the Application (client) ID and Directory (tenant) ID, and create a secret in Certificates & secrets > New client secret. Copy the Value, not the Secret ID.

    Note

    Credentials and Bot registrations across tenants may be managed centrally by an administrator. If these three values are not visible on the page, ask the administrator to provide the credentials for the same registration. Do not mix credentials from other apps.

  5. In the Developer Portal, use Preview in Teams to preview and install the app, or ask the tenant administrator to publish it to the organization store and add it from the Teams app list. To chat in a group or channel, also add the app to the target group or channel.

Optional: If you have development permissions, you can also use the Teams Developer CLI to create the app, Bot, and credentials at once. For more information, see the official CLI workflow.

teams login --device-code
teams app create --name "DataWorks AI Assistant" \
  --endpoint "<complete Teams callback URL copied in Step 1>"

After the command completes, save the output Teams App ID/Bot ID, Client ID, Client Secret, tenant ID, and the Install in Teams link. The Client Secret is usually displayed only once. If the CLI reports that custom app installation is restricted, contact the tenant administrator. After installation, continue with Step 3.

Step 3: Save the Teams channel in DataWorks

  1. In the dialog box kept open in Step 1, configure the following parameters. The three values must correspond to the same Bot registration.

    Parameter

    Description

    Client ID

    The Microsoft app ID used by the Bot.

    Client Secret

    The secret value of the app registration.

    Tenant ID

    The Microsoft Entra directory ID, not the DataWorks tenant ID.

  2. Select the group chat scope:

    • All group members can @ the assistant (default): After the robot joins a group or channel, members must @ it to trigger a reply.

    • Private chat only: Only private chats are enabled.

  3. Click Save. The instance may restart. Wait until the state returns to Running. You can view the saved callback URL again in URL Callback on the Teams card.

    Note

    If the page shows "The address is reserved but the gateway is not ready", retry later or click Retry Configuration. Do not rotate the API Key prematurely.

Step 4: Check the channel and initiate a private chat request

  1. In the instance details, choose Access Control > Webhook Source IP Whitelist to configure the allowed callback source IPs. Because Microsoft does not provide a fixed list of source IP addresses for Bot Framework callbacks, allow all source IPs (0.0.0.0/0) to reliably receive Teams messages. For more information, see the Microsoft official documentation.

    Important

    This IP whitelist is shared with the WeCom URL callback. Allowing 0.0.0.0/0 also removes the source IP restriction for the WeCom URL callback.

  2. On the Microsoft Teams card, click Test Network Connectivity. If outbound access is not established, click Enable Channel Network and follow the on-screen instructions.

  3. In Teams, open the installed app and send "Hello" to the Bot. If the first private chat is not approved, the Bot prompts you to contact the instance administrator and displays a pairing code. This message only initiates the pairing request and does not execute an actual question. Record the pairing code; the administrator verifies it when approving the private chat in Step 5.

Step 5: The administrator approves the private chat, and the user resends the message

  1. The instance administrator goes to AI Assistant Service > target instance > Basic Information > Microsoft Teams card, hovers over URL Callback, and clicks Private Chat Pairing in the pop-up. The instance must be Running; otherwise the entry is unavailable.

  2. Click Refresh and view the applicant name, user ID, pairing code, and request time in Pending Approval Requests. After verifying them against the pairing code and identity the user received in Teams, click Approve Private Chat for the corresponding request, and confirm again in the confirmation dialog box.

    Note

    The request is valid for about 1 hour. If it expires, ask the user to resend a message in Teams to reapply.

  3. After the page confirms that the approval succeeded, verify that the applicant appears in the Allowed Private Chats list. If "Retry Save" or "Approval result not confirmed" appears, retry as prompted and confirm it is saved.

  4. Ask the user to return to Teams and resend "Hello" or the actual question. The private chat acceptance is complete when the assistant replies. Approval only opens the private chat for that applicant and does not automatically open other users. To revoke, the administrator can click Disable for the user in the Allowed Private Chats list and confirm. A disabled user must initiate pairing again.

Note

For a group or channel, after you enable the group chat scope in Step 3 and add the app to the target group or channel, members can test by @-mentioning the Bot. Group chats do not require the private chat approval process described above.

Note

If Teams shows the message was sent but the instance did not receive it, first check the complete messaging endpoint, source IP whitelist, certificate, and gateway. If the instance received the message but does not reply, check private chat pairing and the outbound network.

Scenario 2: Push scheduled task and inspection results to Teams

This scenario sends AI assistant service run results one-way to a specified Teams chat or channel. It does not require creating a Bot, or configuring the Teams callback URL or private chat pairing from Scenario 1. You need a running AI assistant service instance and permission to create Workflows in the target Teams chat or channel.

Step 1: Create a notification workflow in Teams and copy the webhook URL

  1. Determine the target chat or channel for the notification, and select a template that matches the actual receiving location.

    • Channel: In Teams, find the target team and channel, click … > Workflows next to the channel, and select Send webhook alerts to a channel.

    • Chat: From the chat's Workflows entry or the Workflows app on the left side of Teams, search for Send webhook alerts to a chat.

  2. Select the target chat or team/channel based on the template, check the workflow's sending identity and connection, and click Save. After saving, go to the workflow details page and click Copy webhook URL. You can later find the workflow in Workflows > Your workflows to view run records and manage the URL. For more information, see Microsoft's steps for creating a Workflows incoming webhook.

  3. Currently, the AI assistant service's Workflows push does not attach a Microsoft OAuth Bearer Token; that is, it invokes the trigger anonymously. Therefore, in the Teams workflow trigger configuration, set "who can invoke the trigger" to Anyone. If this option is set to a caller that requires authentication, push requests are rejected because no token is attached.

    Important

    If your organization's security policy prohibits setting the trigger caller to Anyone, the current version of the AI assistant service cannot push to this webhook URL directly. An administrator must configure an OAuth authentication solution before it can be used.

  4. Save the copied URL as a secret. This URL is used only for this notification scenario and does not use the Bot Client Secret.

Note

The instance must be able to access the actual full domain of this Workflows URL and port 443 outbound. If the instance also enables Scenario 1, the Bot's Enable Channel Network covers only common Bot targets and does not guarantee coverage of the tenant-specific Workflows domain. When using PVL/PrivateZone, provide the exact domain to the network administrator for configuration.

Step 2: Create a Teams scheduled task through conversation

Interact with the assistant privately in AI Assistant Service > target instance > Open Conversation. Do not paste a signed Workflows URL in a multi-person group chat. You can copy the following example and replace the angle-bracket content with your own values:

Create a scheduled task "Daily Failed Task Summary": every day at 09:00 (UTC+8), count yesterday's failed tasks in workspace <workspace ID>, summarize them by failure cause, and provide handling suggestions. Generate the report only; do not rerun tasks automatically. Push the results one-way to this Teams Workflows webhook URL: <complete URL copied in Step 1>, using the webhook push target. Before creating it, tell me the task name, execution time, inspection scope, and target chat name. After creating it, tell me whether the task is enabled and how to view and pause it. Do not echo the URL's signature parameters in your reply.

Complete information such as the workspace as the assistant asks, verify it, and then let the assistant create the task. Then send View scheduled tasks in the conversation to confirm the status, or append a task name to the command to view a single task. To adjust, send "Pause/Resume scheduled task <task name>" or "Change this task to 10:00 every day". When the task reaches its scheduled time, view the card in the target Teams chat/channel and check the Workflows run records to verify the trigger was received.

Note

A standard Workflows URL is recognized and sent as a Teams Adaptive Card. A special custom domain requires the administrator to explicitly configure the Teams webhook target.

Step 3: Create an inspection through conversation

Important

An abnormal-instance O&M inspection may automatically rerun failed tasks, unlike the read-only daily report in Step 2. Before creating it, determine the inspection frequency, push frequency, workspace scope, and maximum number of reruns.

You can copy the following example and replace the angle-bracket content with your own values:

For workspace <workspace ID>, create an "Abnormal Instance Inspection": check every 5 minutes and push the report every 30 minutes to this Teams Workflows webhook URL: <complete URL copied in Step 1>. Automatically rerun a single instance at most once. First list the inspection scope, automatic rerun conditions, time, and push target for my confirmation, and create it after I confirm. Do not echo the URL's signature parameters in your reply.

After you confirm the inspection scope, automatic rerun conditions, and push target, the assistant creates the task and returns the creation result. Then send "View scheduled task Abnormal Instance Inspection" in the conversation to confirm the task status.

Note

If you only need a read-only inspection for data quality or governance, declare "analyze only, push reports only, do not rerun automatically" in the creation instruction and provide the workspace and check dimensions. The automatic-rerun example above is not suitable for critical business workspaces. When inspection results are empty, no notification may be generated; during verification, check both the task run result and the Workflows run records.

FAQ

Scenario 1: Chat troubleshooting

Symptom

Error or behavior

Possible cause

Self-check action

Teams Bot not found or cannot be installed

No specific error; the app is not visible in the Teams app list.

The app is not published to this tenant; custom app installation is disabled; signed in to the wrong tenant.

Check the app publication status and installation policy in the Developer Portal; confirm the signed-in tenant is correct.

The Bot opens but messages get no reply

Teams shows the message as sent; no response on the instance side.

The messaging endpoint is incomplete or incorrect; the instance is not running; inbound blocked by whitelist, certificate, or gateway; private chat not approved.

Verify the endpoint matches the console callback URL character by character; check the instance state, whitelist, and certificate; check private chat pairing.

The copied callback URL does not work when used immediately

The page shows "The address is reserved but the gateway is not ready".

The Teams channel is not saved yet, or the gateway route is not ready.

This is the normal reservation mechanism: it takes effect after the channel is saved and the instance enters the Running state, or click Retry Configuration.

No pending approval request in private chat pairing

The Pending Approval Requests list is still empty after refreshing.

The user has not sent a private chat message; the instance is not running; inbound blocked.

Confirm the user sent a message to the Bot and the instance is running; check the callback URL, source IP whitelist, and outer gateway.

Private chat still unavailable after approval

"Request expired" appears, or messages sent after approval still get no reply.

The request expired (about 1 hour); the user did not resend the message; the approval was not saved to Allowed Private Chats.

Ask the user to resend the message to reapply; confirm the applicant appears in the Allowed Private Chats list.

No response when @ in a group

The @ message gets no response.

The app is not added to the group/channel; the group chat scope is not open; the message did not actually @ the Bot.

Check where the app is added, the console group chat scope, and the @ target.

Scenario 2: Push troubleshooting

Symptom

Error or behavior

Possible cause

Self-check action

Workflows created but URL not found

No copy entry on the workflow details page.

Not saved successfully; wrong entry point.

Open the corresponding workflow details under Workflows > Your workflows and copy the webhook URL; confirm it was saved successfully.

Scheduled task shows created but Teams received no card

The task status is enabled, but no message is pushed when the scheduled time is reached.

Misread scheduled time or time zone; task paused; outbound 443 to the Workflows domain blocked; workflow run failed.

Check the scheduled time and time zone, task status, and instance outbound connectivity, and review the Workflows run records.

Workflows shows triggered but the target has no message

The run record shows a successful trigger.

Wrong chat/channel specified in the workflow; connection authorization expired; send action failed.

Verify the workflow target and connection authorization; check the send action result in the run details.

The template asks to select the caller identity

The template asks "who can invoke the trigger", or requires an OAuth Bearer Token.

The current push does not attach an OAuth token.

Set the trigger caller to Anyone; if organization security policy does not allow this, contact the administrator to configure an OAuth authentication solution.

Important

Keep the Client Secret in Scenario 1 and the callback URL apikey separately. After rotating the callback API Key, update the Bot's messaging endpoint. The Workflows URL in Scenario 2 may contain signature parameters. After rotation, ask the assistant to update the push target of the related scheduled tasks or inspections.

How it works

Scenario 1 uses an inbound callback: after a user sends a message to the Bot in Teams, Microsoft Bot Framework pushes the message to the Teams callback URL provided by DataWorks, and the AI assistant gateway receives and processes it. Complete chain: the administrator obtains the callback URL in DataWorks and enters it as the Bot's Messaging Endpoint, then fills in the Bot credentials and saves the channel; after a user sends a message in Teams, Bot Framework POSTs the message to the callback URL, and the AI assistant gateway verifies the source and private chat pairing, generates a reply, and returns it to Teams.

image

Scenario 2 uses an outbound push: DataWorks pushes scheduled task and inspection results to the webhook URL provided by Teams Workflows, and Teams delivers the results to the target chat or channel. Complete chain: create Workflows in Teams and copy the webhook URL, bind it in a conversation as the push target of a scheduled task or inspection, and when the task reaches its scheduled time, the instance calls the URL outbound to send the result as a card to the target chat or channel.

image