How to trigger workflow agents with Content Marketing Platform webhooks

  • Updated

Webhooks let Optimizely Content Marketing Platform (CMP) notify Optimizely Opal automatically when something changes in CMP, such as task, campaign, asset, or work request. For example, CMP can send a webhook when a task starts, when a task moves to a new workflow step, or when a work request is created.

This guide walks through connecting a CMP webhook to an Opal workflow agent. The example uses the external_sub_step_started event, but you can apply the same pattern to any CMP webhook event.

The following steps describe the end-to-end flow:

  1. A user advances a CMP task to an external workflow step.
  2. CMP sends a webhook to Opal with the task context.
  3. The Opal workflow agent receives the webhook and routes it to the correct specialized agent.
  4. That agent performs the work. For example, updating the task brief.
  5. Another agent completes the CMP workflow step, advancing the task automatically.

The following diagram shows the end-to-end flow from a CMP task advancing to an external step through Opal completing the automation.

Diagram of the end-to-end flow from a CMP task advancing to an external step through Opal routing, brief updating, and step completion"

Use this pattern as the foundation for AI-powered content automation with Opal. Apply it to content generation, compliance checks, and approval workflows.

Prerequisites

Ensure you have the following before starting:

Architecture

How external steps work

CMP workflows move tasks through internal steps handled by team members. External steps defer processing to systems outside CMP, in this case, an Opal workflow agent.

When a task reaches an external step, the following occurs:

  1. CMP fires a webhook with the event external_sub_step_started.
  2. The webhook payload includes the task_id, step_id, sub_step_id, and the external system name.
  3. The Opal workflow agent receives this payload and uses the external system name to route to the correct processing logic.
  4. When processing is complete, Opal calls back to CMP to mark the step as done.

Key components

Component Platform Purpose
Webhook CMP Sends notification when external step starts.
External system CMP Labels and identifies the type of external work.
Workflow agent Opal Orchestrates the multi-step automation.
External step router agent Opal Routes webhook to correct processing branch.
Specialized agents Opal Perform the actual work and complete the step.

Create the Opal webhook trigger

Before configuring CMP, create the Opal workflow agent and webhook trigger to generate the webhook URL you need for the CMP configuration.

Create a workflow agent

Follow these steps in Opal:

  1. Go to Agents > Your Agents.
  2. Click Add Agent > Workflow Agent.

    Screenshot of the Opal Agents page showing the Add Agent menu expanded with Workflow Agent highlighted
  3. Enter CMP External Step Handler for the Name.
  4. Enter cmp_external_handler for the Id.
  5. Enter Handles CMP external workflow steps by routing to appropriate agents and completing steps. for the Description.
  6. Click Apply.

    Screenshot of the Opal workflow agent configuration panel with Name, Id, and Description fields completed
  7. Click Save.

Add the webhook trigger

Follow these steps in Opal:

  1. Drag and drop a Webhook trigger into the editor.

    Screenshot of the Opal workflow editor showing a Webhook trigger block added to the canvas
  2. Enter CMP External Step Webhook for the Name.
  3. Enter Receives webhooks when CMP external step starts. for the Description.
  4. Select the CMP product instance you connected in the prerequisites from the Product Instance drop-down list.
  5. Keep application/json selected for the Payload Content Type drop-down list.
  6. Enter a secure secret for the Auth Key. Enter this same value as the Secret when creating the CMP webhook in the next section.
  7. Select Custom for the Auth Header Name drop-down list.
  8. Enter Callback-Secret in the Enter custom header name field.
  9. Enter {token} for the Auth Header Format.
  10. Click Save.

    Screenshot of the Opal Webhook trigger configuration panel with all fields completed, including Auth Key, Auth Header Name set to Custom, and Auth Header Format set to {token}

Click Copy to clipboard for the generated Webhook URL.

Screenshot of the Opal webhook URL field with the Copy to clipboard button

The URL displays in the following format: https://webhook.opal.optimizely.com/webhooks/UUID/UUID

Click Save on the Opal workflow agent. Keep this browser tab open. Return to it after completing the CMP configuration.

Screenshot of the Opal workflow agent editor with the Save button highlighted in the top toolbar

CMP configuration

Create the webhook

