# create_automation (/docs/mcp/tools/create-automation)

{/* Generated by scripts/sync-mcp-tools.mjs from happierleads-api. Do not edit: change src/routes/mcp/toolDocs.json there, or add content/mcp-notes/create_automation.mdx. */}

**Create automation** · Changes data · Acts outside your account

Creates an automation that is active straight away and runs whenever a lead matches it. By default it triggers when a new lead is identified, on the first visit only, immediately. The action is set by trigger.then, and its settings go in trigger.actions. For example, Slack uses \{ sentToSlack: \{ sendMessagesTo \} \} and a webhook uses \{ sentToWebhook: \{ url \} \}. To send leads to an email campaign, pass actions: [\{ emailCampaign: "\<campaignId from list_campaigns\>" \}]. Without trigger.then, the action is send-to-slack, or send-to-emailCampaign when actions has a campaign. It acts outside the account for every future matching lead (messages, CRM records, campaign emails). Confirm with the user before calling. Returns the created automation with its _id. Errors (405) include a missing campaign or an invalid campaign ID.

| Connection | Account URL, team member URL or OAuth |
| --- | --- |

## Parameters [#parameters]

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `websiteId` | `string` | Yes | Website ID from list_websites. |
| `name` | `string` | Yes | Name shown in the automation list. |
| `trigger` | `object` | Yes | Object with the rule and action settings. Keys: when (default 'new-lead-is-identified'); then (the action: send-to-slack, send-to-hubspot, send-to-pipedrive, send-to-salesforce, send-to-zoho, send-to-gohighlevel, trigger-webhook, send-to-zapier, send-to-clay, send-to-emailCampaign, send-to-linkedinCampaign, send-email-alert, send-csv-on-email, …); trigger ('only-on-first-visit' default, 'on-every-visit', 'none'); interval ('immediately' default, 'after-session', 'daily', 'weekly', 'monthly'); repeatWindowHours (12, 24, 72, 168, 720, 2160 or 4320; null = off); dedupeScope ('contact' default, or 'company'); contactSelectionStrategy ('flexible-job-titles' default, 'exact-job-titles', 'flexible-find-at-least-one-job-titles'); maxContactsToSend (default 1); emailVerification; filter (a saved filter id from list_filters); actions (the action settings object, e.g. \{ sentToSlack: \{...\} \}). |
| `actions` | `any[]` | Yes | Shortcut for email campaigns only: a list whose item has emailCampaign set to a campaign id from list_campaigns, e.g. [\{ "emailCampaign": "64f..." \}]. Other items are ignored; put other action settings in trigger.actions. |

## Tool definition [#tool-definition]

What your assistant receives from `tools/list`:

```json
{
  "name": "create_automation",
  "title": "Create automation",
  "annotations": {
    "title": "Create automation",
    "readOnlyHint": false,
    "destructiveHint": false,
    "idempotentHint": false,
    "openWorldHint": true
  },
  "inputSchema": {
    "type": "object",
    "properties": {
      "websiteId": {
        "type": "string",
        "description": "Website ID from list_websites."
      },
      "name": {
        "type": "string",
        "description": "Name shown in the automation list."
      },
      "trigger": {
        "type": "object",
        "description": "Object with the rule and action settings. Keys: when (default 'new-lead-is-identified'); then (the action: send-to-slack, send-to-hubspot, send-to-pipedrive, send-to-salesforce, send-to-zoho, send-to-gohighlevel, trigger-webhook, send-to-zapier, send-to-clay, send-to-emailCampaign, send-to-linkedinCampaign, send-email-alert, send-csv-on-email, …); trigger ('only-on-first-visit' default, 'on-every-visit', 'none'); interval ('immediately' default, 'after-session', 'daily', 'weekly', 'monthly'); repeatWindowHours (12, 24, 72, 168, 720, 2160 or 4320; null = off); dedupeScope ('contact' default, or 'company'); contactSelectionStrategy ('flexible-job-titles' default, 'exact-job-titles', 'flexible-find-at-least-one-job-titles'); maxContactsToSend (default 1); emailVerification; filter (a saved filter id from list_filters); actions (the action settings object, e.g. { sentToSlack: {...} })."
      },
      "actions": {
        "type": "array",
        "description": "Shortcut for email campaigns only: a list whose item has emailCampaign set to a campaign id from list_campaigns, e.g. [{ \"emailCampaign\": \"64f...\" }]. Other items are ignored; put other action settings in trigger.actions."
      }
    },
    "required": [
      "websiteId",
      "name",
      "trigger",
      "actions"
    ]
  }
}
```
