Redeem codes in an Infobip chatbot
Let customers enter voucher codes in a chat: connect the VoucherVerse app on Infobip Exchange and add the validate and redeem blocks to your Answers bot.
For: Admins with an Infobip accountHow it works
A customer types a code in your Infobip Answers chatbot (WhatsApp, SMS, web chat and so on). The bot checks it with the validateCode block and uses it up with redeemCode. Each code works once, across the chatbot, the scanner and the Codes API.
You need an Infobip account with the VoucherVerse app from Infobip Exchange, and a campaign with codes.
Connect VoucherVerse in Infobip Exchange
- In Infobip, open Exchange, then My apps, and click Configure on VoucherVerse.
- VoucherVerse opens inside Infobip and signs you in with your Infobip login. The first person from an Infobip account creates a VoucherVerse company; colleagues who open it later join that company as admins.
- If your email already has a VoucherVerse login, you are asked for your VoucherVerse password to connect the two. Click Connect. This sign-in expires after 15 minutes; if it does, open VoucherVerse from Exchange again.
The settings page shows your campaigns, their codes and whether each has an API key. Full dashboard opens the complete VoucherVerse dashboard.
Set up a campaign for the chatbot
- New campaign: create the campaign (see Create a campaign).
- Generate or import its codes (see Generate, import and export codes).
- On the campaign, open API access and click Generate key. Copy the key (it starts with
vvb_) straight away: it is shown once. - Add the blocks to your Answers bot (next section).
Add the blocks to your Answers bot
- Save the code the customer types in an attribute, and keep their phone number in another.
- Add the
redeemCodeblock (andvalidateCodefirst if you want to confirm before redeeming). In each block setkeyto the campaign API key,codeto the code attribute andparticipantto the phone attribute. - Branch on the block's
statusand reply to the customer, or send the ready-mademessage.
redeemCode runs the same checks as validateCode, so validating first is optional.
What the bot gets back
| status | Default message |
|---|---|
VALID | This code is valid. |
REDEEMED | Thanks, your code has been redeemed. |
NOT_FOUND | We couldn't find that code. Please check it and try again. |
ALREADY_REDEEMED | This code has already been used. |
EXPIRED | This code has expired. |
CAMPAIGN_CLOSED | This promotion is not running right now. |
RATE_LIMITED | Too many attempts. Please try again later. |
Codes are matched within the key's campaign, ignoring upper and lower case and surrounding spaces.
Limits and troubleshooting
- After 10 rejected codes (not found, already used or expired) from the same participant on a campaign within an hour, that participant gets
RATE_LIMITEDuntil the hour has passed. Successful codes don't count. INVALID_KEY: the key is missing, wrong or has been rotated, or its campaign was deleted. Paste the current key into the blocks, or restore the campaign.CAMPAIGN_CLOSEDwhile the campaign is running: your company's plan is unpaid or has ended. See Plans, billing and limits.- This Infobip account is already connected to another VoucherVerse company.: each Infobip account links to one company.
Building your own bot or app instead? Use the Codes API.