Skip to main content
Solved

Promo Code Randomizer Error

  • May 23, 2025
  • 9 replies
  • 61 views

Grigor
  • Rising Conversationalist
  • 9 replies

Hey everyone,


I created a promo code randomizer that works well—until multiple users click the button at the same time. In that case, the bot sends the same promo code to two different users. Then, in the Google Sheet, it updates the username incorrectly. As a result, when the next person clicks the button, the bot skips a column and sends the following promo code instead.

For example, at 11:24, if two users click the "Get Promo" button at the same time, both will receive promo code #4. Then, at 11:25, when another user clicks the button, they’ll receive promo code #6 instead of #5.

You can see the issue in the attached screenshot. I've also attached the bot flow for reference.

Best answer by Gustavo Boregio

@Grigor change the order of your logic.

Increment the counter FIRST, then set a user field with the bot field’s value, and then do the Google Sheets actions.

Changing the order will make sure the error you’re having won’t happen anymore.

9 replies

Grigor
  • Author
  • Rising Conversationalist
  • 9 replies
  • May 23, 2025

 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • Answer
  • May 23, 2025

@Grigor change the order of your logic.

Increment the counter FIRST, then set a user field with the bot field’s value, and then do the Google Sheets actions.

Changing the order will make sure the error you’re having won’t happen anymore.


Grigor
  • Author
  • Rising Conversationalist
  • 9 replies
  • May 26, 2025

@Gustavo Boregio  hello. Thanks for the reply. 

As I understand your instructions correctly, I followed them, but unfortunately the same error still occurs. Please see the attached screenshots of the flow and the issue.

As you can see, it skipped row 7, sent the promo code from row 8 to two different users, and recorded only one Telegram username for it.

 


Grigor
  • Author
  • Rising Conversationalist
  • 9 replies
  • May 26, 2025

 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • May 26, 2025

@Grigor you forgot this part:

then set a user field with the bot field’s value.

Make sure to add this in your first action step - so each user will have a USER FIELD with the ID that corresponds to them.

This takes a ‘snapshot’ and avoids any issues you’re having with delays in the Google Sheets actions.


Grigor
  • Author
  • Rising Conversationalist
  • 9 replies
  • May 27, 2025

Dear ​@Gustavo Boregio , thanks for the help. But I am having the same problem again. 

 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • May 27, 2025

@Grigor on the Google Sheets actions, make sure you’re using the counter ‘Promo_Field_1’ to search for the ID, and not the bot field.

If that’s how you’re doing it, then there’s something weird going on with your setup.

If you need, I can jump on a (paid) troubleshooting call so we can find the root of the issue and help you fix it. You can book the call at https://gusboregio.com ;)


Grigor
  • Author
  • Rising Conversationalist
  • 9 replies
  • May 29, 2025

@Gustavo Boregio thanks, I did that way 

 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • May 29, 2025

Make Bot_Count a User Field, not a bot field.