smswhatsappservice/send_otp.py
vickytechkey 590f9c1999
Some checks failed
Deploy Beta (NATIVE) / deploy (push) Failing after 37s
Initial commit
2026-09-20 18:57:37 +05:30

26 lines
818 B
Python

import requests
import json
# Your credentials and details
authkey = "563180T1AlanJm6aa942b9P1" # Extracted from tokenAuth in CERD.TXT
mobile = "919600494039" # Mobile number with country code (assuming India 91)
template_id = "YOUR_TEMPLATE_ID" # You must replace this with your actual Template ID from MSG91 dashboard
url = f"https://control.msg91.com/api/v5/otp?template_id={template_id}&mobile={mobile}&authkey={authkey}"
payload = json.dumps({
# Add any custom variables defined in your template here
# "Param1": "value1",
# "company_name": "MyCompany"
})
headers = {
'Content-Type': 'application/json'
}
print(f"Sending OTP to {mobile}...")
response = requests.request("POST", url, headers=headers, data=payload)
print("Status Code:", response.status_code)
print("Response Body:", response.text)