n8n-nodes-attentive-api
v0.2.0
Published
An n8n community node for the Attentive Mobile API — subscriptions, custom events, attributes, ecommerce events, identity, and webhooks with multi-account support
Downloads
274
Maintainers
Readme
n8n-nodes-attentive-api
An n8n community node for the Attentive Mobile API. Handles SMS/email subscriptions, custom events, subscriber attributes, ecommerce tracking, and more — without the usual headaches of wrangling the Attentive API directly.
About Attentive
Attentive is an SMS and email marketing platform focused on personalized messaging for ecommerce brands. Their API lets you manage subscribers, fire events that trigger automated journeys, and sync customer data — but it has a few sharp edges that make working with raw HTTP requests tedious (more on that below).
About n8n
n8n is a fair-code licensed workflow automation platform. Think Zapier, but self-hostable and way more flexible.
Why This Node?
If you've tried using Attentive's API from n8n's HTTP Request node, you've probably run into a few of these:
- Subscribers have to exist first before you can update their attributes or fire events — otherwise the API silently fails or returns a 400.
- Custom event properties have to be flat — no nested objects or arrays. If you send
{"items": [...]}you get a cryptic error. - The attributes endpoint requires exactly one of email or phone, not both. Send both? 400.
- Phone numbers must be E.164 (
+15551234567). Pass(555) 123-4567and nothing happens. - Each brand/account has its own API key, so multi-brand setups mean duplicating every API call node.
This node handles all of that for you. Phone formatting, property flattening, identifier validation — it's all built in. And if you're running multiple Attentive accounts (say, different brands or regions), you can store all the API keys in a single credential and switch between them with an expression.
Table of Contents
- Installation
- Credentials
- Operations
- Multi-Account Setup
- Things Worth Knowing
- Compatibility
- Docker Setup
- Development
- Publishing
Installation
Install via the n8n community nodes UI, or with npm:
npm install n8n-nodes-attentive-apiCredentials
- In n8n, go to Credentials and create a new Attentive API credential
- Paste your Bearer token from your Attentive custom app into Default API Key
- Hit Test — it calls
GET /v2/meto verify the token works
That's it for single-account usage. For multi-account, see below.
Operations
Subscriber
- Subscribe — Opt a user into SMS/email. Supports both
MARKETINGandTRANSACTIONALsubscription types. You can provide asignUpSourceId(Attentive's sign-up unit ID) or let the node usesubscriptionType + localeinstead. - Get Eligibility — Check whether a user can be subscribed and see what they're currently subscribed to.
- Unsubscribe — Remove a user from a specific subscription, or all of them. Heads up: the Attentive API treats an empty subscriptions array as "unsubscribe from everything" — the node makes you explicitly choose "All" so you don't do this by accident.
Custom Event
- Send — Fire a named event that can trigger Attentive journeys. Properties are automatically flattened to primitives (you can disable this if your data is already flat). The event
typeis case-sensitive —"Order Success"and"order success"are two different events in Attentive.
Custom Attribute
- Set — Create or update attributes on a subscriber profile. Values have to be scalar (string, number, boolean) — Attentive doesn't support array values here.
- Get — Pull back the custom attributes for a subscriber.
eCommerce Event
- Product View — Log a product view
- Add to Cart — Log an add-to-cart
- Purchase — Log a purchase (this is the one you want for order confirmations and post-purchase flows)
Identity
- Associate — Link a phone number, email, and/or your own customer ID together for identity resolution. Useful when a customer uses different identifiers across touchpoints.
Webhook
- List / Create / Update / Delete — Full CRUD for Attentive webhooks. Subscribe to events like
sms.subscribed,email.opened,custom_attribute.set, etc.
Account
- Get Info — Returns your account name, company, and domain. Handy for verifying which account you're talking to, especially in multi-account setups.
Trigger
- Attentive Trigger — A dedicated trigger node that auto-registers a webhook in Attentive for a specific event type (for example,
sms.subscribed,email.opened, orcustom_attribute.set) and starts your workflow whenever that event fires. The node handles webhook create/delete on workflow activate/deactivate so you don’t have to manage URLs in the Attentive UI.
User Properties (V2)
- Upsert User — Uses the
/v2/user/attributesendpoint to create or update a user and their attributes, identifiers, and subscriptions in one call. This is the most future-proof way to sync profile data with Attentive and matches their v2 API spec.
Multi-Account Setup
If you manage multiple Attentive accounts (different brands, regions, etc.), you don't need a separate credential for each one.
- In your Attentive API credential, set the Default API Key to your primary account
- Add an Account Map — a JSON object mapping short names to API keys:
{
"us": "your-us-api-key",
"borne": "your-borne-api-key",
"uk": "your-uk-api-key",
"eu": "your-eu-api-key"
}- In any Attentive node, set the Account field to the key name. It supports expressions, so you can drive it from your input data:
={{ $json.region }}If the account name doesn't match anything in the map, it falls back to the default key. There's also an API Key Override field on every operation if you need to inject a key completely dynamically.
Things Worth Knowing
These are the Attentive API behaviors that tripped us up during development. The node handles most of them, but it's good to know what's happening under the hood.
Phone numbers get auto-formatted. Pass 5551234567, (555) 123-4567, or 1-555-123-4567 — the node normalizes everything to E.164 (+15551234567) before sending.
Custom event properties are flattened automatically. If you pass {"items": [1, 2, 3]}, the node will JSON.stringify the array value so Attentive doesn't reject it. You can disable this with the "Flatten Properties" toggle if you're already handling it.
The attributes endpoint is picky about identifiers. Send both email and phone? 400 error. Send neither? Also 400. The node validates this before making the request and gives you a clear error.
Subscribe is asynchronous. You get a 202 Accepted, not a 200 OK. The subscriber isn't instantly available — there's a brief delay before you can update their attributes or fire events. That's why the original n8n flow used merge/wait nodes as a sync gate.
Re-subscribing someone who's already on TEXT sends them an "already subscribed" SMS. This is Attentive's behavior, not something the node can prevent. Be mindful when using Subscribe on users who might already be opted in.
Events older than 12 hours won't trigger Journeys. If you're backfilling historical events, they'll be recorded but won't kick off any automations. The occurredAt field description warns about this.
Rate limits vary by endpoint. Subscribe and Identity are limited to 10 req/sec. Unsubscribe is 5 req/sec. Everything else is 150 req/sec. The node logs a warning when the x-ratelimit-remaining header drops below 10.
Event type names are your segmentation keys. Whatever you put in the type field (e.g. "Order Success - mishimoto.com") is what shows up in Attentive's journey builder. Change the string and you break existing journeys.
Compatibility
- n8n: 2.2.0+
- Node.js: 18.17.0+
Docker Setup
FROM n8nio/n8n:latest
RUN npm install -g n8n-nodes-attentive-apiThen rebuild your container. Nodes installed with -g won't show in the "Community Nodes" settings page but will appear when you search for "Attentive" in the node picker.
If you want to pin a version:
RUN npm install -g [email protected]Development
git clone https://github.com/Bwilliamson55/n8n-nodes-attentive.git
cd n8n-nodes-attentive
npm install
npm run build
npm linkThen in your n8n installation directory:
npm link n8n-nodes-attentive-apiRestart n8n and the node should show up. Use npm run dev for watch mode so you don't have to rebuild after every change (you'll still need to restart n8n to pick up changes).
Publishing
npm run build
npm run lint
npm pack --dry-run # check what goes in the package
npm publishOnly the dist/ directory gets published, per the files array in package.json.
Contributing
Issues and PRs welcome. For anything big, open an issue first so we can talk through the approach.
License
MIT
