訊息

/v1/messages

使用 messages 節點傳送文字訊息、媒體、聯絡人、地點、互動式訊息以及訊息範本給顧客。

如需瞭解可傳送的特定訊息類型,請參閱下列指南:文字訊息媒體訊息聯絡人和地點訊息互動式訊息訊息範本媒體訊息範本,以及互動式訊息範本

準備工作

必備資料:

  • 驗證身分並接收可供存取服務的驗證權杖。如需操作方法的詳細資訊,請參閱登入與驗證文件
  • 若要驗證您想要傳送訊息的目標 WhatsApp 帳號,並取得其 WhatsApp 用戶編號,請參閱「聯絡人」文件,瞭解操作方法。
  • 訊息應符合截斷控制服務要求。

從 v2.39 和以上版本開始,您不需要在傳送訊息之前呼叫聯絡人節點

限制

  • 支援以下訊息類型:文字、訊息範本、圖像、文件和音訊。
  • 一則簡訊的長度最多可以有 4096 個字元。

建立

無論是哪種訊息類型,您都會透過向 /messages 節點發出 POST 呼叫來傳送訊息。每個訊息類型(文字、影像等)的 JSON 訊息內文各不相同。

參數

以下是用於 /messages POST 要求的主要參數:

名稱說明(點擊左欄中的箭頭可查看支援的選項。)

audio

物件

type=audio 時為必要項目。

包含音訊的 media 物件

biz_opaque_callback_data

字串

選用項目。

任意字串,適用於追蹤。


例如,您可以在此欄位中傳遞訊息範本編號,以追蹤從您傳送第一則訊息開始的顧客歷程。您後續可以追蹤不同訊息範本類型的 ROI,以決定最有效的訊息範本類型。


任何已訂閱 WhatsApp Business 帳號之 messages Webhook 欄位的應用程式都可以取得此字串,因其包含在 Webhook 承戴的 statuses 物件內。


雲端 API 不會處理此欄位,僅將其作為已傳送/已送達/已讀取訊息 Webhooks 的一部分傳回。


最多 512 個字元。


僅適用於雲端 API

contacts

物件

type=contacts 時為必要項目。

contacts 物件

context

物件

如果回覆對話中的任何訊息,則為必要項目。

物件,其中包含您要回覆之上一則訊息的編號。例如:


{"message_id":"MESSAGE_ID"}


僅適用於雲端 API

document

物件

type=document 時為必要項目。

包含文件的 media 物件

hsm

物件

包含 hsm 物件v2.39 的內部部署 API 已停用此選項。請改用 template 物件。


僅適用於內部部署 API

image

物件

type=image 時為必要項目。

包含圖像的 media 物件

interactive

物件

type=interactive 時為必要項目。

interactive 物件。每個 interactive 物件的元件通常遵循一致的模式:headerbodyfooteraction

location

物件

type=location 時為必要項目。

location 物件

messaging_product

字串

必要項目

用於要求的傳訊服務。使用 "whatsapp"


僅適用於雲端 API

preview_url

布林值

type=text 時為必要項目。

允許在簡訊中預覽網址 - 請參閱在簡訊中傳送網址。如果訊息中不包含網址,此欄位為選用項目。值:false(預設值)、true


僅適用於內部部署 API。雲端 API 用戶可以使用與文字物件內之 preview_url 欄位相同的功能

recipient_type

字串

選用項目。

目前只能向個人傳送訊息。請將此值設為 individual


預設值:individual

status

字串

訊息的狀態。您可以使用此欄位將訊息標記為 read。相關資訊請參閱以下指南:


sticker

物件

type=sticker 時為必要項目。

包含貼圖的 media 物件


雲端 API:除了支援所有類型的入站貼圖外,亦支援靜態和動畫第三方出站貼圖。靜態貼圖必須為 512x512 像素,且大小不得超過 100 KB。動畫貼圖必須為 512x512 像素,且大小不得超過 500 KB。


內部部署 API:除了支援所有類型的入站貼圖外,僅支援靜態第三方出站貼圖。靜態貼圖必須為 512x512 像素,且大小不得超過 100 KB。不支援動畫貼圖。

template

物件

type=template 時為必要項目。

template 物件

text

物件

簡訊的必要項目。

text 物件

to

字串

必要項目。

接收訊息之顧客的 WhatsApp 編號或電話號碼。請參閱電話號碼格式


如有需要,內部部署 API 用戶可以呼叫 contacts 端點來取得此號碼。

