Tutorial: Send OTP Message via API
Send OTP Message via API
Section titled “Send OTP Message via API”This tutorial will guide you through sending a One-Time Password (OTP) message using Contacta’s API.
Prerequisites
Section titled “Prerequisites”- A Contacta account
- Your API key
- The recipient’s phone number
1. Set Up Your API Key
Section titled “1. Set Up Your API Key”First, obtain your API key from your Contacta dashboard.
2. Prepare the API Request
Section titled “2. Prepare the API Request”You can send an OTP message by making a POST request to the Contacta API endpoint.
{ "msg": "Your otp code is [code], please don't share it with anyone.", "phone": "8100001234", "sender": "AWESOMEINC", "id": "my-external-id"}
Example Request (cURL)
Section titled “Example Request (cURL)”curl -X POST "https://api.example.com/v2/otp/send" -H "Accept: application/json" -H "Connection: keep-alive" -H "Content-Type: application/json" -H "Authorization: Basic <base64-encoded-credentials>" -d @payload.json