Skip to main content

Pass custom data when triggering a scenario via API or AI Agent

Pass optional custom data when you trigger a scenario via the API or your AI agent, and use each value as a {{ trigger.key }} variable in your messages.

When you trigger a scenario through the Inrō REST API or your AI agent (Claude or ChatGPT via MCP), you can send optional custom data alongside the contact. Each key you include becomes a {{ trigger.key }} variable inside the scenario, so your messages and actions can adapt to each contact with no extra setup.

How it works

Add a data object to your trigger request. Every key in that object is available as {{ trigger.key }} in the scenario's messages and actions.

Trigger via the API

Send a POST to the trigger endpoint with your contact and the custom data:

POST /api/v1/scenarios/:id/triggerAuthorization: Bearer YOUR_API_TOKENContent-Type: application/json{  "contacts": [{ "id": 123 }],  "data": {    "order_id": "ORD-456",    "plan": "pro",    "discount": "15%"  }}

Each entry in contacts is one of id, username, or email. The data object is optional, so existing calls without it keep working unchanged.

Trigger via your AI agent (MCP)

If you've connected Claude or ChatGPT to Inrō, include the data in your prompt:

Trigger the "Order Confirmation" scenario for contact [email protected] data: order_id=ORD-456, plan=pro, discount=15%

Your agent calls the trigger_scenario tool and passes the data through for you.

Use the data in your scenario

Reference any key from your data object with {{ trigger.key }}:

Hi {{ contact.username }}! Your order {{ trigger.order_id }} is confirmed.You're on the {{ trigger.plan }} plan with {{ trigger.discount }} off.

For the full list of variable types you can use in messages, see Variables & Personalisation Guide.

When this is useful

  • E-commerce: pass order details (ID, product, amount) when you trigger a post-purchase follow-up.

  • CRM sync: include a contact's current tier or status so the message adapts on its own.

  • AI agent workflows: have Claude or ChatGPT pass context (meeting date, form response, deal stage) when it triggers a scenario.

What's next?

Did this answer your question?