Using the "External Request" block, you can contact an external service, which will return a random number from a specified range in response. And the received number can be written to the subscriber's custom field for further use in the bot.

Setting up an "External Request"

1. In the bot designer, add a step of the “action” type and select “External request” in it

2. In the external request settings:

  • Specify the GET .
  • In the "URL" field, paste the link: https://www.randomnumberapi.com/api/v1.0/random?min=1&max=100&count=1.
    • min and max parameters in the request address specify the lower and upper limits of the range within which the generated random number must lie.
    • count parameter specifies the number of random numbers to generate at a time.
    • In our example, the response will be one (count=1) random number in the range from 1 to 100 (min=1, max=100).
  • Set up response matching.
    • In the JSON Path field specify $.0
    • In the right column, select the custom field into which you want to write the resulting random value.
    • In our example, the resulting random number will be automatically saved in the custom field "Parameter".

After all the settings, it should look like this:

IMPORTANT! To make sure everything works correctly, test the configured request. To do this, on the "Response" tab, click the Send request .

If everything is set up correctly and the external service is working, a green message “200 OK” will appear on the right side of the tab, and the received random number will be displayed in the “Response Body” subsection.

Done! Now you can use random numbers in your bots.

You can learn more about the service used to generate random numbers here .

Important: Sometimes the www.randomnumberapi.com/ may be temporarily unavailable.

You can use the service https://www.randomnumberapi.com/ as per the example above.

  • In the "URL" field, paste the link https://api.rand.by/v1/integer?min=1&max=100&count=1 . Here, the response matching will be slightly different.
  • In the JSON Path field, specify $.items.0

 


If you have not found the answer to your question, ask us in the chat inside your account or write to BotHelpSupportBot or to hello@bothelp.io

Get 14 days of full functionality of the platform for creating mailings, autofunnels and chatbots BotHelp.

Get 14 days free

Was this article helpful?

Thanks for your feedback!