v2.25.4
부터 미디어 메시지 템플릿에서는 components
개체를 사용하여 표준 메시지 템플릿 유형 외에도 미디어, 머리글, 바닥글을 포함하도록 수신자에게 보낼 수 있는 콘텐츠가 확대됩니다. components
개체로 메시지 type
과 메시지의 parameters
를 나타낼 수 있습니다.
POST /v1/messages { "to": "recipient_wa_id", "ttl": "P4D" | "3600" | 3600, "type": "template", "template": { "namespace": "your-namespace", "language": { "policy": "deterministic", "code": "your-language-and-locale-code" }, "name": "your-template-name", "components": [ { "type" : "header", "parameters": [ # The following parameters code example includes several different possible header types, # not all are required for a media message template API call. { "type": "text", "text": "replacement_text" } # OR { "type": "document", "document": { "id": "your-media-id", # filename is an optional parameter "filename": "your-document-filename" } } # OR { "type": "document", "document": { "link": "the-provider-name/protocol://the-url", # provider and filename are optional parameters "provider": { "name" : "provider-name" }, "filename": "your-document-filename" } } # OR { "type": "image", "image": { "link": "http(s)://the-url", # provider is an optional parameter "provider": { "name" : "provider-name" }, } } ] # end header }, { "type" : "body", "parameters": [ { "type": "text", "text": "replacement_text" }, { "type": "currency", "currency" : { "fallback_value": "$100.99", "code": "USD", "amount_1000": 100990 } }, { "type": "date_time", "date_time" : { "fallback_value": "February 25, 1977", "day_of_week": 5, "day_of_month": 25, "year": 1977, "month": 2, "hour": 15, "minute": 33, #OR "timestamp": 1485470276 } }, { ... # Any additional template parameters } ] # end body }, ] } }
이름 | 필수 | 설명 |
---|---|---|
| 예 | 수신자의 WhatsApp ID |
| 아니요 | TTL(잔여 수명) 기간 |
| 아니요 | 미디어 템플릿 메시지를 전송하도록 |
| 예( | 모든 템플릿 정보 포함 |
template
개체이름 | 필수 | 설명 |
---|---|---|
| 예 | 템플릿의 네임스페이스 |
| 예 | 템플릿 이름 |
| 예 | 템플릿을 렌더링할 수 있는 언어 지정 |
| 아니요 | 메시지 매개변수가 포함된 배열 |
components
개체이름 | 필수 | 설명 |
---|---|---|
| 예 |
|
| 아니요 | 메시지 콘텐츠가 포함된 배열 |
parameters
개체이름 | 필수 | 설명 |
---|---|---|
| 예 |
|
성공적인 응답에는 id
가 있는 messages
개체가 포함됩니다.
{ "messages": [{ "id": "gBEGkYiEB1VXAglK1ZEqA1YKPrU" }] }
실패한 응답에는 오류 문자열, 오류 코드 및 기타 정보가 있는 오류 개체가 포함됩니다.
템플릿을 수신할 수 없는 계정으로 템플릿을 보내는 경우 구성된 Webhook 서버에 오류 개체의 1026 (ReceiverIncapable)
오류가 전송됩니다.
오류에 대한 자세한 내용은 오류 및 상태 코드를 참조하세요.