Skip to main content

Overview

Integrate ChatAds with Zapier using the Webhooks by Zapier action. This lets you add affiliate links to any Zap that processes user messages—chatbots, email automations, form submissions, and more.
Zapier uses a webhook-based approach rather than a native app. You’ll configure a POST request to the ChatAds API directly.

Setup Guide

Step 1: Create Your Zap

  1. Create a new Zap in Zapier
  2. Add a Trigger step of your choosing that contains the message you want to analyze
  3. Add a Webhooks by Zapier action and choose POST

Step 2: Configure the POST Action

Configure the webhook with the following settings:
FieldValue
URLhttps://api.getchatads.com/v1/chatads/messages
Payload Typejson
Datamessage: Map to your trigger’s message field
Wrap Request in ArrayNo
UnflattenYes
Headersx-api-key: Your API key from app.getchatads.com/api/keys
Leave File and Basic Auth blank.
Store your API key securely. Never expose it in client-side code or share it publicly.

Step 3: Test

  1. Click Test step in Zapier
  2. You should receive the same JSON response you’d see in the API Explorer
  3. Use the response data in your next Zap action

Request Parameters

Required

message
string
required
The user message to analyze. Must be 1-5000 characters.

Optional

ip
string
IPv4/IPv6 address for country detection (max 45 characters).
country
string
Country code (e.g., ‘US’). If provided, skips IP-based country detection.
quality
string
default:"standard"
Resolution quality level. Options: fast (~150ms), standard (~1.4s), best (~2.5s).

Response

The webhook returns the standard ChatAds API response:
{
  "data": {
    "status": "filled",
    "offers": [
      {
        "link_text": "yoga mat",
        "url": "https://amazon.com/...",
        "confidence_level": "high"
      }
    ],
    "requested": 1,
    "returned": 1
  },
  "error": null,
  "meta": {
    "request_id": "abc-123"
  }
}

Parsing the Response

To extract the affiliate link in a subsequent Zapier step, you can use a Code by Zapier action with Python:
import json

raw = input_data.get("chatads_response")

if isinstance(raw, str):
    try:
        payload = json.loads(raw)
    except json.JSONDecodeError:
        payload = {}
else:
    payload = raw or {}

# Get first offer if available
offers = payload.get("data", {}).get("offers", [])
if offers:
    offer = offers[0]
    link_text = offer.get("link_text", "")
    url = offer.get("url", "")
    return {"link_text": link_text, "url": url}
else:
    return {"link_text": "", "url": ""}
This extracts the link_text and url from the first offer, which you can then use in subsequent Zap steps.

Example Use Cases

AI Chatbot Responses

Trigger: Webhook (receives user message)
  → Webhooks by Zapier (call ChatAds API)
  → Filter (check if returned > 0)
  → OpenAI (generate response with affiliate link)
  → Webhook (send response back)

Email Product Mentions

Trigger: Gmail (new email)
  → Webhooks by Zapier (analyze email body)
  → Filter (check if returned > 0)
  → Slack (notify with affiliate opportunity)

Form Submissions

Trigger: Typeform (new response)
  → Webhooks by Zapier (analyze product interest field)
  → Filter (check if returned > 0)
  → Email (send personalized recommendation)

Error Handling

Check the error field in the response to handle failures:
  • 401 - Invalid or missing API key
  • 429 - Rate limit exceeded
  • 500 - Server error (retry with backoff)
Use Zapier’s Paths or Filter steps to handle different outcomes:
IF error is not null → Handle error path
IF data.returned > 0 → Use affiliate link
ELSE → Continue without affiliate

Best Practices

Test in API Explorer first

Verify your request works in the API Explorer before configuring Zapier.

Handle empty responses

Always check data.returned > 0 before using affiliate data.

Use Filters

Add Filter steps to route Zaps based on whether affiliates were found.

Monitor usage

Check meta.usage in responses to track quota consumption.