Verify API

Verify API

The Verify API allows you to implement two-factor authentication by verifying mobile phone numbers.

This functionality is beneficial for the following purposes:

  • Protection against spam: Preventing spammers from creating multiple accounts.
  • Monitoring suspicious activity: Verifying ownership of a phone number to detect any unusual behavior.
  • Ensuring effective communication: Having the correct phone number on record to reach users reliably.

To initiate the verification process for a recipient, simply create a new Verify object through the API. We will handle the generation of a token and ensure that the verification message is successfully delivered to the user’s mobile device.

API Endpoint

http://portal.thundersms.com/api/v2/

Note: Few elements in the endpoint may change from service to service.

POST

{endpoint}verify/send

Payload

{
  "channels": [
    {
      "name": "whatsapp",
      "from": "91901912xxx",
      "recipient": {
        "to": "9189195xxxx"
      },
      "order": 0,
      "wait": 60
    },
    {
      "name": "sms",
      "from": "91901912xxx",
      "recipient": {
        "to": "9189195xxxx"
      },
      "order": 1,
      "wait": 60
    },
    {
      "name": "voice",
      "from": "91806828XXX",
      "recipient": {
        "to": "9189195xxxx"
      },
      "flow_id": "5876",
      "language": "en_US",
      "order": 2,
      "wait": 60
    },
    {
      "name": "viber",
      "from": "adef759b-fbb3-4452-9aed-518d1cxxxxx",
      "recipient": {
        "to": "9189195xxxx"
      },
      "ttl": 30,
      "order": 3,
      "wait": 60
    }
  ],
  "payload": {
    "length": 5,
    "timeout": 60,
    "token": "12345",
    "ip_address": "192.168.*.*"
  }
}

PARAMETERS

Name Type Description
foreign_id string A client reference
timeout int The verification code expiry time in seconds. Default: 120
length string The number of characters in the verification code. Must be between 4 and 10. Default: 6
ip_address string The IP address used by your user when they entered the verification code.

OPTIONAL PARAMETERS

Name Description
template Custom Message for sending otp if message object not specifed in verify config. use {token} in content for replacing otp.
order Order of channels [starts from 0]. It will trigger channels in specified order.
wait Waiting time [in seconds] for triggering otp via alternate channel if first channel not successful. Default 30 seconds
language Language in which TTS should play
token Token length should be equal to defined length
ttl Time To Live(TTL) should be min 30 to max 1,209,600 seconds

Example Response

{
    "id": "bdd56db3-ecd3-4d20-8ab5-988bdc76795a",
    "status": "sent",
    "foreign_id": null,
    "created_at": "2023-12-05 08:24:48",
    "expire_at": "2023-12-05 08:26:48"
}