cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Generating a 6-digit random code in Workato

shaked
Deputy Chef I
Deputy Chef I

Hi everyone,
I need to generate a random 6-digit code (OTP style) in a recipe.

Is there a way to do this using a Workato formula?
If not, what is the recommended/best practice way to implement it?

Thanks in advance!

1 REPLY 1

rajeshjanapati
Executive Chef I
Executive Chef I

Hi @shaked,
I believe there is no way to generate a code with any FORMULA, we need to go with any scripting (Python, Ruby, JS). Please check the below output which i got from Python code.

Screenshot 2026-04-29 064600.pngScreenshot 2026-04-29 065114.png

import random

def main(input):
  otp = random.randint(100000, 999999)
  return {"otp": otp}
 

Thanks,
J Rajesh Kumar.