Updated on 2025-11-13 GMT+08:00

Receiving and Processing MO Messages Sent on Twilio

Function

This interface is invoked to receive and process MO messages sent on Twilio.

Usage Description

Prerequisites: The WhatsApp channel configuration has been created and the service provider has been set to Twilio.

Interface Authentication

This authentication mode is used for WhatsApp access through the Twilio integrator.

Instructions:

In the AICC, the webhook user and password are configured on the Channel Configuration page.

After the WhatsAppAdapter interface is invoked, the request header generates a signature based on the webhook user and password and adds the signature to the Authorization attribute.

Request Header Parameters

Table 1 Request header parameters

Parameter

Mandatory or Not

Type

Default Value

Description

Content-Type

Yes

String

None

The value is fixed at application/x-www-form-urlencoded.

Authorization

Yes

String

None

Twilio generates Authorization based on the webhook user and password, which is carried in a request sent to the AICC.

Interface Prototype

Table 2 Interface prototype description

Method

POST

URL

https://IP address:Port number/social/on/whatsapp/{whatsAppBsp}/message/{channelConfigId}

IP address:Port number indicates the IP address and port number of the NSLB exposed externally. {whatsAppBsp} indicates the integrator and is fixed at twilio in the twilio provider scenario. {channelConfigId} indicates the channel ID.

Request Body Parameters

Table 3 Request body parameters

Parameter

Mandatory or Not

Type

Description

From

Yes

String

Sender.

To

Yes

String

Receiver.

MessageSid

Yes

String

Message ID identifier.

MessageType

Yes

String

Message types: LOCATION, IMAGE, VEDIO, AUDIO, and TEXT.

MediaContentType0

No

String

When MessageType is set to IMAGE, VEDIO, or AUDIO, this parameter indicates the multimedia type, for example, image/jpeg and audio/aac.

MediaUrl0

No

String

When MessageType is set to IMAGE, VEDIO, or AUDIO, this parameter indicates the URL for downloading multimedia files.

Body

No

String

When MessageType is set to TEXT, the value of this parameter is the specific text content.

Address

No

String

When MessageType is set to LOCATION, the value of this parameter is the specific location address.

Label

No

String

When MessageType is set to LOCATION, the value of this parameter is the location name.

ProfileName

No

String

Nickname.

Latitude

No

String

When MessageType is set to LOCATION, the value of this parameter is the location latitude.

Longitude

No

String

When MessageType is set to LOCATION, the value of this parameter is the location longitude.

OriginalRepliedMessageSid

No

String

When a message is referenced, the value of this parameter is the ID identifier of the referenced message.

OriginalRepliedMessageSender

No

String

When a message is referenced, the value of this parameter is the sender of the referenced message.

Response Parameters

No response is returned when this interface is invoked.

Example

  • Request
    POST /social/on/whatsapp/twilio/message/****
    
    --header 'Authorization: basic ****'
    --header 'Content-Type: application/x-www-form-urlencoded'
    --data-urlencode 'ProfileName=****'
    --data-urlencode 'From=whatsapp:****'
    --data-urlencode 'To=whatsapp:****'
    --data-urlencode 'MessageType=****'
    --data-urlencode 'MessageSid=****'
    --data-urlencode 'Body=****'