type

字串

選用項目。

您想要傳送的訊息類型。如果省略,預設值為 text

文字物件

名稱說明

body

必要項目。

包含訊息的文字,可包含網址和加入格式。

媒體物件

若使用內部部署 API,當媒體成功透過 media 端點上傳至 WhatsApp Business 內部部署/參考資料用戶端時,系統會傳回媒體物件編號。

NameDescription

id

string

Required when type is audio, document, image, sticker, or video and you are not using a link.


The media object ID. Do not use this field when message type is set to text.

link

string

Required when type is audio, document, image, sticker, or video and you are not using an uploaded media ID (i.e. you are hosting the media asset on your public server).

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.


Do not use this field when message type is set to text.


Cloud API users only:


  • See Media HTTP Caching if you would like us to cache the media asset for future messages.
  • When we request the media asset from your server you must indicate the media's MIME type by including the Content-Type HTTP header. For example: Content-Type: video/mp4. See Supported Media Types for a list of supported media and their MIME types.

caption

string

Optional.


Media asset caption. Do not use with audio or sticker media.


On-Premises API users:

  • For v2.41.2 or newer, this field is is limited to 1024 characters.
  • Captions are currently not supported for document media.

filename

string

Optional.


Describes the filename for the specific document. Use only with document media.


The extension of the filename will specify what format the document is displayed as in WhatsApp.

provider

string

Optional. On-Premises API only.

This path is optionally used with a link when the HTTP/HTTPS link is not directly accessible and requires additional configurations like a bearer token. For information on configuring providers, see the Media Providers documentation.

聯絡人物件

contacts 內部,您可以巢狀方式包含下列物件:addressesemailsnameorgphoneurls陣列中會包含複數物件,如以下範例所示。

NameDescription

addresses

object

Optional.

Full contact address(es) formatted as an addresses object. The object can contain the following fields:

streetstringOptional. Street number and name.

citystringOptional. City name.

statestringOptional. State abbreviation.

zipstringOptional. ZIP code.

countrystringOptional. Full country name.

country_codestringOptional. Two-letter country abbreviation.

typestringOptional. Standard values are HOME and WORK.

birthday

Optional.

YYYY-MM-DD formatted string.

emails

object

Optional.

Contact email address(es) formatted as an emails object. The object can contain the following fields:

emailstringOptional. Email address.

typestringOptional. Standard values are HOME and WORK.

name

object

Required.

Full contact name formatted as a name object. The object can contain the following fields:

formatted_namestringRequired. Full name, as it normally appears.

first_namestringOptional*. First name.

last_namestringOptional*. Last name.

middle_namestringOptional*. Middle name.

suffixstringOptional*. Name suffix.

prefixstringOptional*. Name prefix.


*At least one of the optional parameters needs to be included along with the formatted_name parameter.

org

object

Optional.

Contact organization information formatted as an org object. The object can contain the following fields:

companystringOptional. Name of the contact's company.

departmentstringOptional. Name of the contact's department.

titlestringOptional. Contact's business title.

phones

object

Optional.

Contact phone number(s) formatted as a phone object. The object can contain the following fields:

phonestringOptional. Automatically populated with the `wa_id` value as a formatted phone number.

typestringOptional. Standard Values are CELL, MAIN, IPHONE, HOME, and WORK.

wa_idstringOptional. WhatsApp ID.

urls

object

Optional.

Contact URL(s) formatted as a urls object. The object can contain the following fields:

urlstringOptional. URL.

typestringOptional. Standard values are HOME and WORK.

內部以巢狀方式包含複數物件的 contacts 物件範例:

"contacts": [
    {
        "addresses": [
            {
                "city": "city name",
                "country": "country name",
                "country_code": "code",
                "state": "Contact's State",
                "street": "Contact's Street",
                "type": "Contact's Address Type",
                "zip": "Contact's Zip Code"
            }
        ],
        "birthday": "birthday",
        "emails": [
            {
                "email": "email",
                "type": "HOME"
            },
            {
                "email": "email",
                "type": "WORK"
            }
        ],
        "name": {
            "first_name": "first name value",
            "formatted_name": "formatted name value",
            "last_name": "last name value",
            "suffix": "suffix value"
        },
        "org": {
            "company": "company name",
            "department": "dep name",
            "title": "title"
        },
        "phones": [
            {
                "phone": "Phone number",
                "wa-id": "WA-ID value",
                "type": "MAIN"
            },
            {
                "phone": "Phone number",
                "type": "HOME"
            },
            {
                "phone": "Phone number",
                "type": "WORK"
            }
        ],
        "urls": [{
            "url": "some url",
            "type": "WORK"
        }]
    }
]

