> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open.cx/llms.txt
> Use this file to discover all available pages before exploring further.

# AI WhatsApp Support in Dynamics 365

> Route WhatsApp Business conversations from OpenCX into Dynamics 365 Omnichannel for Customer Service as live work items.

WhatsApp handoffs flow through <Tooltip tip="Dynamics 365 Omnichannel for Customer Service — a real-time agent workspace where live work items appear as chats.">Omnichannel for Customer Service</Tooltip> as `oc_liveworkitem` records. Reps handle them as chats in the **Omnichannel Agent** app, not as incidents.

## Pre-requisites

<Warning>
  **Connect WhatsApp in OpenCX first.** Dynamics handoff has nothing to route until a WhatsApp number is live — see [Connect WhatsApp](/whatsapp/connect-whatsapp).
</Warning>

* **WhatsApp number connected** — see [Connect WhatsApp](/whatsapp/connect-whatsapp).
* **Dynamics 365 credentials saved** — see [Connect to OpenCX](/integrations/dynamics-365/connect).

## How conversations land in Dynamics 365

```mermaid theme={"dark"}
flowchart LR
  A[Customer messages WhatsApp] --> B[AI answers]
  B --> C{AI can resolve?}
  C -- Yes --> D[Conversation closes]
  C -- No --> E[Handoff triggers]
  E --> F[oc_liveworkitem created]
  F --> G[Rep picks up in Omnichannel Agent]
```

## Setting up

<Steps>
  <Step title="Confirm the WhatsApp number is live">
    Send a test message to your WhatsApp number and confirm the AI responds. If not, revisit [Connect WhatsApp](/whatsapp/connect-whatsapp).
  </Step>

  <Step title="Confirm Dynamics is connected">
    The **Dynamics 365** card on your [Settings → Integrations](https://platform.open.cx/settings/integrations) should show **Active**.
  </Step>

  <Step title="Point the workstream to your WhatsApp rep queue">
    Copy the workstream GUID from **Omnichannel admin center → Workstreams** for the rep team that should handle WhatsApp, and paste it into `default_queue_id` in the OpenCX Dynamics settings. For this WhatsApp handoff flow, `default_queue_id` is a legacy/shared setting name and should contain the **Omnichannel workstream GUID** used to route `oc_liveworkitem` chats — not an incident queue GUID. Other Dynamics 365 docs may use the same field name for incident-style routing, so if you're configuring cases/incidents rather than Omnichannel live chat, follow that flow's queue-specific instructions instead.
  </Step>

  <Step title="Trigger a test handoff">
    Message your WhatsApp number with *"I need a human"*. The AI hands off; the live work item appears in the **Omnichannel Agent** app tied to the routing rules on the workstream you set.
  </Step>
</Steps>

## What the rep sees

* A **live WhatsApp chat** in the Omnichannel Agent app — not an incident.
* The AI's session summary as the conversation subject.
* `sessionId` and `channel: whatsapp` in the work item's context variables.
* The customer's WhatsApp phone number on the work item (email may be empty).
* OpenCX records `dynamics365_chat_id` on the OpenCX session for audit.

## Channel-specific details

<AccordionGroup>
  <Accordion title="24-hour WhatsApp session window" icon="clock">
    WhatsApp's Business API only allows reps to send free-form messages within 24 hours of the customer's last inbound message. After that window, outbound messages must use approved templates. Omnichannel honors this restriction — reps will see a template picker outside the window.
  </Accordion>

  <Accordion title="Contact lookup is email-first, so WhatsApp contacts may be unlinked" icon="address-card">
    OpenCX links contacts by `emailaddress1`. WhatsApp sessions often have no email, so the live work item may arrive without a linked contact. Reps can link one from the conversation view — or collect an email in the AI flow before handoff.
  </Accordion>

  <Accordion title="Media attachments" icon="paperclip">
    Images, audio, and documents the customer sends in WhatsApp attach to the Omnichannel conversation thread. Meta's WhatsApp media size limits apply (typically 16 MB).
  </Accordion>

  <Accordion title="Rep replies in Omnichannel don't sync back to OpenCX today" icon="triangle-exclamation">
    Reps continue the conversation inside Dynamics. Messages they send don't back-sync into the OpenCX session; OpenCX marks the session as handed off once the live work item is created.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="AI WhatsApp Support" icon="whatsapp" href="/whatsapp/introduction">
    Connect a number, configure the AI agent.
  </Card>

  <Card title="Conversations in Dynamics 365" icon="diagram-project" href="/integrations/dynamics-365/conversations">
    Routing rules, live work item payload, observability.
  </Card>

  <Card title="Connect to OpenCX" icon="plug" href="/integrations/dynamics-365/connect">
    Paste credentials and verify.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/integrations/dynamics-365/troubleshooting">
    Live work item never appears, template window issues.
  </Card>
</CardGroup>
