import sys
sys.path.append("../plivo-python")
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.verify_session.create(
            recipient='<destination number>',
            app_uuid='<verify application uuid>',
            channel='<sms/voice>',
            url='<callback url>',
            method='<callback method:post/get>'
            )

print(response)
{
    "api_id": "3335cb16-d297-4e00-a5e6-66d2bb03b323",
    "message": "Session initiated",
    "session_uuid": "8e712097-8090-4644-81e7-8f4265d8354e"
}

This API lets you send OTPs via Plivo’s SMS or Voice services.

API Endpoint

POST
https://api.plivo.com/v1/Account/{auth_id}/Verify/Session/

Arguments

app_uuid
string
optional

The UUID of the application you want to use for this session. Defaults to UUID of the default application for your account.

recipient
string
required

The phone number to which the message is to be delivered.

channel
string
optional

The channel you want to use for sending the code.

Allowed values:sms,voice
Defaults tosms

method
string
optional

The HTTP method to be used when calling the URL defined above.

Allowed values:GET,POST
Defaults toPOST

Url
string
optional

Set this parameter to the fully qualified URL to which status update callbacks for the session should be sent. Read more about the session attributes passed to this callback URL.

locale
string
optional

Set this parameter to determine the language you want to use. Defaults to ‘en’.

The locale value is obtained by combining language code in ISO 639-1 format and region code in ISO 3166-1 format (optional). For example: en_US, en, en_GB, es, fr_FR etc.

This feature is available upon request only. Raise a support ticket and provide the translations you want to use.

brand_name
string
optional

This is the brand name that users will see in their Verify messages. It replaces the string “$“ in the Verify template of your choice. It is relevant to the ‘Voice’ and ‘SMS’ channels.

Please note that passing a brand_name overrides the Brand Name configured in the Verify application.

app_hash
string
optional

Relevance: ‘SMS’ Channel and Android OS only

This is the text string that the SMS Retriever API will look for to match the received SMS OTP to your android application. Please refer to Google’s documentation on how to compute your app’s hash string. The “app_hash” will be appended at the end of your verification SMS body.

code_length
integer
optional

Valid Values: 4 to 8 (inclusive)
Set this parameter to override the default length of the code/OTP as defined in the configuration of the relevant Verify application.

Returns

Returns a JSON response containing the API request ID and session UUID.