> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Survey automations

> Run a workflow when someone completes a survey: follow up with detractors, open a ticket, update the contact, call a webhook. Plus what happens to automations that listened to survey tickets.

Survey responses are not tickets, so automations react to the response itself. There are three ways to act on a completed response:

| Way | Where | Best for |
| - | - | - |
| **Survey automation** (workflow) | Automation → Workflows → Create → Survey automation, or the survey's **Share → More → Run a workflow** | Follow-ups inside Gleap: email the respondent, open a ticket, notify a teammate, set a contact attribute, call an API, with conditions on the answers |
| [Survey webhooks](/documentation/surveys/webhooks) | Project settings → Integrations → Webhooks | Your own backend, data warehouse |
| Integrations (Slack, Discord, Zapier, email, webhook integration) | Project settings → Integrations, action "on new item" with the Survey type | A notification per response in a channel |

## Survey automations

A survey automation is a workflow with the trigger **On survey completed**. It runs once per response, when the respondent reaches an ending — in the app, on the survey page, from an email or an embed. A response left halfway does not start it.

### Trigger

* **Survey**: any survey, or one survey.
* **Only run when**: conditions on the answers of that survey and on the contact. Each question type offers matching operators:

| Question | Operators |
| - | - |
| NPS | is a Detractor (0–6) / Passive (7–8) / Promoter (9–10), is, is below, is above, was skipped |
| CSAT, rating, scale, number | is, is below, is above, was skipped |
| Single choice | is, is not, was skipped |
| Multiple choice | includes, doesn't include, was skipped |
| Yes / no | is Yes / No, was skipped |
| Text, email, date | contains, doesn't contain, is, was answered, was skipped |
| Upload | was answered, was skipped |

Contact conditions use your contact attributes (plan, company, custom data). The same conditions are available in **Condition** steps inside the workflow.

Every matching live survey automation runs — there is no priority between them.

### Steps

| Step | What it does |
| - | - |
| Custom API action | Calls your URL with the response (see variables). |
| Condition | Branches on answers, contact attributes, office hours or API results. |
| Delay | Waits, e.g. a day before a follow-up email. |
| Create ticket | Opens a ticket for the respondent, linked to the response (the ticket shows the survey response card). The ticket's own workflows — for example Kai — run as for any new ticket. |
| Email contact | Emails the respondent. |
| Notify teammate | In-app notification linking to the response. |
| Set data attribute | Writes a contact attribute, e.g. the latest NPS score. |
| Pass to workflow | Continues in another survey automation. |

Anonymous responses have no contact: steps that need one (ticket, email, contact attribute) are skipped and the reason shows in **Runs**.

### Variables

| Variable | Value |
| - | - |
| `{{survey.name}}`, `{{survey.id}}` | Survey name and SDK id |
| `{{response.answers.<key>}}` | One answer as text (choice labels, Yes / No) — `<key>` is the question's answer key |
| `{{response.nps}}`, `{{response.npsGroup}}` | NPS score and `detractor` / `passive` / `promoter` |
| `{{response.text}}` | All answers as "Question: answer" lines |
| `{{response.link}}` | The response in the dashboard |
| `{{response.id}}`, `{{response.channel}}`, `{{response.language}}`, `{{response.fields.<key>}}`, `{{response.durationSeconds}}` | Response details and hidden fields |
| `{{contact.name}}`, `{{contact.email}}`, `{{contact.userId}}`, `{{contact.plan}}`, `{{contact.customData.<key>}}` | The respondent (`{{session.*}}` works too) |

### Limits

* Runs start from a queue a few seconds after completion, never in the respondent's request.
* Up to 600 responses per project and minute start automations; more wait and start a minute later.
* Up to 10 survey automations run per response.

## Automations that used survey tickets

Before Surveys 2.0 every response created a ticket of type Survey. Here is what happens to each kind of automation that reacted to those tickets:

| Before | Now |
| - | - |
| Webhook on `ticket.created` filtered to the Survey type, or without a type filter | Keeps receiving a ticket-shaped `ticket.created` payload for every completed response until **January 5, 2027**: `formData` keyed by the old question names (migrated surveys) or answer keys, choices as their label text, `session` with the same contact fields as before, plus `surveyResponse` (the response id). Move to `survey.response.completed` before then. |
| Slack, Discord, email and webhook integrations with the Survey type on "new item" | Keep posting one message per completed response, with the answers and a link to the response. |
| Zapier with the Survey type | Keeps receiving one call per completed response: the new `{ event, data }` payload, with the old ticket fields at the top level until January 5, 2027. |
| Jira, Linear, Asana, ClickUp, GitHub, Trello and the other integrations with the Survey type | Keep creating one issue per completed response until **January 5, 2027**, with the same integration settings (type filter, on/off, board, issue type). The issue is titled "Survey response: \<survey name>" and lists the answers (choice labels, keyed like before), the contact and a link to the response; the response shows a link to the issue. After that date, use a survey automation with a Custom API action, or Zapier. |
| Workflows on "On ticket created" with the Survey type | Never ran for survey tickets. Use a survey automation. |
| REST pollers on `GET /v3/engagement/surveys/{id}/responses` | Keep working with the old response shape. Pollers that read survey tickets from the ticket endpoints see no new responses — use the survey responses endpoint. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.