Salebot.ai
  • About
  • The basics: How to use Salebot.ai
    • The basics of using the editing software
    • Creating blocks and the types of them
    • Arrows (connections)
    • Quick actions
    • Buttons
    • Condition and Matching selection
    • Links to messengers
    • Blocks "not State"
    • The first message
    • Description of the fields in the Editor
    • How to make the bot not interrupt the dialogue with the client
    • Sending attachments. Tracking links.
    • Getting files from the user
    • Editing text message
    • Random answers in a bot
    • Built-in variables
    • Reservation and recovery
    • Free Videos to master Salebot
  • Administration
    • Custom Roles
    • Reservation and recovery
  • Messengers and chats
    • WhatsApp
    • Whatsapp Business API
    • Telegram
    • Viber
    • Facebook Messenger
    • Official Instagram
    • Online-chat on a site
    • Merging contacts from different messengers
  • Variables
    • Variables
    • Calculator
    • API in Calculator
    • Variable comparison
    • Working with Dates and Time
    • Working with Arrays and Dictionaries
    • List of Useful Regular Expressions
    • How to use variables
  • CRM
    • AmoCRM
    • Bitrix24
  • Working with API
    • The editing software's API
    • Integration with third-party APIs
  • Integrations
    • Payment systems
      • Capusta.space
      • Coinpayments
      • INXY Payments
      • Paypal
      • Payeer.trade
      • Paynow
      • Stripe
      • Telegram
      • Fondy
      • Wayforpay
      • WalletOne
    • InfoBusiness
      • MyOwnConference
      • WebinarGeek
    • Analytics
      • Roistat
      • Facebook Pixel
      • Google Analytics
    • Google Sheets
    • Google Tables
    • Google Calendar
    • Apix-Drive
    • SMS services
    • Sendpulse
    • QuizGO
    • Tilda
    • Linkrr
    • Vakas-Tools
  • Mailings
    • Pipelines
    • Manual mailings
    • Mailing list
    • Stop mailing
    • How to filter clients for mailing
    • Transferring the client base. Uploading Whatsapp numbers
  • To partners
    • How to transfer the project to the customer
  • How to...
    • FAQ
    • ...Create a simple chatbot
    • ...Transfer UTM-labels
    • ...Create a referral program
    • ...Create temporarily available content
    • ...Connect analytics counters and configuring conversions through GTM
    • ...Move clients to another block
    • ...Create personalized images
    • ...Create a menu in Telegram
    • ...Connect Telegram-pay
  • Payment Services
    • Page 1
  • Mini-landing
  • Special capabilities
    • Python programming
    • Generating a QR-code
    • Generating a barcode
    • Barcode recognition on an image
    • Using Google Sheets for mailings
    • Sending requests to messengers and email
    • Working with promo codes
  • Our services
    • Pricing
    • Training courses
  • Group 1
Powered by GitBook
On this page
  • How to check the promo code from Google Sheets
  • How to give a promo code from Google Sheets
  • How to generate a promo code with the help of Salebot
  1. Special capabilities

Working with promo codes

The bot allows not only to give promo codes to clients, but also check their validity and control their one-time use

PreviousSending requests to messengers and emailNextPricing

Last updated 2 years ago

You can give a promo code to a client one of two ways:

  1. Prepare a list of promo codes in a Google Sheet, train salebot to find an available code, give it to a client and then mark it as an issued one in the doc;

  2. Train Salebot to generate it by following certain rules, give it to the client and then mark it in the doc.

You can check the codes’ validity with the use of Google Sheets and its API requests.

You can learn all about these processes below.

How to check the promo code from Google Sheets

If you have an objective to limit access to the bot or special offers, you can use the function of checking promo codes.

Prepare a Google Sheet in which one column will be a list of your promo codes. Set the access setting to “Anyone with this link can edit”. How to do this, read in

This is how the function works: A client pastes their promo code into the bot, the function checks whether or not the code is in the column that you created. If the code is found, then a line “Promo code was used” is added to the neighboring cell and then the function returns this reply:

{“status”: ‘’0’’}

