/v1/messages
messages
노드를 사용하여 고객에게 메시지 템플릿과 문자, 미디어, 연락처, 위치, 인터랙티브 메시지를 전송합니다.
전송할 수 있는 구체적인 메시지 유형과 관련된 정보는 문자 메시지, 미디어 메시지, 연락처 및 위치 메시지, 인터랙티브 메시지, 메시지 템플릿, 미디어 메시지 템플릿, 인터랙티브 메시지 템플릿 가이드를 참조하세요.
다음 항목이 필요합니다.
v2.39 이후부터는 메시지를 보내기 전에 연락처 노드를 호출할 필요가 없습니다.
메시지 유형과 관계없이 /messages
노드로 POST
호출을 보내서 메시지를 전송합니다. JSON 메시지 본문 내용은 메시지 유형(예: 문자, 이미지)에 따라 다릅니다.
/messages
POST 요청에서 사용하는 주요 매개변수는 다음과 같습니다.
이름 | 설명 (왼쪽 열의 화살표를 클릭하여 지원되는 옵션을 확인하세요.) |
---|---|
|
오디오를 포함하는 |
| 선택 사항. 임의의 문자열이며, 추적에 사용합니다. 예를 들어 이 필드에 메시지 템플릿 ID를 전달하여 비즈니스가 전송한 첫 메시지부터 고객의 여정을 추적할 수 있습니다. 그런 다음, 다양한 메시지 템플릿 유형의 ROI를 추적하여 가장 효과적인 템플릿을 확인할 수 있습니다. 이 문자열은 Webhooks 페이로드 내의 클라우드 API는 이 필드를 처리하지 않고 메시지 전송됨/전달됨/읽음 Webhooks에서 반환합니다. 최대 512자입니다. 클라우드 API 전용. |
|
|
| 대화 중 메시지에 답장하는 경우 필수 항목. 답장하려는 이전 메시지의 ID를 포함하는 개체. 예를 들면 다음과 같습니다.
클라우드 API 전용. |
|
문서를 포함하는 |
|
온프레미스 API 전용. |
|
이미지를 포함하는 |
|
|
|
|
| 필수 항목. 요청에 사용된 메시지 서비스. 클라우드 API 전용. |
|
문자 메시지에서 URL 미리 보기 허용 — 문자 메시지에서 URL 전송을 참조하세요. 메시지에 URL을 포함하지 않는 경우 이 필드는 선택 사항입니다. 값: 온프레미스 API 전용. 클라우드 API 사용자는 텍스트 개체 내의 |
| 선택 사항. 현재는 개인에게만 메시지를 보낼 수 있습니다. 이 필드를 기본값: |
| 메시지 상태. 이 필드를 사용하여 메시지를
|
|
스티커를 포함하는 클라우드 API: 모든 유형의 인바운드 스티커 외에 고정 및 애니메이션 타사 아웃바운드 스티커도 지원됩니다. 고정 스티커는 512x512픽셀이어야 하고 100KB를 초과할 수 없습니다. 애니메이션 스티커는 512x512픽셀이어야 하고 500KB를 초과할 수 없습니다. 온프레미스 API: 모든 유형의 인바운드 스티커 외에 고정 타사 아웃바운드 스티커만 지원됩니다. 고정 스티커는 512x512픽셀이어야 하고 100KB를 초과할 수 없습니다. 애니메이션 스티커는 지원되지 않습니다. |
|
|
| 문자 메시지에 필수 항목. |
| 필수 항목. 메시지를 보낼 대상인 고객의 WhatsApp ID 또는 전화번호. 전화번호 형식을 참조하세요. 필요한 경우 온프레미스 API 사용자는 |
| 선택 사항. 전송하고자 하는 메시지 유형. 생략하는 경우 기본값은 |
이름 | 설명 |
---|---|
| 필수 항목. 문자 메시지의 텍스트와 함께 URL과 형식화를 포함할 수 있습니다. |
온프레미스 API의 경우 media
엔드포인트를 통해 WhatsApp Business 온프레미스/참조 클라이언트에 미디어가 성공적으로 업로드되면 미디어 개체 ID가 반환됩니다.
Name | Description |
---|---|
| Required when The media object ID. Do not use this field when message |
| Required when The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message Cloud API users only:
|
| Optional. Media asset caption. Do not use with On-Premises API users:
|
| Optional. Describes the filename for the specific document. Use only with The extension of the filename will specify what format the document is displayed as in WhatsApp. |
| Optional. On-Premises API only. This path is optionally used with a |
contacts
내에서 addresses
, emails
, name
, org
, phone
및 urls
개체를 중첩할 수 있습니다. 복수화된 개체는 아래의 예와 같이 배열로 래핑됩니다.
Name | Description |
---|---|
| Optional. Full contact address(es) formatted as an
|
| Optional.
|
| Optional. Contact email address(es) formatted as an
|
| Required. Full contact name formatted as a
*At least one of the optional parameters needs to be included along with the |
| Optional. Contact organization information formatted as an
|
| Optional. Contact phone number(s) formatted as a
|
| Optional. Contact URL(s) formatted as a
|
내부에 복수화된 개체를 중첩한 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" }] } ]
Name | Description |
---|---|
| Required. Location latitude in decimal degrees. |
| Required. Location longitude in decimal degrees. |
| Required. Name of the location. |
| Required. Address of the location. |
template
안에서 components
및 language
개체를 중첩할 수 있습니다.
v2.27.8
부터 템플릿의 namespace
는 현재의 WhatsApp Business 온프레미스 클라이언트에 등록된 전화번호를 소유하는 WABA와 연결된 네임스페이스여야 합니다. 그렇지 않으면 메시지 전송이 실패합니다.
또한 v2.41
이후부터는 namespace
가 선택 사항 필드가 됩니다.
이름 | 설명 |
---|---|
| 필수 항목. 템플릿의 네임스페이스입니다.
|
| 필수 항목. 템플릿 이름입니다. |
| 필수 항목. 템플릿을 렌더링할 수 있는 언어를 지정합니다. |
| 선택 사항. 메시지 매개변수가 포함된 배열입니다. |
components
안에서 parameters
개체를 중첩할 수 있습니다. 또한 type
을 button
으로 설정할 수 있습니다.
이름 | 설명 |
---|---|
| 필수 항목.
|
| 선택 사항. 메시지 콘텐츠가 포함된 배열입니다. |
이름 | 설명 |
---|---|
| 필수 항목.
미디어 유형(
|
components
개체 안에서 type
을 button
으로 설정할 수 있습니다. 버튼 매개변수는 다음과 같습니다.
이름 | 설명 |
---|---|
| 필수 항목. 생성되는 버튼 유형입니다. |
| 필수 항목. 버튼의 위치 인덱스입니다. |
| 필수 항목. 비즈니스 관리자에서 생성 시점에 설정되는 버튼 매개변수입니다. 다음과 같은 매개변수를 포함합니다.
|
sub_type quick_reply
를 포함한 button
유형의 예는 다음과 같습니다.
{ "type": "button", "sub_type": "quick_reply", "index": 0, "parameters": [{ "type": "payload", "payload": "Yes-Button-Payload" }] }
sub_type copy_code
를 포함한 button
유형의 예는 다음과 같습니다.
{ "type": "button", "sub_type": "copy_code", "index": 0, "parameters": [{ "type": "coupon_code", "coupon_code": "DISCOUNT20" }] }
hsm
개체는 WhatsApp Business 온프레미스/참조 v2.39
부터 사용이 중단되었습니다. 대신 template
개체를 사용하세요.
이름 | 설명 |
---|---|
| 필수 항목. 사용할 네임스페이스입니다. |
| 필수 항목. 네임스페이스에서 사용할 템플릿을 나타내는 요소 이름입니다. |
| 필수 항목. 결정적 언어 또는 폴백 언어의 사양을 고려합니다. 자세한 내용은 언어 섹션을 참조하세요. 이 필드는 |
| 필수 항목. 이 필드는 템플릿 내 변수에 적용되는 값의 배열입니다. 자세한 내용은 현지화 가능한 매개변수 섹션을 참조하세요. |
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:
header
, you can nest media
objects.action
, you can nest section
and button
objects.Name | Description |
---|---|
| Required. The type of interactive message you want to send. Supported values:
|
| Required for type Header content displayed on top of a message. You cannot set a The
|
| Optional for type An object with the body of the message. The
|
| Optional. An object with the footer of the message. The
|
| Required. An |
Name | Description |
---|---|
| 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. |
| Required for Reply Button Messages. A
ID를 설정할 때는 ID의 앞 또는 뒤에 공백이 있으면 안 됩니다. |
| Required for List Messages and Multi-Product Messages. Array of |
| 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. |
| 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. |
| Optional for Flows Messages. The current mode of the Flow, either Default: |
| Required for Flows Messages. Must be |
| Required for Flows Messages. A token that is generated by the business to serve as an identifier. |
| Required for Flows Messages. Unique identifier of the Flow provided by WhatsApp. |
| Required for Flows Messages. Text on the CTA button, eg. "Signup". Maximum length: 20 characters (no emoji). |
| Optional for Flows Messages.
Default: |
| Optional for Flows Messages. Required only if
|
Name | Description |
---|---|
| Required if the message has more than one Title of the section. Maximum length: 24 characters. |
| Required for List Messages. Contains a list of row objects. Limited to 10 rows across all sections. Each
|
| Required for Multi-Product Messages. Array of Each
|
오디오 메시지:
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" }] }
요청이 성공하면 메시지 ID가 포함된 응답을 수신합니다. 요청이 errors
섹션을 반환하면 원본 메시지를 확인하고 오류를 수정한 다음 요청을 다시 보내세요. 오류에 대한 자세한 내용은 WhatsApp Business 온프레미스/참조 클라이언트 오류 코드 및 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_에 오신 것을 환영합니다! |
물결표(~) | ~더 나은 것~ 최고입니다! | |
| 백틱 3개(```) | ```print 'Hello World';``` |
이 경우 성능은 WhatsApp Business 온프레미스/참조 클라이언트를 사용하여 1초에 보낼 수 있는 메시지 수를 나타냅니다. 달성 가능한 최대 성능은 여러 가지 요소에 따라 달라집니다. 클라이언트 설정으로 무엇을 선택했는지, 메시지가 새로운 사용자 또는 기존 사용자에게 전송되었는지 여부가 가장 중요합니다. 새로운 사용자에게 메시지를 보낼 때 암호화 세션 설정은 시간이 다소 오래 걸릴 수 있습니다.
클라이언트 설정 | 초당 지원되는 메시지 개수 |
---|---|
싱글 샤드 | 70 |
멀티 샤드(32개) | 250 |
참고: WhatsApp Business API를 사용하여 동일한 수신자에게 반복적으로 동일한 메시지를 보내지 마세요.
전달률이 100%가 아닌 이유는 여러 가지가 있을 수 있습니다. 일반적인 사례로는 사용자가 네트워크에 산발적으로 액세스하거나, 일정 기간 비활성화 상태이거나 좋은 품질의 사용자 경험을 만들기 위해 전달되지 않은 경우가 있습니다.
WhatsApp으로 전송 가능한 메시지는 전달률이 매우 높습니다. 그러나 메시지가 전달되지 않는 이유는 여러 가지가 있습니다. 콜백을 모니터링하면 메시지의 정확한 상태에 액세스할 수 있습니다. 예를 들어 이는 SMS로 메시지를 전송하는 것과는 다른데, SMS로 메시지를 전송할 때는 최종 전달된 상태에 액세스할 수 없고 메시지를 다시 전송하면 다른 결과를 초래할 수 있습니다.
메시지가 전달되지 않은 이유는 사용자의 전화기를 사용할 수 없거나, 배터리가 모두 소모되었거나, 전화기를 분실해서 새로운 전화기를 구매했고 SIM을 비활성화했기 때문일 수 있습니다. 비즈니스 클라이언트가 네트워크에 연결하는 기능에 오류가 발생했을 수도 있습니다. 또한 콜백(Webhooks)이 전송되지 않았을 수도 있습니다. health
노드를 사용하여 이러한 상황을 모니터링할 수 있습니다. 서버 수신 콜백을 활성화하면 메시지가 WhatsApp 서버 클라우드로 전달되었는지 알 수 있습니다.
사용자가 네트워크에 다시 연결하면 전송한 모든 메시지가 전달됩니다. 동일한 내용의 메시지를 2번 이상 수신하는 것은 사용자에게 불쾌한 경험을 제공합니다. 그러면 사용자가 차단하거나 불만을 접수할 가능성이 크고 비즈니스가 차단될 가능성이 더욱 커집니다.
메시지를 전송하고 API로부터 메시지 ID를 받았다면 이 메시지 전송을 위해 할 수 있는 일을 완료한 것입니다. 동일한 내용을 동일한 수신자에게 다시 보내지 마세요.
오랫동안 전달률이 낮게 유지되면 기술 지원에 지원 티켓을 제출하세요.
메시지를 전송하는 즉시 메시지 ID로 돌아갑니다. 즉, 메시지 요청이 데이터베이스에 저장된 것을 의미합니다. WhatsApp Business API 클라이언트는 WhatsApp 서버에서 승인할 때까지 해당 메시지의 전송을 계속 시도합니다. 이 프로세스는 종료 시간이 정해져 있지 않습니다. 그러면 WhatsApp 서버에서 사용자 전화기로 해당 메시지를 전송하려고 시도할 것입니다. 사용자의 전화기가 온라인 상태가 아니라면 메시지는 30일간 보관되었다가 WhatsApp 서버에서 폐기합니다.
예! WhatsApp에서는 메시지 안의 선택된 텍스트를 굵게, 기울임, 취소선 또는 고정 너비로 서식을 지정할 수 있습니다.
아니요, 메시지가 도착하는 순서는 보낸 순서와 동일하게 보장되지 않습니다. 사용 사례에서 순서가 중요한 경우 첫 번째 메시지의 전송된 콜백을 수신한 다음, 두 번째 메시지를 보내는 것이 좋습니다.
고객 문의를 처리하는 데 더 많은 시간이 필요하고 24시간이 지난 이후에만 응답을 할 수 있는 경우가 있습니다. 다음과 같이 메시지 템플릿을 생성해서 처리하는 것이 좋습니다.
두 경우 모두 메시지 템플릿에 최대한 많은 컨텍스트를 제공하세요. 예를 들면 다음과 같습니다.