> ## 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.

# Case Sync

> Understand how Creatio cases are created, what data syncs in each direction, and how to set up two-way communication via business process webhooks.

Once [connected](/integrations/creatio/connect), OpenCX creates and updates Creatio cases as conversations progress. This page covers what happens automatically and what requires a Creatio business process on your side.

## How case creation works

```mermaid theme={"dark"}
flowchart LR
  A[Contact message] --> B{AI can resolve?}
  B -- Yes --> C[AI replies on channel]
  B -- No --> D[Handoff]
  D --> E[Create or update Creatio case]
  E --> F[Rep replies in Creatio]
  F --> G[Reply syncs back to contact]
```

When <Tooltip tip="The point where the AI decides a conversation needs a human agent and transfers it with full context." cta="Handoff settings" href="/handoff/introduction">handoff</Tooltip> triggers, OpenCX:

1. Creates a case in your Creatio instance with the session ID, conversation summary, and customer details.
2. Logs the full transcript as case activities — one activity per message.
3. Auto-fills any fields you've [mapped](/integrations/creatio/ai-fields).
4. Assigns to the **Default Case Owner** or **Default Case Group** if configured.

If a case already exists for this conversation, the handoff note is added as a new activity instead of creating a duplicate.

## Case creation modes

| Mode                                | Behavior                                                                                                                       |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **On every conversation** (default) | A case is created when the first customer message arrives. Every message and AI reply is logged as an activity in real time.   |
| **On handoff only**                 | A case is created only when the AI escalates. Best for teams that want Creatio involved only for issues the AI cannot resolve. |

Switch between modes in [Settings → Integrations](https://platform.open.cx/settings/integrations) → Creatio → **Create case only on handoff**.

## What syncs in each direction

| OpenCX to Creatio                    | Creatio to OpenCX           |
| ------------------------------------ | --------------------------- |
| Customer messages (as activities)    | Agent replies (via webhook) |
| AI replies (as activities)           | Case closure (via webhook)  |
| Handoff summary, language, sentiment |                             |
| AI-filled fields                     |                             |
| Resolution status                    |                             |

<Note>
  Creatio-to-OpenCX sync requires business processes you configure in Creatio. Without them, the integration is one-directional — OpenCX writes to Creatio, but agent replies and case closures do not flow back.
</Note>

## Setting up two-way sync

Two-way sync lets your agents reply from Creatio and have those replies reach the customer, and lets case closures in Creatio resolve the OpenCX conversation. Both require a Creatio <Tooltip tip="An automated workflow in Creatio that runs when a specific event occurs. Used here to POST to the OpenCX webhook URL when an agent replies or a case is resolved.">business process</Tooltip> that sends an HTTP request to OpenCX.

### Get your webhook URL

<Steps>
  <Step title="Open integration settings">
    In your [OpenCX dashboard](https://platform.open.cx/settings/integrations), go to **Settings → Integrations** → **Creatio**.
  </Step>

  <Step title="Copy the webhook URL">
    Your unique webhook URL is displayed on the integration page. Copy it — you will paste it into the Creatio business processes below.

    <Warning>
      This URL contains a secret token. Do not share it publicly.
    </Warning>
  </Step>
</Steps>

### Create a business process for agent replies

This process fires when an agent adds a reply to a case, delivering the message to the customer through their original channel.

<Steps>
  <Step title="Open the Process Designer">
    In Creatio, go to **System Designer → Process Library → Add Process**.
  </Step>

  <Step title="Set the trigger">
    Add a **Signal** start event:

    * **Object**: `Activity`
    * **Event**: `After record added`
    * **Filter**: Match how your agents add replies (e.g. `Type = Task` or `Type = Email`)

    <Tip>
      Filter by the activity's parent case to avoid triggering on unrelated activities.
    </Tip>
  </Step>

  <Step title="Add a web service call">
    Drag in a **Call web service** element and configure:

    * **URL**: Paste your OpenCX webhook URL
    * **Method**: `POST`
    * **Content Type**: `application/json`
    * **Request body**:

    ```json theme={"dark"}
    {
      "event_type": "new_activity",
      "caseId": "[#Case.Id#]"
    }
    ```

    Replace `[#Case.Id#]` with the process parameter referencing the related Case ID. The exact syntax depends on how you linked the Activity to its Case in the process.
  </Step>

  <Step title="Save and activate">
    Save the process and set it to **Active**. Test by adding a reply to a case created by OpenCX — the message should appear in the customer's chat within seconds.
  </Step>
</Steps>

### Create a business process for case closure

This process fires when a case is resolved in Creatio, closing the matching OpenCX conversation.

<Steps>
  <Step title="Create a new process">
    Add another process in the Process Library.
  </Step>

  <Step title="Set the trigger">
    Add a **Signal** start event:

    * **Object**: `Case`
    * **Event**: `After record modified`
    * **Filter**: `Status = Resolved` (match your resolved status name exactly)
  </Step>

  <Step title="Add a web service call">
    Configure:

    * **URL**: Your OpenCX webhook URL
    * **Method**: `POST`
    * **Content Type**: `application/json`
    * **Request body**:

    ```json theme={"dark"}
    {
      "event_type": "case_closed",
      "caseId": "[#Case.Id#]"
    }
    ```
  </Step>

  <Step title="Save and activate">
    Save and activate. Test by resolving a case in Creatio — the corresponding OpenCX conversation should close automatically.
  </Step>
</Steps>

### Webhook event reference

| Event type     | When to send                               | What happens in OpenCX                                           |
| -------------- | ------------------------------------------ | ---------------------------------------------------------------- |
| `new_activity` | Agent adds a reply to a case               | The reply is delivered to the customer on their original channel |
| `case_closed`  | Case status changes to resolved/closed     | The OpenCX conversation is marked as resolved                    |
| `case_updated` | Case is modified (reserved for future use) | Acknowledged but no action taken                                 |

All webhook requests must be `POST` with a JSON body containing `event_type` (string) and `caseId` (string — the Creatio Case GUID).

### Verify webhooks

<Steps>
  <Step title="Test agent reply sync">
    Have an agent add a reply to a case that was created by OpenCX. Confirm the message appears in the customer's chat.
  </Step>

  <Step title="Test case closure sync">
    Resolve a case in Creatio. Confirm the corresponding conversation in OpenCX is marked as resolved.
  </Step>
</Steps>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Connect Creatio" icon="plug" href="/integrations/creatio/connect">
    Credentials, optional routing settings, and verification.
  </Card>

  <Card title="AI Fields" icon="wand-magic-sparkles" href="/integrations/creatio/ai-fields">
    Auto-fill case fields from conversation context.
  </Card>

  <Card title="Creatio overview" icon="grid-2" href="/integrations/creatio/overview">
    Capabilities, supported channels, and observability.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/integrations/creatio/troubleshooting">
    Webhook errors, replies not syncing, case closure issues.
  </Card>
</CardGroup>