Register a webhook in CMP that notifies the Opal workflow agent when external steps start. CMP supports many webhook events. This guide uses external_sub_step_started as an example. Find all available events on the webhook registration page.

  1. Go to Settings (your profile picture) > Apps & Webhooks.
  2. Go to the Webhooks tab.
  3. Click Register New > General Webhook.

    Screenshot of the CMP Webhooks tab showing the Register New button with the General Webhook option highlighted
  4. Enter Opal External Step Automation for the Name
  5. Enter Triggers Opal workflow agent when external steps start. for the Description
  6. Paste the webhook URL you copied from Opal into the Callback URL field. 
  7. Enter the same secret you entered as the Auth Key in Opal for the Secret. This value must match exactly. 

    Screenshot of the CMP General Webhook configuration form showing the Callback URL and Secret fields completed
  8. Select the external_sub_step_started checkbox. Select additional events on this page as needed.

    Screenshot of the CMP webhook event list with the external_sub_step_started checkbox selected
  9. Click Create Webhook.
The Auth Key in Opal must exactly match the Secret you entered when creating the webhook in CMP. If the values do not match, the webhook is rejected.

Create a CMP workflow with an external step

Create a CMP workflow template that includes an external step.

Create the CMP workflow

  1. Open a new browser tab and go to CMP.
  2. Go to Settings > Workflows

    Screenshot of the CMP Settings menu with Workflows highlighted
  3. Click Add Workflow (or edit an existing one). 
  4. Enter AI-Assisted Content Workflow for the Workflow Title.

    Screenshot of the CMP Add Workflow form with AI-Assisted Content Workflow entered in the Workflow Title field
  5. Go to the Steps tab.
  6. Click Add Step to create your workflow structure.

Add a step and convert to external

  1. Enter AI Brief Enhancement for the Title for your step.
  2. Expand the step to see configuration options.
  3. Click More (...) > Convert to External Step.

    Screenshot of the CMP workflow step configuration showing the More menu expanded with Convert to External Step highlighted

Configure the external system

The external system name is what the Opal workflow agent uses to route the webhook to the correct processing logic. This value must match the value referenced in the External Step Router agent prompt.

  1. Click Manage external systems.

    Screenshot of the CMP workflow step editor showing the Manage external systems link
  2. Click Add External System.

    Screenshot of the CMP Add External System dialog with a text field for the external system name
  3. Enter AI_Brief_Enhancement for the External System.
  4. Click Save.
  5. Select AI_Brief_Enhancement from the Select external system drop-down list.
  6. Click Save to save the entire CMP workflow.

Webhook payload reference

When the external step starts, CMP sends a webhook payload like the following:

{
   "data": {
      "task_id": "abc123-task-guid",
      "step_id": "step-guid",
      "sub_step_id": "sub-step-guid",
      "status": "started",
      "external_system": "AI_Brief_Enhancement"
   },
   "event": "external_sub_step_started",
   "timestamp": "2026-01-31T10:30:00Z"
}

The external_system value is what the External Step Router agent in Opal uses to determine which processing branch to run.

Build the Opal workflow agent

Return to Opal to create the specialized agents and assemble the full workflow.

Create the External Step Router agent

The External Step Router specialized agent extracts the external system name from the webhook payload and outputs a routing value. The routing value is a string you define. It is what you reference in the following Condition node to decide which agent runs next.

For example, if the external system is AI_Brief_Enhancement, you can output BRIEF_UPDATE and then add a condition that checks for BRIEF_UPDATE to route to the Task Brief Updater agent.

To create the External Step Router specialized agent using JSON import, see Import a specialized agent from JSON and paste the following JSON:

{
  "schema_version": "1.0",
  "agent_type": "specialized",
  "name": "External Step Router",
  "output": {
    "type": "text",
    "schema": null,
    "description": null
  },
  "version": "1.0.0",
  "agent_id": "external_step_router",
  "file_urls": [],
  "is_active": true,
  "creativity": 0.1,
  "is_deleted": false,
  "parameters": [
    {
      "name": "external_system",
      "type": "string",
      "default": null,
      "required": true,
      "description": "The external system name from the CMP webhook payload "
    }
  ],
  "description": "Routes external step web hooks to the correct processing agent based on external system name.",
  "prompt_pills": null,
  "enabled_tools": null,
  "agent_metadata": null,
  "inference_type": "rudimentary",
  "initial_message": null,
  "prompt_template": "You are a router agent. Your only job is to output a routing value based on the external system name provided.\nThe external system is: [[external_system]]\nOutput ONLY the routing value according to this logic:\n\\- If external_system equals \"AI_Brief_Enhancement\" → output \"BRIEF_UPDATE\"\n\\- If external_system does not match any known value → output \"UNKNOWN\"\nProvide only the routing value with no additional text or explanation.",
  "internal_version": 1,
  "conversation_mode": false,
  "first_prompt_mode": "open",
  "is_enabled_in_chat": true,
  "memory_token_limit": 8000,
  "evaluation_criteria": null,
  "system_prompt_template": ""
}

