Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from twilio.rest import Client
- import random
- def send_otp(phone_number):
- otp = str(random.randint(100000, 999999)) # Generate a 6-digit OTP
- client = Client("TWILIO_ACCOUNT_SID", "TWILIO_AUTH_TOKEN")
- message = client.messages.create(
- body=f"Your OTP code for door access is {otp}",
- from_="YOUR_TWILIO_PHONE_NUMBER",
- to=phone_number
- )
- return otp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement