HTTP connection
Last update: 7 days ago by Irais Aguirre
Request
| URL | https://api.ventachat.com/template/api-template |
| Method | POST |
| Type | application/json |
Headers
| Name | Description | Type | Requirements |
|---|---|---|---|
| Content-Type | application/json | string | required |
| Authorization | authentication token | string | required |
| Accept | */* | string | required |
Objects
General structure
| Name | Description | Type | Requirements |
|---|---|---|---|
| contactName | contact name | string | optional |
| from | phone number (with country code) the message will be sent from | string | required |
| to | WhatsApp identifier returned by the contacts service | string | required |
| userId | user uuid | string (uuid) | required |
| workgroupId | workgroup identifier | string (uuid) | required |
| campaignId | campaign identifier | string | required |
| type | message type | string | required |
| message | object that contains the message content | object | required |
Message object
| Name | Description | Type | Requirements |
|---|---|---|---|
| templateId | template identifier | integer | required |
| template | object that contains the template details | object | required |
Template object
| Name | Description | Type | Requirements |
|---|---|---|---|
| language | template language | string | optional |
| name | template name | string | optional |
| components | object that contains the template configuration | object | optional |
Components object
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | Component type. Possible values: header: template header, body: template body, button: buttons for template actions | string | required |
| subtype | quick_reply: refers to a previously created quick reply button that allows the customer to return a predefined message. URL: refers to a previously created button that allows the customer to visit the URL generated by appending the text parameter to the predefined prefix URL in the template. catalog: refers to a previously created catalog button that allows the customer to return a complete product catalog | string | required when used with the button type |
| index | index for payload type parameters | string | optional, used with the button type; index values can be: 0,1,2 |
| cards | send card type messages | object | required |
| parameters | array of template types. Possible values: text, currency, date_time, image, document, video, location, payload, action | array | required |
Parameter types versus component types
| Parameter type | header | body | button |
|---|---|---|---|
| text | yes | yes | no |
| currency | yes | yes | no |
| date_time | yes | yes | no |
| image | yes | no | no |
| document | yes | no | no |
| video | yes | no | no |
| location | yes | no | no |
| payload | no | no | yes |
| action | no | yes | yes |
Text
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “text” | string | required |
| text | text | string | optional |
Currency
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “currency” | string | required |
| fallbackValue | if the currency code is not recognized, the fallbackValue value will be used | string | optional |
| code | currency code (ISO 4217) | string | optional |
| amount | Amount | number | optional |
Datetime
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “date_time” | string | required |
| fallbackValue | if the date is not recognized, the fallbackValue value will be used | string | required |
| dayOfMonth | day of the month | number | required |
| year | year | number | optional |
| month | month | number | optional |
| hour | hour | number | optional |
| minute | minute | number | optional |
Multimedia content
Image object
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “image” | string | required |
| link | image URL | string | required |
Document object
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “document” | string | required |
| link | document URL | string | required |
| caption | document description | string | optional, maximum size is 178 characters |
| filename | document file name | string | required |
Video object
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | the value is “video” | string | required |
| link | video URL | string | required |
Card object
| Name | Description | Type | Requirements |
|---|---|---|---|
| cardIndex | card index | number | required |
| components | card components | object | required |