地點物件

NameDescription

latitude

Required.

Location latitude in decimal degrees.

longitude

Required.

Location longitude in decimal degrees.

name

Required.

Name of the location.

address

Required.

Address of the location.

範本物件

template 內,您可以巢狀方式包含 componentslanguage 物件。

v2.27.8 開始,範本的 namespace 必須是與 WABA 相關聯的命名空間,且該帳號擁有目前 WhatsApp Business 內部部署用戶端的電話號碼,否則訊息將無法傳送。

此外,從 v2.41 及後續版本開始,namespace 將為選填欄位。

名稱說明

namespace

必填。

範本的命名空間。


v2.27.8 開始,此命名空間必須與 WhatsApp Business 帳號相關聯,該帳號擁有與目前 WhatsApp Business API 用戶端相關聯的電話號碼,否則訊息將無法傳送。

name

必填。

範本的名稱。

language

必填。

指定可在範本中轉譯的語言。只有 deterministic 語言政策適用於媒體範本訊息。如需詳細資訊,請參閱語言一節。

components

選用。

包含訊息參數的陣列。

元件物件

components 內部,您可以巢狀方式包含 parameters 物件。此外,您可以將 type 設為 button

名稱說明

type

必填。

說明 component 類型。
值:headerbodyfooter

parameters

選用。

包含訊息內容的陣列。

參數物件

名稱說明

type

必填。

說明 parameter 類型。
值:textcurrencydate_timeimagedocumentvideo


媒體類型(imagedocumentvideo)使用的格式與標準媒體訊息使用的格式相同,如需詳細資訊,請參閱媒體文件。媒體訊息範本目前僅支援 PDF 文件。


如需 currencydate_time 的詳細資訊,請參閱可本地化的參數一節。template 訊息的 currencydate_time 參數使用 fallback_value 來取代 default。相關範例請參閱上述的要求範例。

按鈕類型

components 物件內部,您可以將 type 設為 button。以下為按鈕參數:

名稱說明

sub_type

必要項目。

所要建立的按鈕類型。
值:quick_replyurlcopy_code (available from 2.49 and onwards)

index

必要項目。

按鈕的位置索引。最多可以使用 10 個按鈕,索引值為 0-9

parameters

必要項目。

按鈕的參數,在企業管理平台中建立按鈕時設定。包含下列參數:

  • type(必填):指示按鈕的參數類型。支援的值為 payloadtextcoupon_code
  • payload(為 quick_reply 按鈕的必填項目):除了顯示在按鈕上的文字,點擊按鈕時,系統將傳回開發人員所定義的承載。
  • texturl 按鈕的必要項目):開發人員提供的尾碼,將附加在先前建立的動態網址按鈕後面。
  • coupon_code(copy_code 按鈕的必要項目)(自 2.49 版起開放使用):開發人員提供的優惠券代碼,點擊複製代碼按鈕時會複製該代碼。

使用 quick_reply sub_type 的 button 類型範例:

 {
    "type": "button",
    "sub_type": "quick_reply",
    "index": 0,
    "parameters": 
     [{
    	"type": "payload",
    	"payload": "Yes-Button-Payload"
     }]
 } 

使用 copy_code sub_type 的 button 類型範例

    
 { 
    "type": "button", 
    "sub_type": "copy_code", 
    "index": 0, 
    "parameters": 
    [{ 
     "type": "coupon_code", 
     "coupon_code": "DISCOUNT20" 
    }] 
 }

Hsm 物件

hsm 物件自 WhatsApp Business 內部部署/參考資料 v2.39 開始已停用。請改用 template 物件。

名稱 說明

namespace

必要項目。

將使用的命名空間。從 v2.2.7 開始,若命名空間與 element_name 不相符,訊息將無法傳送。

element_name

必要項目。

元素名稱,註明在命名空間中使用的範本。從 v2.2.7 開始,若 element_name 與命名空間不相符,訊息將無法傳送。

language

必要項目。

可用於指定決定性語言。如需詳細資訊,請參閱語言一節。


此欄位用於允許 fallback 選項,但其已在 v2.27.8 停用。

localizable_params

必要項目。

這個欄位包含值陣列,要套用於範本中的變數。如需詳細資訊,請參閱可本地化的參數一節。

