Add WhatsApp Number

POST Method

The Add WhatsApp Number API is used to add a new WhatsApp number to the user's account.

You can add the following WhatsApp number details:

  • Display Name
  • WA Number
  • Incoming URL (“incoming_url“)
  • Image (display_image)
  • Address (address)
  • Business Description (business_description)
  • Business Category - Exact String match accepted Case insensitive (business_catregory)
  • Contact Email (contact_email)
  • Website (website)

📘

Note:

  • The Display Name and the WhatsApp Number are the mandatory fields.
  • The Incoming URL (“incoming_url“), Image (display_image), Address (address), Business Description (business_description), Business Category - Exact String match accepted Case insensitive (business_catregory), Contact Email (contact_email), and Website (website) are optional fields.

Base URL:

https://api.kaleyra.io/v1/

To add WhatsApp number, perform the following steps:

1. Signup or Login to Kaleyra.io and create your API key.

Before you get started, sign up for a Kaleyra.io account for free and create an API key.

📘

Note:

After you sign up, your account will be on the trial version. You must complete the KYC to access all the features in Kaleyra.io.

Prerequisite:

  • A WhatsApp verified and approved profile.

2. API command to Add WhatsApp Number.

Request Format - POST

To add a WhatsApp number, use the /Whatsapp/number endpoints.

curl --location --request POST '{url}/v1/{SID}/whatsapp/number' \
--header 'api-key: <API_KEY>' \
--header 'Content-Type: <CONTENT_TYPE>' \
--data-raw '{
    "display_name":<DISPLAY_NAME>,
    "wa_number":"+13236xxxxx7",
    "address":<MY_ADDRESS>,
    "incoming_url":<INCOMING_URL>,
    "display_image":<DISPLAY_FILE>,
    "business_description": <BUSINESS_DESCRIPTION>,
    "business_category": <BUSINESS_CATEGORY>,
    "contact_email":<CONTACT_EMAIL>,
    "website": <WEBSITE>
}'

Parameters and Variables

The following table displays the parameter and variables used:

Parameter

Variable

Description

Example

Mandatory

SID

String

Account SID (Security Identifier). Generated by Kaleyra.io while creating an API key.

HXXXXXXX071US

True

API_KEY

String

Your API Key generated by Kaleyra.io.

Ac4XXXXX21f

True

CONTENT_TYPE

Alphanumeric

Indicates the format of the content the API will be processing.

application/JSON

True

DISPLAY_NAME

String

Specifies the WhatsApp number display name.

Test

True

WA_NUMBER

String

Specifies the registered WhatsApp number in E164 format.

+13236xxxxx7

True

ADDRESS

String

Specifies the registered WhatsApp number address.

#567, "Test", 2nd Phase, Bangalore.

False

INCOMMING_URL

String

Specifies the URL for which you receive the incoming callback.

https://{your_company_domain}/{incoming_endpoint}

False

DISPLAY_IMAGE

String

Specifies the WhatsApp display image to be shown to end customers.

https://s3.ap-south-1.amazonaws.com/stage-hexa/docs/1620380334flower-729512__340.jpg

False

BUSINESS_DESCRIPTION

String

Specifies the registered WhatsApp number business description.

Brief description about the Company.

False

BUSINESS CATEGORY

String

Specifies the registered WhatsApp number business category.
The following are the values accepted for Business Category:
a) Automotive
b) Beauty, Spa, and Salon
c) Clothing and Apparel
d) Education
e)Entertainment
f) Event Planning and Service
g) Finance and Banking
h) Food and Grocery
i) Public Service
j) Hotel and Lodging
k) Medical and Health
l) Non-profit
m)Professional Services
n) Shopping and Retail
o) Travel and Transportation
p) Restaurant
q) Other

Education

False

CONTACT EMAIL

String

Specifies the registered WhatsApp number contact Email.

[email protected]

False

WEBSITE

String

Specifies the business website.

https://www.kaleyra.com

False

Response Format

Success Format

This section provides you the successful JSON response format.

HTTP Response: 
{
    "code": "I102",
    "message": "Phone Number created successfully.",
    "data": [
        {
            "company_id": "ZXXX932d",
            "phone_number": "+13236xxxxx7",
            "country": "ahmedabad local, gujarat",
            "iso_code": "IN",
            "status": 2,
            "description": "business description",
            "address": "my address",
            "email": "[email protected]",
            "name": "xyz",
            "website": [
                "https://google.com/testing"
            ],
            "incoming_url": <url>,
            "category": "Medical and Health",
            "profile_image": <file_url>,
            "meta_value": null,
            "created_by": "125XXX2647",
            "created_at": 162XXX5490,
            "id": 102,
            "notFirstRequest": 1
        }
    ],
    "error": {}
}

Failure Response

The display_name and wa_number is a mandatory field and cannot be empty. Pass the wa_number and display_name key and its value.

{
    "code": "E947",
    "message": "Failed to create new WA number.",
    "data": [],
    "error": {
        "code": "E413",
        "type": "VALIDATION_ERROR",
        "parameter": "display_name,wa_number",
        "message": "display_name is required and cannot be empty.,wa_number field is required and cannot be empty.",
        "reference": ""
    }
}

The business_catregory value is invalid. Pass the accepted categories.

{
    "code": "E947",
    "message": "Failed to create new WA number.",
    "data": [],
    "error": {
        "code": "E413",
        "type": "VALIDATION_ERROR",
        "parameter": "business_category",
        "message": "business_catregory value is invalid. Valid values are: Automotive,Beauty, Spa, and Salon,Clothing and Apparel,Education,Entertainment,Event Planning and Service,Finance and Banking,Food and Grocery,Public Service,Hotel and Lodging,Medical and Health,Non-profit,Professional Services,Shopping and Retail,Travel and Transportation,Restaurant,Other",
        "reference": ""
    }
}

The display_image cannot be empty. Pass the appropriate value, else do not pass the key.

{
    "error": {
        "code": "E962",
        "type": "VALIDATION_ERROR",
        "parameter": "display_image",
        "message": "display_image cannot be empty",
        "reference": ""
    }
}

Sample Request

The following code is a sample request:

curl --location --request POST '{url}/v1/{sid}/whatsapp/number' \
--header 'api-key: {api-key}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "display_name":"xyz",
    "wa_number":"+13236xxxxx7",
    "address":"my address",
    "incoming_url":<url>,
    "display_image":<file_url>,
    "business_description":"business description",
    "business_category":"Medical and Health",
    "contact_email":"[email protected]",
    "website":"https://google.com/testing"
}'

Error Codes

The following table provides information about the error codes you would receive when executing the Add WhatsApp Number API.

Error Code

Description

E413

display_name and wa_number field is required and cannot be empty.

E962

display_image cannot be empty.


Did this page help you?