Add promotional codes to your Airship messages.

Like other forms of personalization in Airship, with Coupons you create a merge field representing a value you want to personalize, surrounded by double curly braces {{ }}, also known as HandlebarsHandlebars is Airship’s templating language for personalization. Handlebars expressions use double curly braces wrapped around a content template, ranging from a simple variable, e.g., {{first_name}}, to complex evaluations of personalization data.. Airship replaces the merge field (and braces) with the data specified by the merge field at send time — just like mail merge in a word processor or mail client.

The source of this data (including your promotional codes) is a CSV file you upload to Airship and the campaign you define for the codes. We refer to this source as a feed for the campaign.

Example uses:

  • Provide exclusive discounts or rewards to retain or transition your customers and build loyalty
  • Clear out excess or slow-moving inventory
  • Re-engage existing customers with your business

The codes are rendered in plain text in your messages. You can use the JsBarcode library to render the codes as barcodes instead.

Coupons are an

AXP feature.

Coupons workflow

The following is the general workflow for using promotional codes in messages.

  1. Create your CSV file. You’ll specify a unique alphanumeric code per row, plus a campaign ID.

  2. Create a campaign in the dashboard. You will upload your CSV file and define the following:

    • Campaign name — This is used for identification in the list of all campaigns in your project.
    • Campaign ID — You will use the ID when creating your messages so Airship can use codes from the right campaign.
    • Validity period — The effective and expiration dates for the campaign and its codes.
    • Contacts — We’ll notify you by email when 90% of codes have been used in messages and again at 100%.
  3. Create your content using this following format:

    {{#feed "couponing"}}
    Content referencing the feed, like a {{coupon_code}}.

  4. Specify the campaign ID when sending the message. You must also determine how to handle the message if the feed fails. In most cases, you will set the failure behavior to not send the message since it won’t make sense without a code and, potentially, its validity period.

    • In the dashboard, you’ll do this in the Delivery step of a composer.
    • With the API, you’ll make these specifications in the External Data Feed References object.

Boom! We just sent codes to our audience. Now what happens? This is what Airship does next:

  • Populates your message content at send time, using one code from your CSV file per message
  • Checks the number of remaining codes so we can process your remaining code notifications.
  • Generates a coupon_assigned custom event every time a code is used in a message


Ready to get started? Get all the details in the docs: Coupons.