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

> ## Agent Instructions
> Usertick runs surveys on websites, by link, by QR code and by email, and collects every response in one inbox with reports, dashboards and workflows. The REST API lives at https://app.usertick.com/api/public/v1 and uses Bearer API keys or OAuth access tokens; the JavaScript SDK is the @usertick/snippet package on npm.

# n8n

> Start an n8n workflow from each survey response with a webhook, read the answers in the next node, and update responses with the HTTP Request node.

A [webhook](https://docs.usertick.com/integrations/webhooks.md) in Usertick starts an n8n workflow when a response arrives, is analyzed, becomes urgent or changes. The workflow receives the answers, the AI reading and the respondent, and every node after the first can use them. It works on every plan, with n8n Cloud and with n8n on your own server.

## Before you start

* Your n8n has a public address that starts with `https://`. Usertick doesn't send to private addresses.
* Your role has the **Manage integrations** permission. If your account uses two-factor authentication, Usertick asks for a code before it creates the webhook.
* Your plan has a free endpoint, with 1 on Free, 3 on Starter, 10 on Pro and 25 on Business. Each n8n workflow that starts from a response uses one.

## Connect n8n

**1. Add a Webhook node**

In n8n, start a workflow with a **Webhook** node and set **HTTP Method** to **POST**.

**2. Copy the production URL**

Copy the node's **Production URL**, then publish the workflow. The test URL works only while the n8n editor listens for it.

**3. Create the webhook in Usertick**

In **Settings → Developers → Webhooks**, select **New webhook**, enter a **Name** and paste the URL.

**4. Choose what starts the workflow**

Under **Survey events**, choose the surveys under **Surveys** and the event under **When**.

**5. Create it and save the secret**

Select **Create webhook**, copy the signing secret, then select **I saved it**.

**6. Answer the survey once**

The response appears under **Executions** in n8n, and the endpoint's **Deliveries** show n8n's answer.

## Choose the event

| **When** | Use it to |
| - | - |
| **When a response is submitted** | Act on every response right away, before the AI analysis |
| **After AI analysis** | Use the type, urgency, theme and sentiment |
| **When it becomes urgent** | Route urgent responses to a person |
| **When its status changes** | Follow a response through the inbox |
| **When someone corrects the AI** | Follow the changes your team makes to the reading |
| **When a theme spikes** | Tell your team that a theme is growing. The body holds the theme instead of a response. |

The events that come after the AI analysis can be narrowed under **Only these responses**. To send the responses that match any other condition, use a workflow with a **Send to a webhook** step. See [Send responses with a workflow](https://docs.usertick.com/integrations/webhooks.md#send-responses-with-a-workflow).

## Read the response in n8n

n8n puts the request's body under `body` and its headers under `headers`. These expressions work in any node that follows the Webhook node:

| What you need | Expression |
| - | - |
| Survey | `{{ $json.body.data.survey.name }}` |
| NPS | `{{ $json.body.data.answers.find(a => a.type === 'nps')?.value }}` |
| Star rating | `{{ $json.body.data.answers.find(a => a.type === 'rating')?.value }}` |
| Written answers | `{{ $json.body.data.answers.filter(a => a.type === 'text').map(a => a.text).join(' / ') }}` |
| Type and urgency | `{{ $json.body.data.ai?.type }}` and `{{ $json.body.data.ai?.urgency }}` |
| Theme | `{{ $json.body.data.ai?.theme?.name }}` |
| Email of the respondent | `{{ $json.body.data.respondent.email }}` |
| Page | `{{ $json.body.data.pageUrl }}` |
| Link to the response | `{{ $json.body.data.url }}` |

The AI values are empty on **When a response is submitted**. [The Response resource](https://docs.usertick.com/developers/api/response-object.md) describes every field.

## Keep test pings out

**Send test** posts a `ping`, whose body has no `type`. Put a **Filter** node after the Webhook node and keep the items whose `{{ $json.body.type }}` starts with `response.`.

## Skip a repeated delivery

When n8n doesn't answer in time, Usertick [sends the delivery again](https://docs.usertick.com/developers/webhooks/delivery.md) with the same ID. To act on it once, add a **Remove Duplicates** node, choose **Remove Items Processed in Previous Executions** and compare `{{ $json.headers['webhook-id'] }}`.

## Protect the URL

n8n's Webhook node doesn't check Usertick's signature, and anyone who has the production URL can start the workflow, so treat the URL as a password. To check each delivery, turn on **Raw Body** in the Webhook node and [verify the signature](https://docs.usertick.com/developers/webhooks/verify.md) in a Code node.

## Change a response from n8n

On Pro and above, the **HTTP Request** node can call the [REST API](https://docs.usertick.com/developers/api/overview.md) with an [API key](https://docs.usertick.com/developers/api/authentication.md) sent as a Bearer token. For example, it can [set a response's status, type, urgency or assignees](https://docs.usertick.com/developers/api/reference/update-response.md) or [add a note](https://docs.usertick.com/developers/api/reference/add-comment.md). The response's ID is `{{ $json.body.data.id }}`.

## Who can do this

Creating, changing, testing and deleting a webhook require the **Manage integrations** permission. Creating an API key requires **Manage developer settings**.


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