Starting a scenario by a webhook: website and Tilda requests
How to send requests from a website form or Tilda to an AISAR scenario address: setup, the secret, address protection and how to write to a client in WhatsApp Business outside the 24-hour window.
What it gives you
A form on your website, a Tilda landing page or another service can start an AISAR scenario. The request arrives at a dedicated address, AISAR finds the client by phone or email (or creates a new one) and starts the scenario: for example sends a greeting, opens a deal or creates a task.
What you need
- A plan with automations and the right to edit scenarios: only such employees see the address and the secret.
- A saved and enabled scenario with the Webhook / API trigger.
- A connected channel the scenario will write to the client through (if the scenario has a send step).
Setup, step by step
- Save the scenario. Until it is saved, the trigger settings show the hint "Save the scenario first".
- In the Webhook / API trigger settings click "Get an address for requests". An address and a secret appear.
- Copy the address. It looks like
https://api.aisar.app/webhooks/automation/awh_.... - In Tilda open Site settings, Forms, Webhook, paste the address into the URL field and pass the secret in the
X-Webhook-Secretheader. - Submit a test request from the form and click "Check" in AISAR: the latest request and its result appear below.
.../awh_.../<secret>). Such an address is visible to every site visitor in the form HTML, so turn off contact creation, and if it leaks click "Replace secret". The old secret stops working at once, update it in the form. The secret is accepted only in the header or in the address path, not in query parameters and not in the body.Where the phone, email and name are in the request
Common field names (Phone, Email, Name, as well as tel, mail, телефон, почта, имя) are detected automatically. If your form uses other names, under "Where the client data is in the request" pick a field from the last request or type its name.
The whole request is available in the scenario as variables: {{trigger.body.Name}}, and for nested data {{trigger.body.order.items.0.title}}. A field name may contain spaces and Cyrillic letters: {{trigger.body.Имя клиента}}.
Address settings
- Accept requests. A switch: while it is off the address answers with an error and the scenario does not start.
- Create a contact for new clients. If no client with that phone or email exists, one is created.
- Enrich the data of a found contact. Off by default: a public form cannot change an existing card. Turn it on only if you trust the source. The name and values already filled in are never overwritten.
- Reply channel. The scenario writes to the client through it. If none is chosen, the first suitable one is used.
A client who already went through the scenario does not start it again unless re-entry is allowed in the scenario settings.
Address protection
The secret sits in a public form, so AISAR treats it as potentially leaked and limits what can be done through the address.
- The request body is up to 64 KB. A repeat of the same request within 10 minutes is ignored (the answer is
duplicate). To tell repeats apart explicitly, send anIdempotency-Keyheader. - Outgoing messages of your plan are counted too: when the plan limit is exhausted the scenario cannot open a new dialog.
WhatsApp Business outside the 24-hour window
WhatsApp Business lets you write to a client first only with a Meta-approved template. So plain text to a request on a WhatsApp Business channel is not sent if the client has not written to you within the last 24 hours: the step is skipped with the reason whatsapp_window_closed, and the other scenario steps run.
To write first, add the "Send WhatsApp template" step (send-whatsapp-template) to the scenario: choose a WhatsApp Business channel and an approved template, and fill in its variables (placeholders from the request work, for example {{trigger.body.Name}}). Such a step can open the dialog with the client first, including outside the 24-hour window. Step details: Variables, constants and buttons in scenarios. For Instagram and Messenger the window closes the same way: instagram_window_closed, messenger_window_closed. More on the window: The WhatsApp Business 24-hour window.
What the address answers
This section is for whoever configures the form or the integration. The answer is always JSON like {"ok": true} or {"ok": false, "error": "..."}.
| Code | Answer | What it means |
|---|---|---|
| 200 | {"ok": true} | The request is accepted, the scenario starts in the queue. |
| 200 | {"ok": true, "duplicate": true} | The same request was already received in the last 10 minutes. |
| 200 | {"ok": true, "test": true} | The Tilda connectivity probe (test=test), the scenario is not started. |
| 400 | invalid_body | The body could not be parsed as a form or JSON. |
| 403 | subscription_inactive | The company subscription does not give access or the automations feature is missing. |
| 404 | not_found | A wrong address or secret. The answer is identical so that addresses cannot be guessed. |
| 409 | automation_inactive | Receiving is off or the scenario is not active. |
| 411, 413 | length_required, body_too_large | No body length or the body is larger than 64 KB. |
| 429 | rate_limited | Too many requests. Try again later. |
The result for a specific request (whether the scenario started and why not) is visible in the trigger settings in the "Last request" block and in the scenario run log. If the scenario did not start, the cause is most often one of: trigger_not_matched (the request does not match the trigger conditions), entry_gate_blocked (the client already went through the scenario), contact_blocked or contact_hidden, plan_contact_limit (the active contacts limit of the plan). If the scenario started but the message was not sent, the reason is in the run log; see the table of skip codes in the article on variables and buttons.
Managing the address through the API
The address, the secret and the settings are also available over REST: GET, POST, PATCH /v1/automations/{automation}/inbound-webhook and POST .../inbound-webhook/rotate-secret. Field reference: REST, automations.