互動式物件

The interactive object generally contains 4 main components: header, body, footer, and action. Additionally, some of those components can contain one or more different objects:

  • Inside header, you can nest media objects.
  • Inside action, you can nest section and button objects.
NameDescription

type

string

Required.

The type of interactive message you want to send. Supported values:

  • list: Use it for List Messages.
  • button: Use it for Reply Buttons.
  • product: Use it for Single-Product Messages.
  • product_list: Use it for Multi-Product Messages.
  • catalog_message: Use it for Catalog Messages.
  • flow: Use it for Flows Messages.

header

object

Required for type product_list. Optional for other types.

Header content displayed on top of a message. You cannot set a header if your interactive object is of product type.


The header object contains the following fields:

documentobjectRequired if type is set to document. Contains the media object with the document.

imageobjectRequired if type is set to image. Contains the media object with the image.

videoobjectRequired if type is set to video. Contains the media object with the video.

textstringRequired if type is set to text. Text for the header. Formatting allows emojis, but not markdown. Maximum length: 60 characters.

typestringRequired. The header type you would like to use. Supported values are:

text – for List Messages, Reply Buttons, and Multi-Product Messages.

video – for Reply Buttons.

image – for Reply Buttons.

document – for Reply Buttons.

body

object

Optional for type product. Required for other message types.

An object with the body of the message.


The body object contains the following field:

textstringRequired if body is present. The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.

footer

object

Optional.

An object with the footer of the message.


The footer object contains the following field:

textstringRequired if footer is present. The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters.

action

object

Required.

An action object with what you want the user to perform after reading the message. See action object for full information.

動作物件

NameDescription

button

string

Required for List Messages.

Button content. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

buttons

object

Required for Reply Button Messages.

A button object. The object can contain the following parameters:

type – The only supported option is reply for Reply Button Messages.

title – Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

id – Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters.


設定編號時不能有前置或後置空格。

sections

array of objects

Required for List Messages and Multi-Product Messages.

Array of section objects. There is a minimum of 1 and maximum of 10. See section object.

catalog_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the Facebook catalog linked to your WhatsApp Business Account. This ID can be retrieved via Commerce Manager.

product_retailer_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the product in a catalog. Maximum 100 characters for both Single-Product and Multi-Product messages.


To get this ID, go to Commerce Manager, select your Facebook Business account, and you will see a list of shops connected to your account. Click the shop you want to use. On the left-side panel, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

mode

string

Optional for Flows Messages.

The current mode of the Flow, either draft or published.


Default: published

flow_message_version

string

Required for Flows Messages.

Must be 3.

flow_token

string

Required for Flows Messages.

A token that is generated by the business to serve as an identifier.

flow_id

string

Required for Flows Messages.

Unique identifier of the Flow provided by WhatsApp.

flow_cta

string

Required for Flows Messages.

Text on the CTA button, eg. "Signup".


Maximum length: 20 characters (no emoji).

flow_action

string

Optional for Flows Messages.

navigate or data_exchange. Use navigate to predefine the first screen as part of the message. Use data_exchange for advanced use-cases where the first screen is provided by your endpoint.


Default: navigate

flow_action_payload

object

Optional for Flows Messages.

Required only if flow_action is navigate. The object can contain the following parameters:

screenstringRequired. The id of the first screen of the Flow.

dataobjectOptional. The input data for the first screen of the Flow. Must be a non-empty object.

Section Object

NameDescription

title

string

Required if the message has more than one section.

Title of the section. Maximum length: 24 characters.

rows

array of objects

Required for List Messages.

Contains a list of row objects. Limited to 10 rows across all sections.


Each row object contains the following fields:

titlestringRequired. Maximum length: 24 characters.

IDstringRequired. Maximum length: 200 characters.

descriptionstringOptional. Maximum length: 72 characters.

product_items

array of objects

Required for Multi-Product Messages.

Array of product objects. There is a minimum of 1 product per section and a maximum of 30 products across all sections.


Each product object contains the following field:

product_retailer_idstringRequired for Multi-Product Messages. Unique identifier of the product in a catalog. To get this ID, go to Commerce Manager, select your account and the shop you want to use. Then, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

範例

音訊訊息:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "audio",
  "audio": {
      "id": "your-media-id",
  }
}

文件訊息,使用 filename

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "id": "your-media-id",
      "filename": "your-document-filename"
  }
}

文件訊息,使用 link

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }     
    }
}

