Skip to main content

Overview

To align with industry standards, Awaaz.De uses REST APIs with simple and flexible architecture leading to easier implementation and integration. Partners need to integrate two APIs:
  1. Login API: JWT-based authentication that allows partners to make a login request once and send multiple message requests using the same token. Partners only need to request login when the token expires. JWT access tokens are valid for 1 hour.
  2. Message API: Used to schedule automated voice call messages to customers.

Demo Code

Awaaz.De’s API integration demo code is available on GitHub and explains how to authenticate via the Login API, obtain a token, and send automated voice calls using the Message API. Demo code is available in:

Login API

  • Contact our team to set up your account.
  • After account creation, you’ll receive key details like the tenant name, which you’ll need to include in every API request.

Endpoint

POST https://api.awaaz.de/{tenant}/v1/account/login

Request Body

{
  "email": "[email protected]",
  "password": "string"
}

Request Parameters

ParameterTypeDescription
emailstringUser email for login
passwordstringUser password for login

Success Response

Status Code: 200 OK
{
  "token": "<JWT token which needs to be passed with Message API>",
  "user": {
    // Other user details
  }
}
The JWT token returned is active for 1 hour. This token must be passed with the Message API to successfully authenticate message requests.

Error Response

Status Code: 401 Unauthorized
{
  "non_field_errors": [
    "Unable to log in with provided credentials."
  ]
}
This error indicates an issue with the provided credentials.

Message API

Endpoint

POST https://api.awaaz.de/{tenant}/v1/xact/message/create_bulk

Authentication

Include the JWT token obtained from the Login API in the request headers:
Authorization: Bearer <your-jwt-token>

Request Body

{
  "transform_using_template": true,
  "data": [
    {
      "phone_number": "9099830084",
      "language": "Oriya",
      "day_of_month": "5",
      "installment_amount": "100",
      "month": "may",
      "template": "Payment Confirmation-Late Payers-short",
      "number_of_days": "2",
      "tags": ["clientID", "LAN", "group ID", "state", "branchname"]
    },
    {
      "phone_number": "9805830084",
      "language": "Oriya",
      "day_of_month": "5",
      "installment_amount": "100",
      "month": "may",
      "template": "Payment Confirmation-Late Payers-short",
      "number_of_days": "2",
      "tags": ["clientID", "LAN", "group ID", "state", "branchname"]
    }
  ]
}
Note: Request data should be customized based on your template and language requirements.

Request Parameters

ParameterTypeRequiredDescription
transform_using_templatebooleanYesEnable template-based transformation
dataarrayYesArray of message objects to be scheduled
instant_messagebooleanNoIndicates whether the message should be sent immediately. You can schedule up to 5 messages with this flag.
Following parameters are part of data field:
ParameterTypeRequiredDescription
phone_numberstringYesPhone number in international format (e.g., +9194XXXXXXXX)
languagestringYesLanguage to be used for the voice call
templatestringYesTemplate name (or ID) indicating the script for the call
tagsarrayNoList of tags or additional metadata for the message
Additional parameters like day_of_month, installment_amount, month, and number_of_days are template-specific and should be included based on your template requirements.

Rate Limits

  • 5,000 messages per request: approximately 30 seconds to process
  • 10,000 messages per request: approximately 45-50 seconds to process

Success Response

Status Code: 201 Created
[
  {
    "phone_number": "9099830084",
    "status": "created",
    "language": "Oriya",
    "templatelanguage": 87,
    "day_of_month": "5",
    "installment_amount": 100,
    "month": 5,
    "template": "Payment Confirmation-Late Payers-short",
    "number_of_days": 2,
    "id": 39937283
  },
  {
    "phone_number": "9805830084",
    "status": "created",
    "language": "Oriya",
    "templatelanguage": 87,
    "day_of_month": "5",
    "installment_amount": 100,
    "month": 5,
    "template": "Payment Confirmation-Late Payers-short",
    "number_of_days": 2,
    "id": 39937284
  }
]
All messages with "status": "created" have been successfully scheduled.

Error Response

