Custom n8n node + credential that calls the ChatAds API endpoint /v1/chatads/messages. Handles authentication via the x-api-key header and exposes all supported API fields so you can orchestrate ChatAds inside n8n workflows.
credentials/ChatAdsApi.credentials.ts– stores the base URL and API key reused by every node call.nodes/ChatAds/ChatAds.node.ts– singleAnalyze Prospectoperation that posts to/v1/chatads/messages.nodes/ChatAds/chatads.svg– lightweight icon so the node is recognizable inside the n8n editor.package.json,tsconfig.json,.gitignore– helper files so you can compile todist/withtsc(the artifacts n8n loads).
- Install dependencies and build the TypeScript sources:
This produces
cd n8n npm install npm run builddist/credentials/ChatAdsApi.credentials.jsanddist/nodes/ChatAds/ChatAds.node.js. - Copy the compiled
distdirectory into your n8n custom nodes directory (for example~/.n8n/custom/) or publish the package to your internal npm registry and install it where your n8n instance can resolve it. - Restart n8n. The new ChatAds node will appear under the "Transform" group. Add it to a workflow, select the
ChatAds APIcredential, and supply either:- A simple
messageplus optional fields (IP, country, etc.), or - A raw JSON payload (only documented fields are accepted; unexpected keys are rejected to prevent tampering).
- A simple
- Optionally tune
Max Concurrent Requests(default 4) andRequest Timeout (seconds)for high-volume workflows. The node keeps item ordering consistent even when issuing requests in parallel. - When executed, the node sends a POST request to
{{baseUrl}}/v1/chatads/messages(configurable via theEndpoint Overrideparameter) with yourx-api-keyheader and returns the FastAPI response verbatim so downstream nodes can branch onsuccess,error, or any ad copy the backend generated.
Because the wrapper still uses this.helpers.httpRequest, it honors n8n's retry/backoff settings and the Continue On Fail toggle while layering per-node timeouts and error payloads for easier debugging.
Extra Fields (JSON) is validated to prevent conflicts with reserved parameter keys, so untrusted workflows cannot silently override core fields.
- Bump the version in
package.jsonwhenever you change behavior (validation rules, new fields, etc.). - Run
npm run buildto regeneratedist/artifacts—these compiled files are what n8n loads, so they must stay in sync with the TypeScript sources. - Copy/publish the updated
dist/directory to your custom nodes location or npm registry, then restart n8n. - If the backend
FunctionItemschema changes, update both the parameter list inChatAds.node.tsand theOPTIONAL_FIELDSset near the top of the file to keep validation in sync.
Consider keeping a short changelog (GitHub release notes or a CHANGELOG.md) so downstream workflows know when to reinstall the node.
The node accepts the following fields (via parameters or Extra Fields (JSON)):
| Field | Type | Description |
|---|---|---|
message |
string (required) | Message to analyze (1-5000 chars) |
ip |
string | IPv4 address for country detection (max 64 characters) |
country |
string | Country code (e.g., 'US'). If provided, skips IP-based country detection |
message_analysis |
string | Controls keyword extraction method. Use 'fast' to optimize for speed, 'thorough' (default) to optimize for best keyword selection |
fill_priority |
string | Controls affiliate link discovery. Use 'speed' to optimize for speed, 'coverage' (default) to ping multiple sources for the right affiliate link |
min_intent |
string | Minimum purchase intent level required for affiliate resolution. 'any' = no filtering, 'low' (default) = filter garbage, 'medium' = balanced quality/fill, 'high' = high-intent keywords only |
skip_message_analysis |
boolean | Treat exact message as product keyword. When true, goes straight to affiliate link discovery without keyword extraction |