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

# n8n

> Send email and SMS, keep contacts and consent, and start workflows from Sendbaze events, without writing code.

The community node `n8n-nodes-sendbaze` adds two nodes to [n8n](https://n8n.io): **Sendbaze**, which calls the API, and **Sendbaze Trigger**, which starts a workflow when Sendbaze reports a delivery, a bounce, a STOP reply or an account event. It works on n8n Cloud and self-hosted n8n 1.0 or later.

## Install

**1. Install the node**

In n8n open **Settings → Community Nodes → Install**, enter `n8n-nodes-sendbaze` and confirm. On a self-hosted instance you can also run `npm install n8n-nodes-sendbaze` in the n8n user folder and restart n8n.

**2. Add the credential**

Create a **Sendbaze API** credential with a key from the [API keys page](https://dashboard.sendbaze.com/keys). Start with a test key (`sk_test_…`): messages are validated and stored, never sent. n8n checks the key against `GET /v1/usage` when you save it.

**3. Drop the node into a workflow**

Search for *Sendbaze* in the node panel. The Sendbaze node goes after whatever produces the message; the Sendbaze Trigger goes first.

## The Sendbaze node

| Resource | Operations | What you fill in |
| - | - | - |
| Email | Send, Get | From, To (comma-separated for several), a subject and HTML or text, or a saved template with its variables; the type (transactional or marketing); options for CC, BCC, Reply-To, tags, **Send At** and an idempotency key. Get takes an `em_…` id. |
| SMS | Send, Get | One number in E.164 form, the message, the type; options for the sender id, tags, **Send At** and an idempotency key. Get takes an `sm_…` id. |
| Contact | Create or Update, Get, Opt Out | An email address or a phone number (or both), fields such as `first_name`, and optionally the consent the person gave: channels, source (form, existing customer, import, manual) and evidence (form URL, IP address, the text they agreed to, a note, when). |

Every operation is the same request your code would make, so the rules are the API's: a live email needs a [verified domain](https://docs.sendbaze.com/get-started/add-domain.md), a marketing SMS needs a [consent record](https://docs.sendbaze.com/learn/contacts.md) for the number, STOP replies and unsubscribes are honoured, the SMS [send window](https://docs.sendbaze.com/learn/sms.md) applies. An error comes back as the API's code and message, for example `consent_missing: …`; the [errors reference](https://docs.sendbaze.com/errors.md) says what to do. Turn on **Continue on fail** to keep the workflow going and put the error on the item instead.

Use n8n expressions for anything per item, such as `{{ $json.email }}` for the recipient or `{{ $json.first_name }}` in the message.

## Styling emails in n8n

There are two ways to send a designed email from a workflow:

* **The HTML field.** It takes complete HTML, not just plain text: inline styles, tables, images and your brand colours all work, and n8n expressions such as `{{ $json.first_name }}` fill in the data. Add the **Text** version too when you can; spam filters read it.
* **A saved template.** Design the email in the visual builder on the dashboard's [Templates page](https://dashboard.sendbaze.com/templates), then choose **Saved Template** in the node, paste the `tpl_…` id and fill in its variables. Nobody has to write HTML, and the copy can be changed later without touching the workflow. See [Templates](https://docs.sendbaze.com/learn/sending/templates.md).

The node has no `react` option. [React Email](https://docs.sendbaze.com/learn/sending/react-email.md) is rendered by the Node SDK inside your own app, and a workflow has nowhere to run a component. If your emails are React components, render one to HTML in your project with `renderReactEmail` from `@sendbaze/sdk` and paste the result into the HTML field, with `{{ … }}` expressions where the data goes.

## The Sendbaze Trigger

Pick the events to listen for, or leave the list empty for every event (including types added later):

* Email: sent, delivered, bounced, complained, failed, unsubscribed
* SMS: sent, delivered, failed, opted out (a STOP reply)
* Account: usage threshold reached, credits low, billing payment failed, plan limit reached

When you activate the workflow the node registers an endpoint with `POST /v1/webhooks`, keeps its signing secret and shows the endpoint on the dashboard's Webhooks page with the description you gave; deactivating the workflow removes the endpoint. Every delivery is checked against the `Sendbaze-Signature` header ([how that works](https://docs.sendbaze.com/learn/webhooks/verify-signature.md)) before it reaches the workflow; the dashboard's **Send test event** button reaches it too. The item is the [event payload](https://docs.sendbaze.com/learn/webhooks/events.md): `id`, `type`, `occurredAt` and `data`.

## Example: a welcome SMS from a form, and STOP replies back to your CRM

1. **n8n Form Trigger** with a name, a cellphone number and a tick box that reads "Send me offers by SMS".
2. **Sendbaze → Contact → Create or Update**: phone `{{ $json.cell }}`, field `first_name` = `{{ $json.name }}`, **Record Consent** on, channel SMS, source *Form*, evidence URL = the form's URL and the tick box text.
3. **Sendbaze → SMS → Send**, type *Marketing*: `Hi {{ $json.first_name }}, thanks for signing up. Reply STOP to opt out.`
4. In a second workflow, **Sendbaze Trigger** on *SMS Opted Out* followed by your CRM's node, using `{{ $json.data.to }}`.

## Source

The node is open source in the [Sendbaze repository](https://github.com/LeosSaini/sendbaze/tree/main/packages/n8n-nodes-sendbaze) under the MIT licence. Problems or wishes: [support@sendbaze.com](mailto:support@sendbaze.com).


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