Using the “External Request” block, you can connect to an external service that returns a random number within a specified range. The received number can then be saved in a subscriber’s custom field for later use in the bot.

Setting up the “External Request”

1. In the bot builder, add a step of the “Action” type and select “External Request”.

2. In the external request settings:

  • Set the request type to GET.

  • In the “URL” field, enter:
    https://www.randomnumberapi.com/api/v1.0/random?min=1&max=100&count=1

  • The min and max parameters define the lower and upper bounds of the range for the random number.

  • The count parameter specifies how many random numbers to generate.

  • In this example, one random number between 1 and 100 will be returned.

Configure response mapping

  • In the JSON Path field, enter $.0

  • In the right column, select the custom field where the random value should be saved.

  • In this example, the random number will be saved to the custom field “Parameter”.

After completing the setup, it should look like this:

IMPORTANT: To verify that everything works correctly, test the configured request. On the “Response” tab, click “Send Request”.

If everything is set up correctly and the external service is working, a green message “200 OK” will appear on the right, and the returned random number will be displayed under “Response Body”.

That’s it! You can now use random numbers in your bots.

Learn more about the service used to generate random numbers here.

Note: The service www.randomnumberapi.com may occasionally be unavailable.

You can also use the service https://api.rand.by/v1/integer?min=1&max=100&count=1 as an alternative.

In this case, the response mapping will be slightly different:

  • In the URL field, enter: https://api.rand.by/v1/integer?min=1&max=100&count=1

  • In the JSON Path field, enter $.items.0


If you did not find the answer to your question, feel free to contact us in the chat inside your dashboard, message us on Telegram at @BotHelpSupportBot, or email us at hello@bothelp.io.

Get 14 Days of Full Access to the Platform

Enjoy the full functionality of the BotHelp platform for creating broadcasts, automated funnels, and chatbots — free for 14 days.

Get 14 Days Free

Была ли статья полезна?

Спасибо за обратную связь!