影片訊息,使用 link

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "video",  
  "video": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }
    }
  }
}

文字訊息:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "text",
  "text": {
      "body": "your-message-content"
  }
}

互動式訊息(清單):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive":{
    "type": "list",
    "header": {
      "type": "text",
      "text": "your-header-content-here"
    },
    "body": {
      "text": "your-text-message-content-here"
    },
    "footer": {
      "text": "your-footer-content-here"
    },
    "action": {
      "button": "cta-button-content-here",
      "sections":[
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        ...
      ]
    }
  }

}

互動式訊息(回覆按鈕):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "header": { # optional
      "type": "text" | "image" | "video" | "document",
      "text": "your text"
      # OR
      "document": {
        "id": "your-media-id",
        "filename": "some-file-name"
      }
      # OR
      "document": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name",
        },
        "filename": "some-file-name"
      },
      # OR
      "video": {
        "id": "your-media-id"
      }
      # OR
      "video": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
      # OR
      "image": {
        "id": "your-media-id"
      }
      # OR
      "image": {
        "link": "http(s)://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
    }, # end header
    "body": {
      "text": "your-text-body-content"
    },
    "footer": { # optional
      "text": "your-text-footer-content"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "First Button’s Title" 
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "Second Button’s Title" 
          }
        }
      ] 
    } # end action   
  } # end interactive

}

互動式訊息(多個和單一產品訊息):

{ 
  "recipient_type": "individual",
  "to" : "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "product",
    "body": {
      "text": "body text"
    },
    "footer": {
      "text": "footer text"
    },
    "action": {
      "
      
      _id": "catalog-ID",
      "product_retailer_id": "product-ID"
    }
  }
}

互動式訊息(多個產品訊息):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "product_list",
    "Header":{
       "type": "text",
        "text": "text-header-content"
     },
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "catalog_id":"catalog-id",
        "sections": [
             {
             "title": "section-title",             
             "product_items": [
                  { "product_retailer_id": "product-SKU-in-catalog" },
                  { "product_retailer_id": "product-SKU-in-catalog" },
                            ...
              ]},
              {
              "title": "the-section-title",
              "product_items": [
                 { "product_retailer_id": "product-SKU-in-catalog" }
                           ...
              ]},
               ...
       ]
     },  
    }
}

互動式訊息(目錄訊息):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "catalog_message",
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "name": "catalog_message",
      	"parameters":{ 
      	  "thumbnail_product_retailer_id": "product-SKU-in-catalog"
      	}
     },  
    }
}

互動式訊息(流程):

{
  "recipient_type": "individual",
  "to": "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "flow",
    "header": {
      "type": "text",
      "text": "Flow message header"
    },
    "body": {
      "text": "Flow message body"
    },
    "footer": {
      "text": "Flow message footer"
    },
    "action": {
      "name": "flow",
      "parameters": {
        "flow_message_version": "3",
        "flow_token": "AQAAAAACS5FpgQ_cAAAAAD0QI3s",
        "flow_id": "<FLOW_ID>",
        "flow_cta": "Book!",
        "flow_action": "navigate",
        "flow_action_payload": {
          "screen": "<SCREEN_ID>",
          "data": { # optional
            "user_name": "name",
            "user_age": 25
          }
        }
      }
    }
  }
}

以下顯示回應中 payload 的範例;為求簡潔,省略了中繼和錯誤物件。

{
  "messages": [{ 
    "id": "message-id" 
  }]    
}

若要求成功,您會收到具有訊息編號的回應。若要求傳回 errors 區段,請檢查來源訊息並更正錯誤之後,再重新傳送要求。如需錯誤的詳細資訊,請參閱 WhatsApp Business API 內部部署/參考資料用戶端錯誤代碼HTTP 狀態代碼

自 2023 年 9 月 12 日起,適用於巴西、哥倫比亞和新加坡的商家。自 2023 年 10 月 12 日起,適用於所有商家。

如果系統保留要求以進行品質評估,則回應將包含 message_status 屬性並附加一則訊息,指示系統未立即傳送訊息,將在驗證品質後傳送或將其刪除。只有當系統保留訊息時,此屬性才會存在。

    {
      "messages": [{ 
        "id": "message-id",
        "message_status": "Message has been held because quality assessment is pending",
      }]    
    }
    

在文字訊息中加入格式

WhatsApp 允許在訊息中加入一些格式若要對訊息進行全部或部分格式化,請使用以下格式符號:

