WhatsApp API uploadTemplateFile - nxtele/nxcloud-doc-en GitHub Wiki

Upload Template Example File

To upload media files for configuring template examples. Media files are uploaded using HTTP multipart/form-data.

  • URL: https://api2.nxcloud.com/api/wa/uploadTemplateFile
  • Method: POST
  • Content-Type: multipart/form-data
  • Requires authentication: Yes

Authentication Mechanism

Please refer to the following link for authentication rules: API Interface Call Convention

Request Parameters

Header Parameters:

Parameter Name Type Required Example Description
accessKey String Yes fmexxx3ki User identity identifier
ts String Yes 1655710885431 Current timestamp of the request (in milliseconds). The maximum allowed time difference is 60 seconds on the server side.
bizType String Yes 2 WhatsApp business type, fixed value "2"
action String Yes uploadTemplateFile WhatsApp business operation, fixed value "uploadTemplateFile"
sign String Yes 6e95xxx826 API input parameter signature, signature algorithm

Body Parameters:

Parameter Name Type Required Example Description
business_phone String Yes 86158xxx1795 Merchant's WhatsApp number list, including country code, e.g., 185xxx99
messaging_product String Yes whatsapp Channel for sending messages, must be "whatsapp" when sending WhatsApp messages
file file Yes Local directory where the file is stored. For example: "@/local/path/file.jpg"
type String Yes image/jpeg File type Supported: application/pdf, video/mp4, image/jpeg, image/png, image/jpg

Request Example

Body (multipart/form-data) parameters:

messaging_product = whatsapp
business_phone = 185xxx99
type = image/jpeg
file = 

Response Parameters

Parameter Name Type Description
code Integer Result code
data JsonObject Request result
message String Request result description
  • data object parameters:
Parameter Name Type Description
id String Unique file ID generated by the system

Response Example

Successful Example

{
    "code": 0,
    "data": {
        "id": "4:Pz8xxxW8"
    },
    "message": "Request successful"
}

Failed Example

{
    "code": -1,
    "message": "Request failed",
    "data": null
}

Response Code Explanation

code message Solution
0 Request successful
-1 Request failed Please contact technical support to troubleshoot the issue
1000~100X Authentication issue Refer to the API authentication section for details
9000 Parameter exception Missing parameters, please check the required parameters
9001 System business error Please contact technical support to troubleshoot the issue
9002 Merchant phone number error Please confirm whether the merchant number belongs to a WhatsApp number
9006 The WhatsApp number is not bound to the application Please contact the business personnel to handle the binding operation between the application and the phone number