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
HTTP Endpointhttps://api.anypost.com/v1/integrations/clevertap/email
Request TypePOST
AuthenticationNo Authentication
HeadersAuthorization: Bearer <your API key> and Content-Type: application/json
ParametersThe JSON below
Batch parameterOn, named msgs, size 100. 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.

Parameters JSON

Paste this into the Parameters tab. CleverTap replaces each $$ placeholder per message and repeats the entry inside msgs once per email in the batch.

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

Keep the layout as shown: CleverTap accepts $$CampaignID only at the top level and the sender placeholders only inside msgs. A placeholder CleverTap leaves empty or unfilled 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 at the top level applies to every message in the batch.

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, permanent, address rejectedhard_bounceNotification Failed; unsubscribes the profile from all email
email.bounced, permanent, message rejected for content, sending IP, policy or authenticationsoft_bounceNotification Failed
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.suppressed, from all emailby reason: hard_bounce, spam or unsubscribedAs above
email.suppressed, by hand or from one subscription groupsoft_bounceNotification Failed
An email Anypost refused, invalid addresshard_bounceNotification Failed; unsubscribes the profile from all email
An email Anypost refused, any other reasonsoft_bounceNotification Failed

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, and recipients who unsubscribed from one subscription group, are reported as soft_bounce: the email fails without unsubscribing 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

Turn on Batch parameter in CleverTap's provider setup, name it msgs, and set it to 100. CleverTap then sends up to 100 emails per request instead of one. With batching off, paste the object inside msgs into Parameters, with campaign_id beside its other fields: each email is then one request, which counts toward your plan's per-second rate limit.

Two limits apply to every request:

  • 100 emails. A larger batch is rejected.
  • 5 MB in total. At 100 emails that leaves about 45 KB per email, HTML and plain text together. If your emails are larger, lower the batch size to about 4,500 divided by the size of one email in KB: 60 for 75 KB emails.

An email Anypost refuses is reported on its own, with the reason as the failure description, and the rest of the batch sends. Reasons include an invalid recipient address, a sender domain that isn't verified, and a missing subject or body.

A request Anypost can't accept at all fails every email in it, and CleverTap counts each one as bounced: a wrong API key, invalid JSON, a batch over either limit, a template with no message_id or to, or a request over your plan's rate limit or monthly sending 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.