Alternatively, follow these steps in Opal to create it manually:

  1. Go to Agents > Your Agents.
  2. Click Add Agent > Specialized Agent.
  3. Enter External Step Router for the Name.
  4. Enter external_step_router for the Id.
  5. Enter Routes external step webhooks to the correct processing agent based on external system name. for the Description.
  6. Enter the following for the Prompt Template. Update the routing logic to match the external system names you configured in CMP and the output values you want to use in your Condition nodes. The external system name must exactly match the value you entered in the CMP external system setup.

    You are a router agent. Your only job is to output a routing value based on the external system name provided.
    The external system is: [[external_system]]
    Output ONLY the routing value according to this logic:
    - If external_system equals "AI_Brief_Enhancement" → output "BRIEF_UPDATE"
    - If external_system does not match any known value → output "UNKNOWN"
    Provide only the routing value with no additional text or explanation.
  7. Click Add variable.
    1. Select String for the Type.
    2. Enter external_system for the Name.
    3. Enter The external system name from the CMP webhook payload. for the Description.
    4. Select the Required? checkbox.
    5. Click Save Variable.
  8. Select Quick for the Inference Level.
  9. Click Save.

Create the Task Brief Updater agent

The Task Brief Updater specialized agent updates the task brief with AI-generated content. To create the Task Brief Updater agent using JSON import, paste the following:

{
  "schema_version": "1.0",
  "agent_type": "specialized",
  "name": "Task Brief Updater",
  "output": {
    "type": "text",
    "schema": null,
    "description": null
  },
  "version": "1.0.0",
  "agent_id": "task_brief_updater",
  "file_urls": [],
  "is_active": true,
  "creativity": 0.5,
  "is_deleted": false,
  "parameters": [
    {
      "name": "task_id_or_url",
      "type": "string",
      "default": null,
      "required": false,
      "description": "The task ID from the task."
    }
  ],
  "description": "Updates a CMP task brief with AI-generated content.",
  "prompt_pills": null,
  "enabled_tools": [
    "get_cmp_resource",
    "update_task_brief"
  ],
  "agent_metadata": null,
  "inference_type": "simple_with_thinking",
  "initial_message": null,
  "prompt_template": "\\## Role\n\nYou are a Task Brief Enhancement agent. Your job is to read an existing task brief and enhance it with additional context.\n\n\\## Process\n\n1\\. Use `get_cmp_resource` with resource_type \"task\" and the provided [[task_id_or_url]] to retrieve the current task details and brief.\n\n2\\. Review the existing brief content.\n\n3\\. Use `update_task_brief` to append a confirmation message to the brief:\n\n   Add the following at the end of the existing brief content:\n\n   ---\n\n   \n\n   \\## AI Processing Complete\n\n   \n\n   ✅ This task was processed by the External Step Workflow automation.\n\n   \n\n   **Processed at:** [current timestamp]\n\n   **Status:** Enhancement complete\n\n   \n\n   ---\n\n4\\. Preserve ALL existing brief content—only append the new section.\n\n\\## Output\n\nConfirm that the brief was updated successfully and provide the task URL.",
  "internal_version": 1,
  "conversation_mode": false,
  "first_prompt_mode": "open",
  "is_enabled_in_chat": true,
  "memory_token_limit": 8000,
  "evaluation_criteria": null,
  "system_prompt_template": ""
}

