Docs/Integrations

CleverTap

CleverTap decides who gets which campaign and when. Anypost sends it. Add Anypost as a Generic HTTP email provider in CleverTap and every campaign sends from your verified domain, while deliveries, bounces, complaints, and unsubscribes flow back into CleverTap's reports and profiles.

Note

CleverTap's Generic HTTP provider is in private beta. Ask your CleverTap account team to enable it for your account.

Before you start

  • A verified sending domain for the addresses your campaigns send from.
  • An Anypost API key. A send_only key is enough. See Authentication.
  • Generic HTTP enabled in your CleverTap account.

Connect CleverTap

  1. In CleverTap, start adding a Generic HTTP email provider and copy the callback URL it shows.
  2. In the Anypost dashboard, open Integrations, then CleverTap, and paste the callback URL. This is where Anypost sends events. One CleverTap account per team.
  3. Back in CleverTap, fill in the provider setup:
SettingValue
Endpointhttps://api.anypost.com/v1/integrations/clevertap/email
MethodPOST
AuthenticationNone
HeadersAuthorization: Bearer <your API key> and Content-Type: application/json
BodyThe template below
BatchOff, unless you can set the batch size. See Batching

Mail sends as soon as CleverTap is set up. Events reach CleverTap only once step 2 is done, so finish both sides before your first campaign.

Body template

Paste this as the request body. CleverTap replaces each $$ placeholder per message.

{
  "to": "$$To",
  "message_id": "$$MessageID",
  "campaign_id": "$$CampaignID",
  "from_name": "$$FromName",
  "from_address": "$$FromAddress",
  "reply_to": "$$ReplyToAddress",
  "subject": "$$Subject",
  "html": "$$HTML",
  "text": "$$Plaintext"
}

An empty placeholder counts as not set, so optional fields can stay in the template.

FieldPlaceholder
to$$ToRequired. One recipient per message.
message_id$$MessageIDRequired. CleverTap matches every event to its message by this value.
from_address$$FromAddressRequired. Must be on a verified domain.
from_name$$FromName
subject$$SubjectRequired.
html, text$$HTML, $$PlaintextAt least one is required.
reply_to$$ReplyToAddress
campaign_id$$CampaignIDBecomes the email's campaign.
subscription_groupa custom keySee Subscription groups.
ip_poola fixed valueA dedicated IP pool on your team.

A field you set at the top level of a batched body applies to every message that leaves it empty.

Subscription groups

Add a custom $$SubscriptionGroup key to your CleverTap campaign and a "subscription_group": "$$SubscriptionGroup" line to the template. Each message then carries a one-click List-Unsubscribe header scoped to that group, which Gmail and Yahoo require on marketing mail. The group also becomes the email's topic, lowercased with spaces and punctuation turned into -: Plant Care Tips becomes plant-care-tips.

A recipient who unsubscribes from one group stops getting that group from Anypost. CleverTap isn't told, because CleverTap's only unsubscribe event removes the profile from all email. A recipient who unsubscribes from everything is reported to CleverTap as unsubscribed. See Unsubscribe.

What CleverTap receives

Anypost eventCleverTap eventEffect in CleverTap
email.delivereddeliveredNotification Delivered
email.bounced, permanenthard_bounceNotification Failed; unsubscribes the profile from all email
email.bounced, temporary or expiredsoft_bounceNotification Failed
email.complainedspamUnsubscribes the profile from all email
email.unsubscribed, from all emailunsubscribedUnsubscribes the profile from all email
email.suppressedby reason: hard_bounce, spam or unsubscribedAs above

Sent, delayed, opened, and clicked events aren't reported. CleverTap has no open event, so keep CleverTap's own click tracking on for click reporting.

Some bounces arrive later by email instead of during delivery, and spam complaints come from mailbox providers' feedback loops. Neither can be tied to the original message. Anypost adds the address to your suppression list, and CleverTap learns of it on the next campaign to that address, which Anypost blocks and reports as email.suppressed. Addresses you suppress by hand are never reported, since that would unsubscribe the profile from all email.

Anypost retries event deliveries that fail, and CleverTap doesn't remove duplicates, so a retried delivery can count an event twice in CleverTap's reports.

Batching

CleverTap batches up to 1,000 messages per request. Anypost accepts up to 100 per request, and 5 MB in total. If your CleverTap account lets you set the batch size, set it to 100 or fewer and wrap the template in a msgs array:

{
  "msgs": [
    { "to": "$$To", "message_id": "$$MessageID", "…": "…" }
  ]
}

Otherwise leave batching off. Each email is then one request, which counts toward your plan's per-second rate limit.

Where to go next

  • Domains & DNS setup: verify the domain your campaigns send from.
  • Suppressions: the list that keeps bounced and unsubscribed addresses from being mailed.
  • Sending limits: the daily and monthly limits every send counts toward.