Function address: https://store.salebot.ai/function/check-promocode

To check the code you need to send these parameters from the block:

{"id":"1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI", "promocode": "#{question}", "col_number": "1"}

id is the id of your Google Sheet where you put your codes. You can get it from the link to your doc. The doc itself has to be open for editing to anyone who has the link.

If the promo codes are situated in a separate sheet, then you need to use the parameter list_name, in which you have to place its name, for example:

{"id":"1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI", "promocode": "#{question}", "col_number": "1", "list_name": "Sheet name"}

The next parameter is the promo code that the client applies.

col_number - is the number of the column that holds the codes

{“status”: ‘’1’’}, after that you can’t apply the code for the second time

If the function doesn’t find the promo code in the sheet or it’s been used already, then it replies with

{“status”: ‘’0’’}

If you’re wondering how to use this and where to place this, look at the screenshot below

#{custom_answer} - the answer from the server that’s mentioned in the tab “URL request”

Use this variable in the answer tab to see what’s located in it. If you’ve done everything correctly, then you can save status->status, and in the arrows in the tab “Variable for comparison” set the values to "status == 0" (and reply to the user that the code has been used) or "status == 1" (the user moves further). The example is below

How to give a promo code from Google Sheets

You will get a link similar to this:

https://docs.google.com/spreadsheets/d/1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI/edit?usp=sharing

The bold text here is the id of your page. You’ll need it later.

Create a block on Salebot and in its settings paste these parameters:

Request type: POST-json

URL request: https://store.salebot.ai/function/findcell

Stored values:

data->Promo code; cell_number|row ->line;

JSON parameters:

{"id": "1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI", "find": "Available", "col": 2, "return": 1} where you need to place your own page id instead of 1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI

Create a block below and in the connection settings click on “Time settings”. In the opened section in the tab “Delay before answer” type -1, so the move happens as fast as possible.

In the new block, set the parameters mentioned below.

To show the client their code, type #{Promo_code}

Request type: POST-json

URL request: https://store.salebot.ai/function/gsheets

JSON parameters:

{"id": "1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI", "write":{"b#{line}":"Used"}} where you need to place your own page id instead of 1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI

How to generate a promo code with the help of Salebot

If the promo code can be created with certain rules, then you can generate them right in Salebot and write them down in Google Sheets for later checking.

We’ll need variables for this. For example, to generate a unique promo code, we can use the variable #{client_id}. It’s a variable in Salebot that indicates your client’s number in the system.

In the block’s settings Advanced -> Calculator write down: Promocode = promo#{client_id} In the field "Answer" paste #{Promo_code} In my case, you’ll get a promo code promo1330882.

If you want to add a more random aspect to your code, then you can add the call of the function random() Promocode = 'promo' + '#{client_id}' + random(0,10) In this case, it adds 1 random number in the end

Now let’s paste it to our sheet of codes.

To begin, you need to create a blank Google Sheet doc. The same access settings of “Anyone on the Internet with this link can edit”. Type the words Promo codes in the A1 cell

If the first cell is empty, then the function won’t work, so don’t forget to fill it in

You will get a link similar to this:

https://docs.google.com/spreadsheets/d/1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI/edit?usp=sharing

The bold text here is the id of your page. You’ll need it later.

Now let’s get back to Salebot and continue working on your block with the promo code

Request type: POST-json

URL request: https://store.salebot.ai/function/gsheets

JSON parameters:

{"id": "1sl15vKFjo5TFD98GnVjF3AlLtdhr85-AkEjoeJkgDxE", "mapping":{"a":"#{Promo_code}"}} Where you need to place your own page id instead of 1HfnHDbJYTGz68-3KWIcRISncTmdEn8v7Vf_OKvDMrOI

You have to create something like this:

Prepare your sheet like in the image below. Promo codes in the first column and in the second a mark “Available”. Set up access settings to “Anyone on the Internet with this link can edit”. How to do this, read in

this article
this article
How to check the promo code from Google Sheets
How to give a promo code from Google Sheets
How to generate a promo code with the help of Salebot