# n8n recipes

> Text from n8n workflows, self-hosted or in the cloud, with BlueBot’s community node.

Three recipes for n8n. Each names its trigger and the BlueBot step, lists the fields to map and says how to test it with your own number before anyone else gets a text.

## How n8n connects

- **[n8n](https://usebluebot.com/docs/n8n)**: BlueBot’s n8n community node sends texts and starts workflows from BlueBot’s webhooks.

## Send tomorrow’s reminders every evening

| Part             | What it is                                     |
| ---------------- | ---------------------------------------------- |
| Trigger          | n8n’s Schedule Trigger set to 5 PM each day    |
| Action           | The **BlueBot** node’s **Send Text** operation |
| Connects through | [n8n](https://usebluebot.com/docs/n8n)                               |

### Steps

1. Start the workflow with a Schedule Trigger node that runs each evening.
2. Read tomorrow’s appointments from your sheet or database.
3. Map each person’s number and appointment time into the BlueBot node to send them a reminder.

### Map the fields

| BlueBot field                | Map it to                                                                                                                                |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `to`                         | The person’s mobile number from n8n. US numbers can leave off the +1.                                                                    |
| `text`                       | Hi {{first_name}}, a reminder that we’ll see you tomorrow at {{time}}. Reply here if you need to move it.                            |
| `{{first_name}}` in the text | n8n’s first name field.                                                                                                                  |
| `{{time}}` in the text       | n8n’s time field.                                                                                                                        |
| `metadata`                   | `source` set to `n8n`, and `record_id` set to the record’s id, so the status and reply webhooks for this text can find the record again. |
| `service`                    | Auto, the default: iMessage when the person uses it, otherwise SMS through your iPhone.                                                  |

### Test it

Put your own number in **To** and press **Test step**. A text arrives on your phone, and the node’s output shows the message. Then map n8n’s field back into **To**.

## Save every reply to your database

| Part             | What it is                                                                             |
| ---------------- | -------------------------------------------------------------------------------------- |
| Trigger          | A text comes in (BlueBot’s message.received webhook)                                   |
| Action           | The **BlueBot Trigger** node on **Message Received** starts it, and n8n takes the text |
| Connects through | [n8n](https://usebluebot.com/docs/n8n)                                                                       |

### Steps

1. Add a Webhook node and copy its production address.
2. Add that address in BlueBot as a webhook for message.received.
3. Write the sender’s number, the words and the time to your database with the Postgres node or any other.

### Map the fields

| From BlueBot       | Into n8n                                                                                                                                       |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `data.from`        | The phone number to find the person by in n8n. It’s in E.164 (`+15555550123`); search by the last 10 digits if n8n stores numbers another way. |
| `data.text`        | The words, for a note, a row or a message. Null when the person sent only a picture.                                                           |
| `data.received_at` | When it came in, in UTC.                                                                                                                       |
| `data.files`       | Pictures and voice memos. Each `url` works for an hour, so copy a file you want to keep.                                                       |
| `data.chat_id`     | Set when the text came in a group chat; null for a one-to-one text.                                                                            |

### Test it

Press **Listen for test event** on the BlueBot Trigger node, then text your BlueBot number from another phone you’ve texted through BlueBot before. BlueBot copies texts from people you’ve texted through it, unless you set **Which chats to copy** to **Everything**.

## Tell your team when a text fails

| Part             | What it is                                      |
| ---------------- | ----------------------------------------------- |
| Trigger          | A text fails (BlueBot’s message.failed webhook) |
| Action           | n8n acts on what BlueBot reports                |
| Connects through | [n8n](https://usebluebot.com/docs/n8n)                                |

### Steps

1. Start a workflow from BlueBot’s webhook for message.failed.
2. Read the metadata you sent with the text to see which customer it was for.
3. Post the customer’s name and the reason to your team’s channel with the Slack node.

### Map the fields

| From BlueBot          | Into n8n                                                                                  |
| --------------------- | ----------------------------------------------------------------------------------------- |
| `data.state`          | `sent`, `delivered`, `read`, `failed` or `expired`, for a field or a filter.              |
| `data.metadata`       | The `record_id` you sent with the text, to find the record it was for.                    |
| `data.failure.reason` | Why a failed text didn’t go: `not_on_imessage`, `messages_refused` or `file_unavailable`. |
| `data.to`             | Who the text was for.                                                                     |

### Test it

Send one text to your own number, then look for the event. To try the step without sending anything, `POST /v1/webhooks/{id}/test` sends an example of any event type to your webhook.

## Before you turn it on

- Text only people who asked to hear from you. Anyone who replies STOP goes on your stop list, and BlueBot cancels texts to them. [Stop words](https://usebluebot.com/docs/concepts/stop-words)
- A text that can’t go yet waits with a hold rather than failing: quiet hours, your Mac away, a daily limit. [Holds](https://usebluebot.com/docs/concepts/holds)
- [n8n with BlueBot](https://usebluebot.com/integrations/n8n) on the integrations page says what else the two do together.