Alternatively, follow these steps in Opal to create it manually:

  1. Go to Agents > Your Agents in Opal.
  2. Click Add Agent > Specialized Agent.
  3. Enter Task Brief Updater for the Name.
  4. Enter task_brief_updater for the Id.
  5. Enter Updates a CMP task brief with AI-generated content. for the Description.
  6. Enter the following in the Prompt Template:

    ## Role
    You are a Task Brief Enhancement agent. Your job is to read an existing task brief and enhance it with additional context.
    ## Process
    1. Use `get_cmp_resource` with resource_type "task" and the provided [[task_id_or_url]] to retrieve the current task details and brief.
    2. Review the existing brief content.
    3. Use `update_task_brief` to append a confirmation message to the brief:
       Add the following at the end of the existing brief content:
       ---
       ## AI Processing Complete
       ✅ This task was processed by the External Step Workflow automation.
       **Processed at:** [current timestamp]
       **Status:** Enhancement complete
       ---
    4. Preserve ALL existing brief content — only append the new section.
    ## Output
    Confirm that the brief was updated and provide the task URL.
  7. Click Add Variable.
    1. Select String for the Type.
    2. Enter task_id_or_url for the Name.
    3. Enter The task ID from the task. for the Description.
    4. Select the Required? checkbox.
    5. Click Save Variable.
  8. Click Add tool.
    1. Search for and select the following tools:
      • get_cmp_resource
      • update_task_brief
    2. Click Add selected.
  9. Select Balanced for the Inference Level.
  10. Click Save.

Create the Workflow Step Completer agent

The Workflow Step Completer specialized agent marks the CMP workflow step as complete. To create the Workflow Step Completer agent using JSON import, paste the following:

{
  "schema_version": "1.0",
  "agent_type": "specialized",
  "name": "Workflow Step Completer",
  "output": {
    "type": "text",
    "schema": null,
    "description": null
  },
  "version": "1.0.0",
  "agent_id": "workflow_step_completer",
  "file_urls": [],
  "is_active": true,
  "creativity": 0.1,
  "is_deleted": false,
  "parameters": [
    {
      "name": "task_id_or_url",
      "type": "string",
      "default": null,
      "required": false,
      "description": "The task ID containing the step to complete."
    }
  ],
  "description": "Completes an external workflow step in CMP",
  "enabled_tools": [
    "update_task_substep"
  ],
  "agent_metadata": null,
  "inference_type": "rudimentary",
  "prompt_template": "You are a Workflow Step Completer agent. Your job is to mark the current workflow step as complete in CMP.\n\n\\## Process\n\n1\\. Use `update_task_substep` with the provided [[task_id_or_url]] the **step_name** is \"AI Brief Enhancement\".\n\n2\\. Set the action to \"complete\".\n\n3\\. This will advance the task to the next workflow step.\n\n\\## Output\n\nConfirm that the step was completed successfully.",
  "internal_version": 1,
  "is_enabled_in_chat": true
}

Alternatively, follow these steps in Opal to create it manually:

  1. Go to Agents > Your Agents.
  2. Click Add Agent > Specialized Agent.
  3. Enter Workflow Step Completer for the Name.
  4. Enter workflow_step_completer for the Id.
  5. Enter Completes an external workflow step in CMP. for the Description.
  6. Enter the following for the Prompt Template:

    ## Role
    You are a Workflow Step Completer agent. Your job is to mark the current workflow step as complete in CMP.
    ## Process
    1. Use `update_task_substep` with the provided [[task_id_or_url]].
    2. Set the action to "complete".
    3. This advances the task to the next CMP workflow step.
    ## Output
    Confirm that the step was completed.
  7. Click Add Variable.
    1. Select String for the Type.
    2. Enter task_id_or_url for the Name.
    3. Enter The task ID containing the step to complete. for the Description.
    4. Select the Required? checkbox.
    5. Click Save Variable.
  8. Click Add tool.
    1. Search for and select the update_task_substep tool.
    2. Click Add selected.
  9. Select Standard for the Inference Level.
  10. Click Save.

Assemble the workflow agent

Connect all the specialized agents in your Opal workflow agent.

Access your workflow agent

Follow these steps in Opal:

  1. Go to Agents > Your Agents.
  2. Click the CMP External Step Handler agent you created in the Create a workflow agent section.

Add your first agent

  1. Drag and drop the External Step Router agent into the editor below the CMP External Step Handler webhook.
  2. Connect the CMP External Step Handler webhook and External Step Router agent. To do so, click the CMP External Step Handler's connector circle.

    Screenshot of the Opal workflow editor showing the CMP External Step Handler webhook with its connector circle highlighted for dragging

    Drag the connector to the External Step Router agent.

    Screenshot of the Opal workflow editor showing the connector being dragged from the CMP External Step Handler webhook to the External Step Router agent

Add a condition

