# Trigger Workflows (/docs/guides/workflows)

## Prepare a Workflow [#prepare-a-workflow]

Create and configure your workflow in the Smobi dashboard, then obtain its definition ID from the workflow's integration information. Define the variables it expects and test the flow with a phone you control before using customer data.

The public API executes existing workflows. It does not expose workflow authoring endpoints.

## Execute for One Recipient [#execute-for-one-recipient]

```bash
curl --request POST \
  'https://api.smobi.com/v1/workflows/YOUR_WORKFLOW_DEFINITION_ID/execute/15552223333' \
  --header "x-api-key: $SMOBI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{ "variables": { "customerName": "Alex", "orderId": "12345" } }'
```

Use variable names that match your workflow, with string values. Send `{}` when it needs no variables. Save the execution response for tracking; an accepted execution does not mean every step has completed.

## Follow the Current Workflow Version [#follow-the-current-workflow-version]

Use `POST /v1/workflows/family/{workflowFamilyId}/execute/{phoneNumber}` when your integration should execute the family's current version. Use the definition endpoint when you want to target a specific definition. The family must have a current version configured.

## Execute a Batch [#execute-a-batch]

`POST /v1/workflows/{workflowDefinitionId}/execute` accepts an `executions` array:

```json
{
  "executions": [
    {
      "phoneNumber": "15552223333",
      "variables": { "customerName": "Alex" }
    },
    {
      "phoneNumber": "15554445555",
      "variables": { "customerName": "Sam" }
    }
  ]
}
```

Each batch must contain **1–25 executions**. Repeating the same phone-number string in one batch rejects the request. Batch routing is selected by the server; supplied `settings` values do not override it. Use the single-recipient endpoint with `settings.channelOverride` when you need a supported channel override. Split larger inputs into smaller batches. A `202` response indicates acceptance for processing. Do not assume a retry is deduplicated: avoid resubmitting a batch whose outcome is uncertain.

See the [workflow API reference](/docs/api/workflows/execute-single) for request schemas, settings, and error responses.

## Related Resources [#related-resources]

- [Receive Webhooks](/docs/guides/webhooks)
- [TypeScript SDK](/docs/guides/typescript-sdk)
