İçeriğe geç

Promo codes

Setting up a promotion, giving out single-use codes in a flow and validating them.

Promo codes are single-use discount or campaign codes that a bot flow gives to customers. You don’t upload codes in advance: you define a promotion (code format and limits), and a code is generated on the spot each time the flow gives one out. You track who got which code and who used it in one place.

Create a promotion

  1. On Bot flows › Promo codes, select Create promotion.
  2. Enter a Name (for example “November sale”) and, if you like, a Description.
  3. Under Code format, enter an optional Prefix (for example NOV-; letters, digits, hyphens and underscores only) and set the Code length (4 to 16, default 8). The Example code line shows what codes will look like.
  4. Under Limits, enter a Total code limit or leave it empty for unlimited codes. Codes per person is how many codes one person can get (default 1).
  5. If the campaign ends, pick a Valid until date; otherwise choose Remove end date.
  6. Select Create promotion.

Give out codes in a flow

  1. Open the flow that should give codes in the editor.
  2. From the palette’s Flow group, add a Generate promo code step.
  3. Pick the promotion in Promo.
  4. In Save result, pick a variable or create one with New variable; the generated code is written to it.
  5. Add a Send message step after it and put the code in the message through the variable (for example “Your discount code: …”). Use the field’s Insert variable button to add it.
  6. Connect the step’s If no code is generated output too, for example to a “Codes for this campaign have run out” message.

A code can’t be generated when the total code limit is reached, the person has used up their own codes, or the promotion is off or has ended. In that case an error value is written to the variable instead of a code, so don’t send the variable to the customer on the If no code is generated branch.

Validate a code

To check a code the customer sends back, use the Validate promo code step. Pick the Promo and fill Where the code comes from with the value that holds the code, usually the customer’s last message: {{var_system.user_input}}. If the code is valid, it’s marked as used and the flow continues from Next. If not, it continues from an output for the reason:

OutputWhen
No code givenWhenThe incoming value is empty.
Code not foundWhenNo such code exists.
Code of another promoWhenThe code exists but belongs to a different promotion.
Code already usedWhenThe code was validated before.
Code expiredWhenThe code’s validity has run out.
Promo endedWhenThe promotion’s end date has passed.
Promo inactiveWhenThe promotion is turned off.
No code sourceWhenWhere the code comes from is empty.
On any other errorWhenSomething unexpected went wrong.

Track codes

The list shows each promotion’s Status (Active, Off, Expired), Usage, Codes left and Valid until. Click a promotion to see:

  • At the top: Codes generated, Given, not used, Used and Codes left.
  • Code history: each code’s Status (Unassigned, Given, Used, Expired), who got it, when it was given and when it was used. Times are in the workspace time zone, and you can search by code or phone number.
  • Download codes as CSV saves the list as a file.

Edit and turn off

Use Edit to change the name, format and limits. If codes were already given, format changes apply only to codes generated from then on. Turn off promotion stops new codes from being given; codes already given and the history stay. You can switch it back on any time with Turn back on.

Didn’t find what you need?

Write to us; we’ll look into it and update these guides if needed.

Send an email