Status Code: 201 Created (partial success)
[
  {
    "phone_number": "9805830084",
    "status": "created",
    "language": "Oriya",
    "templatelanguage": 87,
    "day_of_month": "5",
    "installment_amount": 100,
    "month": 5,
    "template": "Payment Confirmation-Late Payers-short",
    "number_of_days": 2,
    "id": 39937287
  },
  {
    "phone_number": "909930084",
    "status": "invalid",
    "language": "Oriya",
    "templatelanguage": 87,
    "day_of_month": "5",
    "installment_amount": 100,
    "month": 5,
    "template": "Payment Confirmation-Late Payers-short",
    "error": "phone_number: Invalid input provided",
    "number_of_days": 2
  }
]
Messages with "status": "invalid" contain errors. The error field provides details about what went wrong.

Example Request and Response

Request

{
  "transform_using_template": true,
  "data": [
    {
      "phone_number": "9099830084",
      "language": "Oriya",
      "day_of_month": "5",
      "installment_amount": "100",
      "month": "may",
      "template": "Payment Confirmation-Late Payers-short",
      "number_of_days": "2",
      "tags": ["clientID", "LAN", "group ID", "state", "branchname"]
    },
    {
      "phone_number": "1234",
      "language": "Oriya",
      "day_of_month": "5",
      "installment_amount": "100",
      "month": "may",
      "template": "Payment Confirmation-Late Payers-short",
      "number_of_days": "2",
      "tags": ["clientID", "LAN", "group ID", "state", "branchname"]
    }
  ]
}

Response

[
  {
    "phone_number": "9099830084",
    "language": "Oriya",
    "day_of_month": "5",
    "installment_amount": "100",
    "month": "may",
    "template": "Payment Confirmation-Late Payers-short",
    "number_of_days": "2",
    "tags": ["clientID", "LAN", "group ID", "state", "branchname"],
    "templatelanguage": 87,
    "id": 39,
    "status": "created"
  },
  {
    "phone_number": "1234",
    "language": "Oriya",
    "day_of_month": "5",
    "installment_amount": "100",
    "month": "may",
    "template": "Payment Confirmation-Late Payers-short",
    "number_of_days": "2",
    "tags": ["clientID", "LAN", "group ID", "state", "branchname"],
    "templatelanguage": 87,
    "error": "phone_number: Invalid input provided",
    "status": "invalid"
  }
]
The first message was successfully created (status: created), while the second message failed due to an invalid phone number (status: invalid).

Error Handling

HTTP Status Codes

Status CodeDescriptionAction
200The request has succeededN/A
201The request has succeeded and a new message has been createdN/A
400Bad Request - Invalid or malformed dataVerify request format matches API documentation. Check the error message for specific data issues
401Unauthorized - User is not authenticatedPlease log in using the Login API
403Forbidden - Token expiredPlease re-login to obtain a new JWT token
404Not Found - URL is not recognizedVerify the API endpoint URL is correct
502Bad GatewayRetry the operation after some time. If issue persists after multiple retries, contact Awaaz.De
504Gateway TimeoutRetry the operation after some time. If issue persists after multiple retries, contact Awaaz.De
500-599Server ErrorWe monitor our systems for such errors. If not resolved within 24 hours, please contact Awaaz.De

Common Error Scenarios

Invalid Credentials

{
  "non_field_errors": [
    "Unable to log in with provided credentials."
  ]
}
Solution: Verify email and password are correct.

Invalid Phone Number

{
  "error": "phone_number: Invalid input provided",
  "status": "invalid"
}
Solution: Ensure phone number is in valid international format (e.g., +9194XXXXXXXX).

Expired Token

Status Code: 403 Forbidden Solution: Re-authenticate using the Login API to obtain a new JWT token.

Best Practices

  1. Token Management: Cache the JWT token and reuse it for multiple requests within the 1-hour validity period. Only request a new token when the current one expires.
  2. Batch Processing: Group messages in batches of up to 10,000 for optimal performance.
  3. Error Handling: Always check the status field in the response for each message. Messages can fail individually while others succeed.
  4. Phone Number Format: Always use international format with country code (e.g., +91 for India).
  5. Retry Logic: Implement exponential backoff for 502, 504, and 5xx errors.
  6. Rate Limiting: Be mindful of processing times when sending large batches of messages.

Support

For technical support or questions about API integration, please contact: