Automation

#Webhooks and triggers

Make AI Studio run one of your workflows or agents when something happens in your own system. You do this with a trigger:

  • Webhook triggers: your system sends an HTTP POST to a secret URL, and AI Studio runs the target.
  • Schedule triggers: AI Studio runs the target at set times. Covered at the end.
{BASE_URL} = https://studio.scaletechsolutions.ai/api/v1

#How it works

Your system AI Studio Workflow or agent POST /webhooks/trigger/42/{secret} 202 Accepted (queued) map input, start run in background result or error (max 600 s) Execution recordreceived, processing, completed, failed On failure: notification and email (one per trigger per UTC day)
The 202 only means the run was queued. Read the outcome from the trigger's executions.
  1. In AI Studio you create a webhook trigger for one workflow or one agent. AI Studio gives you a URL that contains a secret.
  2. Your system sends a JSON body to that URL.
  3. AI Studio answers 202 Accepted at once and runs the target in the background.
  4. You check the result in the trigger's run history in the app, or wait for a failure notification.

#1. Create a webhook trigger

You create, change, pause and delete triggers in the AI Studio app, on the Triggers screen. There is no public API for this.

  1. Choose the workflow or agent the trigger should run.
  2. Choose Webhook as the trigger type and give it a name, for example New order from shop.
  3. Optionally add a data_mapper to pick which parts of the body to pass on (see Shaping the input).
  4. Save. AI Studio shows your webhook URL, which contains the trigger's id and its secret.
{BASE_URL}/webhooks/trigger/42/Qm9vZ3Vz...x2s

#2. Call the webhook

POST{BASE_URL}/webhooks/trigger/{trigger_id}/{webhook_secret}

Starts one run of the trigger's target. No login and no API key: the secret in the path is the credential.

ParameterDescription
trigger_idThe id in your webhook URL (a number).
webhook_secretThe secret from your webhook URL.
HeaderRequiredDescription
Content-Type: application/jsonrecommendedThe body is read as JSON.
Idempotency-KeynoA unique value per event. If AI Studio has already received a call with the same key for this trigger, it does not start a second run.
X-GitHub-DeliverynoUsed as the idempotency key when Idempotency-Key is absent, so GitHub webhooks are de-duplicated without extra setup.

No other header reaches the workflow or agent. Only the body does. Send a JSON object; if the body is empty or not valid JSON, AI Studio treats it as {} and still starts a run.

curl -X POST "$BASE_URL/webhooks/trigger/42/$WEBHOOK_SECRET" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-10057-created" \
  -d '{"content": "Order #10057 was placed by jane@example.com. Send her a thank-you email.",
       "order": {"id": 10057, "total": 129.90}}'

Response 202 Accepted:

{"status": "accepted", "message": "Webhook received and task dispatched."}

The response does not contain the run's result or an execution id. See Check the result.

StatusdetailMeaning and what to do
404Webhook trigger not found or unauthorizedThe id or secret is wrong, the trigger is not a webhook trigger, or it was deleted.
400Trigger is disabledis_active is false. Turn it back on in the app.
422Validation errortrigger_id in the path is not a number.

#3. What the workflow or agent receives

#Shaping the input with data_mapper

Without a data_mapper, the whole body is passed on. With one in the trigger's config, only the keys you list are passed on. Each key is the name the target receives; each value is a dot path into the body.

{
  "data_mapper": {
    "customer_email": "order.customer.email",
    "order_id": "order.id"
  }
}

With the body {"order": {"id": 10057, "customer": {"email": "jane@example.com"}}}, the target receives:

{"customer_email": "jane@example.com", "order_id": 10057}

A path that does not exist gives null. Dot paths read object keys only, not list positions.

#Workflow targets

The (mapped) body becomes the workflow's inputs. Each top-level key is an input name. Every required input must be present as a key, or the run fails with Missing required inputs: <names>. Extra keys are passed on too.

#Agent targets

The (mapped) body becomes the agent's message:

BodyThe agent's message
Has a non-empty content stringThe value of content.
No contentThe text Webhook Trigger Payload: followed by the whole body as indented JSON.

With content, you can also send timezone (IANA, for example Europe/Berlin) and location (free text). Each webhook call runs in a new conversation on the agent, named Webhook Event #<execution id>, which you can open in the app.

A run can use at most 600 seconds of agent time. A run that hits that limit with no reply fails; one that already wrote part of a reply is recorded as completed with that partial reply. The agent's spending limits apply: if one is reached, the run is not started and is recorded as failed. The agent can use databases you granted it (see Databases) when you own both the trigger and the agent. Database write tools are never available to trigger runs.

#4. Check the result and manage triggers

A webhook call answers 202 as soon as the run is queued, so the result is not in the response. In the app you can:

  • Open a trigger's run history to see each run's status (received, processing, completed or failed), the body you sent, the agent's reply or workflow result, and the error if it failed. For a workflow target, you can open the full run with its step-by-step trace.
  • Pause a trigger. Calls to a paused trigger get 400 Trigger is disabled. Turn it back on to resume.
  • Edit a trigger's name or data_mapper.
  • Delete a trigger. Its run history is deleted too, and the webhook URL stops working at once.

The secret is never shown again after creation.

Some failures before the target starts (a missing workflow input, a target that no longer exists) are retried automatically up to 3 times, about a minute apart.

#Failure notifications

When a trigger run fails, the trigger's owner gets a notification in AI Studio and an email. Failures of one trigger on the same UTC day are folded into one notification with a count, so a trigger that keeps failing sends one email per day.

#5. Security

  • The secret is in the URL. Treat the whole URL like a password. Anyone who has it can start runs, and each run can cost money.
  • Keep the URL out of source code, client-side code, shared documents and logs. Many proxies and tools log full URLs.
  • Call it only from your server, over HTTPS.
  • There is no rotate action. To change the secret, create a new webhook trigger in the app for the same target, switch your system to the new URL, then delete the old trigger. If you think the URL has leaked, deactivate or delete the trigger first.
  • AI Studio does not check a signature on the body. If your sender signs its webhooks, verify the signature in your own relay before forwarding.

#6. Scheduled triggers

A schedule trigger runs its target at set times. You set it up in the app. It has no URL and no secret, so there is nothing to call. The app shows the next run times before you save.

You can choose:

  • Repeat: daily, weekly, monthly, once, or a cron expression.
  • Time: time of day, 24-hour.
  • Day: the day of the week (weekly) or day of the month (monthly). A day past the end of a short month runs on the month's last day.
  • Time zone: any IANA time zone. Default UTC.
  • Message: for agent targets, the message the agent receives. The current local time is added at each run.

For example, a cron expression of 0 9 * * 1-5 in Asia/Kolkata runs at 09:00 on weekdays.

  • Standard five-field cron. A sixth (seconds) field is refused.
  • The expression is read in the time zone you choose, so "9:00 on weekdays" stays 9:00 local time across daylight-saving changes.
  • Runs must be at least 5 minutes apart. */2 * * * * is refused.
  • A once schedule whose time has already passed today runs about a minute after you save it.
  • A workflow target gets no inputs from a schedule, so use it only for workflows without required inputs.

Schedule runs appear in the same run history and send the same failure notifications as webhook runs.

AI Studio developer documentation. Times are UTC and IDs are opaque strings.