The Condition node reads the output value from the External Step Router agent and directs the workflow to the correct next agent. The value you enter in Matching Condition must match the routing value output by the router, for this example, BRIEF_UPDATE.

  1. Drag and drop a Condition into the editor adjacent to the External Step Router agent.
  2. Click the Condition to edit it.
  3. Click Add Condition.
  4. Select Equals for the Match Type.
  5. Enter BRIEF_UPDATE for the Matching Condition.

    Screenshot of the Opal Condition editor showing Match Type set to Equals and Matching Condition set to BRIEF_UPDATE
  6. Connect the External Step Router agent to the Condition. To do so, click the External Step Router's connector circle and drag the connector to the Condition.

Add the remaining agents

  1. Drag and drop the Task Brief Updater agent into the editor in the Drag and drop step area.
  2. Drag and drop the Workflow Step Completer agent into the editor below the Task Brief Updater agent.
  3. Connect the Task Brief Updater agent and Workflow Step Completer agent. To do so, click the Task Brief Updater's connector circle and drag the connector to the Workflow Step Completer agent.
  4. Click Save.

    Screenshot of the completed Opal workflow agent canvas showing the full agent chain: CMP External Step Handler webhook connected to External Step Router, then to a Condition, then to Task Brief Updater, and finally to Workflow Step Completer

Test your workflow

Run the test

Follow these steps in CMP:

  1. Click Create New > Task.
  2. Enter AI-Assisted Content Workflow for the Title.
  3. Select AI-Assisted Content Workflow you created in the Create a CMP workflow with an external step section for the Workflow.

    Screenshot of the CMP new task creation dialog showing the Workflow field with AI-Assisted Content Workflow selected
  4. Enter a Due Date.
  5. (Optional) Enter additional information to the task.
  6. Click Create.

Advance the task to the AI Brief Enhancement external step. To do so, click on the step and select In progress or advance through the previous steps.

Verify the results

Follow these steps in Opal to review the workflow logs:

  1. Go to Agents > Workflow Logs.
  2. Click the latest execution of the CMP External Step Handler Opal workflow agent.
  3. Select each individual workflow agent and verify everything ran correctly.
  4. Verify the Workflow Execution is Completed.

    Screenshot of Opal Workflow Logs showing the CMP External Step Handler execution with Completed status displayed

Follow these steps in CMP to review the task brief updates:

  1. Go to Plan.
  2. Click your AI-Assisted Content Workflow task.
  3. Verify the task brief was updated by the Opal workflow agent and the AI Brief Enhancement step is marked complete.

    Screenshot of CMP task view showing the AI Brief Enhancement workflow step marked complete and the task brief updated with the AI processing confirmation section

The following are points to check and their expected results:

  • Webhook received – Execution displays in Opal history.
  • Router output – Displays the routing value you defined in the router prompt.
  • Brief updated – Task brief contains the appended AI processing message.
  • Step completed – CMP shows the external step as complete.
  • Task advanced – Task is on the next CMP workflow step or the CMP workflow is complete.

Troubleshoot

Webhook does not trigger

Check the following if the webhook does not trigger:

  • Callback URL incorrect – Verify you copied the URL exactly from Opal.
  • Event not selected – Confirm you selected external_sub_step_started.
  • Workflow agent not active – Toggle the Opal workflow agent to active.

Router does not match

Check the following if the router does not return the expected value:

  • External system name typo – Verify the exact spelling in CMP matches the router logic.
  • Case sensitivity – External system names are case-sensitive.
  • Missing condition – Add a condition for your external system in the router prompt.

Step does not complete

Check the following if the CMP workflow step does not advance:

  • Tool not enabled – Ensure you added the update_task_substep tool to the specialized agent.
  • Task ID not passed – Verify the task_id_or_url variable is flowing through the Opal workflow agent.
  • Permission error – Check that Opal is connected to the correct CMP instance. See Product connections.

Next steps

When you have the basic workflow running, expand your Opal workflow agent by implementing the following:

  • Add more external systems – Expand your router to handle different CMP workflow step types.
  • Build specialized agents – Create agents for content generation, compliance checks, and translations.
  • Update the Condition for additional options – Add conditions for other external_system values, such as COMPLIANCE_CHECK and UNKNOWN.
  • Implement error handling – Add conditional branches for failure scenarios.
  • Configure notifications – Use the send_email tool to notify users of completion.