格式符號範例

粗體

星號(*)

總共是 * 10.50 美元 *。

斜體

底線(_)

歡迎使用 _WhatsApp_!

刪除線

波狀符號(~)

這是 ~ 更加 ~ 最棒的!

Code

三個反引號(```)

```print 'Hello World';```

成效

在本文中,成效代表使用 WhatsApp Business 內部部署/參考資料用戶端在任何指定秒數內可以傳送的訊息數量。可達成的最大成效取決於多種因素,最重要的因素是用戶端設定選擇,以及訊息是傳送給新用戶還是現有用戶。若是傳送訊息給新用戶,加密工作階段設定需要較長的時間。

用戶端設定每秒支援的文字訊息數量

單一分片

70

多個分片(32 個分片)

250

常見問題

注意:請勿使用 WhatsApp Business API 向相同收件人重複傳送相同訊息。

造成投遞率不是 100% 的原因很多。一些常見案例包括用戶偶爾上網、停用一段時間,或者建立 優質用戶體驗

能夠透過 WhatsApp 傳遞的訊息具有非常高的投遞率。但是,無法傳遞訊息的原因很多。透過監控回呼,您可以存取訊息的確切狀態。這與使用簡訊傳送訊息有所不同,舉例來說,您無法存取最終傳遞狀態,重新傳送訊息可能在實際上產生不同的結果。

用戶手機暫停服務、沒電,或是遺失且準備購買新機並停用 SIM 卡,都可能造成訊息無法傳遞。企業用戶端的網路連線能力可能發生錯誤,也有可能系統未傳遞回呼(Webhooks)。您可以使用 health 節點監控這些情況。您可以開啟伺服器回條回呼,以瞭解該訊息已進入 WhatsApp 伺服器雲端。

如果用戶重新連線到網路,系統會將您已傳送的所有訊息傳遞給他們。對用戶來說,接收多則相同內容的訊息是一項糟糕的體驗。他們較可能封鎖您或提出抱怨,而您遭到禁用的機率會提高。

如果您傳送訊息並從 API 收到訊息編號,表示已執行可傳送該訊息的作業。請勿將相同內容重新傳送給相同收件人。

如果您在很長一段時間內發現投遞率較低,請透過以下方式提交支援案件: 直接支援

當您傳送訊息時,一旦傳回訊息編號,即表示訊息要求已儲存在資料庫中。WhatsApp Business API 用戶端將繼續嘗試傳送該訊息,直到 WhatsApp 伺服器確認為止。這項流程沒有結束時間表。接著,WhatsApp 伺服器會嘗試將該訊息傳遞到用戶的手機。如果用戶的手機未在線上,WhatsApp 伺服器會將訊息儲存 30 天後捨棄。

可以!WhatsApp 允許您將訊息內選取的文字設定為粗體、斜體、刪除線或等寬格式。

目前無法查看有多少用戶或哪些用戶封鎖了您的企業。最佳指標是接聽狀態回呼,如果您未收到 delivered 狀態,表示用戶已封鎖您的企業或沒有網路連線。如需詳細資訊,請參閱 Webhook 文件。

如果用戶已封鎖您的企業,聯絡人 API 將繼續以有效的 WhatsApp 用戶身分傳回該手機號碼。但是,系統將永遠不會傳遞您所傳送的訊息。若為付費訊息,您將不需支付費用。

否,訊息抵達的順序不保證與傳送的順序相同。如果順序對您的使用案例至關重要,建議先接聽第一則訊息已傳遞的回呼,然後再觸發第二則訊息。

使用 messages 節點時,必須針對 WhatsApp Business API 用戶端將 Content-Type 標頭設定為 application/json,以正確剖析訊息正文。您還需要設定一個 Authorization 標頭,且必須包含未過期的存取權杖。有關如何取得權杖以及權杖過期時的資訊,請參閱登入與驗證文件。

在某些情況中,您可能需要更多時間來處理顧客查詢,並且只能在 24 小時後回覆。我們建議建立訊息範本來執行下列步驟:

  • 傳遞結果給用戶,或
  • 提示用戶進行回覆以啟動顧客服務視窗。

在上述兩種情況中,請務必盡可能為訊息範本提供更多內容。例如:

  • 「您好 {{1}},關於您之前回報的問題,我們很遺憾地通知您 {{2}}。造成您的不便我們深表歉意。」
  • 我們已就您的票證進行更新。如果您希望繼續支援,敬請回覆。」