POST

Customer.RunAutomation

Run one active automation for one or more customers. Same backend as the dashboard Customers page Run Automation button when customer ids are already known. For selected entry rows, prefer Entries.RunAutomation.

Permissions

  • User must be logged in with a valid bearer token.
  • The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Validates the automation belongs to the account and is active.
  • Runs that automation for each valid customer id in the account.

Push Service

Emits realtime automation.run after a successful bulk run.

Automation

Uses Api::run_automation_for_multi_customer_api (org api_token) when available; falls back to dashboard/admin2/run_automation_for_multi_customer.

Special Instructions

  • On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
  • Use Entries.AutomationsList or AutomationEvents.List (automation_status=1) for the automation picker.
  • Send automation_id plus customer_ids (comma-separated or array). selected_cust_id is accepted for dashboard compatibility.
  • Maximum 500 customers per request.

Required Parameters

NameTypeSampleExplanation
automation_id
post
int2827Active automation id.
customer_ids
post
string|array123,456Customer ids to run against. Aliases: customers, selected_cust_id, customer_id, ids.

Optional Parameters

No optional body parameters are defined for this function.

Authentication

Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Customer.RunAutomation",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "automation_id": "2827",
        "customer_ids": "123,456"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Customer.RunAutomation",
    "url_domain": "https:\/\/{domain}\/app\/Customer.RunAutomation"
}

Endpoint

POST /app/Customer.RunAutomation
POST https://{user}.bull36.com/app/Customer.RunAutomation
POST https://{domain}/app/Customer.RunAutomation

Sample Output

{
    "success": 1,
    "message": "Success",
    "automation_id": 2827,
    "customer_ids": [
        "123",
        "456"
    ],
    "count": 2
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({ automation_id: '2827', customer_ids: '123,456' });
const res = await fetch('/app/Customer.RunAutomation', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
console.log(await res.json());

Error Example

{
    "success": 0,
    "message": "Automation was not found."
}