Login

Security and Compliance

Promo Code Added via API

Let's see how to add promo codes to trigger messages using API methods:

Generate event method

The Generate event method allows you to send any custom events that can launch workflows.
To substitute a promo code transmitted via API into a trigger message, do the following:

  1. Set up the transfer of the necessary parameters in the event.
  2. Add a variable to the message.
  3. Create a workflow.

1. Setting event parameters

The event must contain a promo code and contact identifier for sending the message (e.g., an email address for sending an email or a phone number for SMS).

Event parameters:

{
  "params": [
    {
      "name": "EmailAddress",
      "value": "mail@example.com"
    },
    {
      "name": "code",
      "value": "ABC-123"
    }
  ]
}

, where code is the variable's name used in the message, and ABC-123 is the promotional code the contact will receive.

2. Substituting variable in the message

Insert the variable's name containing the promo code into the message in the $!data.get('code') format. Instead of a variable, the contact will see the promo code passed in the event.

Substituting variable in the message

3. Creating the workflow

In the message block in the workflow, specify the event parameter that contains the contact identifier for sending the message (in our example, this is an email address; for other channels, use the appropriate IDs). 

Creating the workflow

Read more about launching a workflow on an event in the instructions.

Send Prepared Message Method

The Send prepared message method allows you to send campaigns to one or more contacts. 

You can send a unique promo code to each contact.

Request format:

{
    "recipients": [{
        "locator": "mail@example.com",
        "jsonParam": "{\"code\":\"ABC-123\"}"
    }],
    "email": true
}

, where the recipients array contains elements with jsonParam. It can be used to send any data to a message, including a promo code. The data for the message must be in JSON format converted to a string.

Use message ID instead of {id} in https://esputnik.com/api/v1/message/{id}/smartsend request.

In the message, use a variable in the $!data.get('code') format.

Any Questions?
We’re always happy to help!
Discount services
Schedule a Call
Fill in the form, and our specialists will call you back as soon as possible.
Discount services
Chat Support
We’re waiting for your questions!
Discount services
Email
Contact the support team