Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Cognitive Engagement Center/ API Reference/ Web Client Access Interface Reference/ Sending an MT WhatsApp Message (sendWhatsappMessage)

Sending an MT WhatsApp Message (sendWhatsappMessage)

Updated on 2023-09-27 GMT+08:00

Scenario

This interface is invoked to send an MT WhatsApp message.

Method

POST

URI

https://Domain name/apiaccess/rest/ccmessaging/omni/1/advanced (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Authorization

String

Yes

Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.)

2

x-app-key

String

Yes

App key, which is the user ID and is configured on the API Fabric

3

Content-Type

String

Yes

Content type

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

scenarioKey

String

No

Unique key of the solution that will be used to send messages. If this field is not set, the default solution is used.

The AICC does not send this field.

1.2

bulkId

String

Yes

Unique request ID. Multiple IDs will be received only when the message is sent to multiple destination addresses.

1.3

destinations

Array [Object]

Yes

List of message recipients

1.3.1

messageId

String

Yes

Unique ID of a sent message

1.3.2

to

Object

Yes

Message destination address

1.3.2.1

phoneNumber

String

Yes

Destination phone number. The value must be in the international number format, for example, 41793026727.

1.4

whatsApp

whatsApp

Yes

Encapsulated whatsApp object

1.5

sendAt

String

No

Date and time when the message needs to be sent. This parameter is used for scheduled OMNI messaging. The first message in the OMNI flow is not sent immediately, but will be sent at the scheduled time.

Table 3 whatsApp parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

text

String

No

Text of the message to be sent

1.2

imageUrl

String

No

URL of the image sent in the WhatsApp message. The value can contain a maximum of 2048 characters. The image type must be JPG, JPEG, or PNG. The image size cannot exceed 2 MB.

1.3

audioUrl

String

No

URL of the audio file sent in the WhatsApp message. The value can contain a maximum of 2048 characters. The audio type must be AAC. The audio size cannot exceed 2 MB.

1.4

videoUrl

String

No

URL of the video sent in the WhatsApp message. The value can contain a maximum of 2048 characters. The video type must be MP4. The video size cannot exceed 10 MB.

1.5

locationName

String

No

Text of the message to be sent

The value contains a maximum of 1000 characters.

1.6

address

String

No

Address. This parameter is optional.

The value contains a maximum of 1000 characters.

1.7

longitude

Number

No

Longitude. The value ranges from –180 to 180.

1.8

latitude

Number

No

Latitude. The value ranges from –90 to 90.

1.9

templateName

String

No

Template name

1.10

templateData

Array [String]

No

Template parameter values sorted by registration sequence in the template

1.11

language

String

No

Code of the language or locale to be used. The code must be the same as that used for registration in the template.

1.12

mediaTemplateData

mediaTemplateData

No

Encapsulated mediaTemplateData object

Table 4 mediaTemplateData parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

header

HeaderObject

No

Media template type. This parameter is required for media templates with titles.

1.2

body

BodyObject

No

Media template body

1.3

buttons

Array [Object]

No

Media template buttons

Table 5 HeaderObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

textPlaceholder

String

No

Text placeholder. This parameter is required for templates with text titles.

1.2

imageUrl

String

No

Image URL. This parameter is required for templates with image titles. The image type must be JPG, JPEG, or PNG. The image size cannot exceed 2 MB.

1.3

videoUrl

String

No

Video URL. This parameter is required for templates with video titles. The video type must be MP4. The video size cannot exceed 10 MB.

1.4

latitude

Number

No

Latitude. The value ranges from –90 to 90. This parameter is required for templates with location titles.

1.5

longitude

Number

No

Longitude. The value ranges from –180 to 180. This parameter is required for templates with location titles.

Table 6 BodyObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

placeholders

Array [String]

No

Media template body placeholders. The value cannot be null, but can be an empty array. Values within the array cannot be null or empty.

Table 7 ButtonObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

urlPlaceholder

String

No

Date and time when the message needs to be sent. This parameter is used for scheduled OMNI messaging. The first message in the OMNI flow is not sent immediately, but will be sent at the scheduled time.

1.2

quickReplyPayload

String

No

Quick reply payload. This parameter is required for the quick reply button.

Table 8 destinations parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

messageId

String

Yes

Unique ID of a sent message

1.2

to

toObject

Yes

Message destination address

Table 9 MessageObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

to

toObject

No

Message destination address

1.2

status

StatusObject

No

Message status. The message states include successfully sent, not sent, passed, not passed, and waiting for passing.

1.3

messageId

String

No

Unique ID of a sent message

Table 10 toObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

phoneNumber

String

Yes

Destination phone number. The value must be in the international number format, for example, 41793026727.

Table 11 StatusObject parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

groupName

String

Yes

Status group name

1.2

id

Integer

Yes

Status ID

1.3

groupId

Integer

Yes

Status group ID

1.4

name

String

Yes

Status name

1.5

action

String

No

Action to be taken to eliminate errors

1.6

description

String

Yes

Readable status description

Response Description

  • Status code: 200
    Table 12 Response body parameters

    No.

    Parameter

    Type

    Mandatory or Not

    Description

    1.1

    messages

    Array [Object]

    Yes

    Array of sent message objects. Each message corresponds to an object.

    1.1.1

    to

    Object

    Yes

    Message destination address

    1.1.1.1

    phoneNumber

    String

    Yes

    Destination phone number. The value must be in the international number format, for example, 41793026727.

    1.1.2

    status

    Object

    Yes

    Status object

    1.1.2.1

    groupId

    Number

    Yes

    Status group ID

    1.1.2.2

    groupName

    String

    Yes

    Status group name

    1.1.2.3

    id

    Number

    Yes

    Status ID

    1.1.2.4

    name

    String

    Yes

    Status name

    1.1.2.5

    description

    String

    Yes

    Readable status description

    1.1.2.6

    action

    String

    No

    Action to be taken to eliminate errors

    1.1.3

    messageId

    String

    Yes

    Unique ID of a sent message

    1.2

    bulkId

    String

    Yes

    Unique request ID

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Incorrect request. Check the values of parameters in the request.

Error Codes

None

Example

  • Scenario: OAuth authentication is supported when WhatsApp sends a template message.

    URL: successful request message

    Request header:

    {    "x-app-key": "268e19b9-aae6-488a-bec6-5c9a67692946",    "Authorization": "Bearer 2febd549********************b9daff1",    "Content-Type": "application/json"}

    Request parameters:

    {
        "bulkId": "2853BC8B21D23F473AB9AE41B75F34FC18D322B91B01F60FAF206ACEBA9EF7BD",
        "whatsApp": {
            "templateName": "1",
            "templateData": [],
            "language": "zh_CN"
        },
        "destinations": [
            {
                "messageId": "46dbab11-f9cc-4d32-852b-cbba988b7d08",
                "to": {
                    "phoneNumber": "155****8467"
                }
            }
        ]
    }

    Response parameters:

    {
        "messages": [
            {
                "messageId": "10011",
                "to": {
                    "phoneNumber": "173****6067"
                },
                "status": {
                    "groupName": "send-test",
                    "groupId": 113,
                    "name": "sendMessage",
                    "description": "description",
                    "id": 1
                }
            }
        ],
        "bulkId": "20221025"
    }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback