This article covers an API method for retrieving a list of templates.
message-matchers/get-by-request Method
A list of templates is retrieved as a result of a completed request using the method-matchers/get-by-request
method. If the request is completed successfully, the server returns code 200
with a JSON object that contains a list of templates. If the request fails, the server returns a response with an error code.
URL
To retrieve the list of templates, send a POST request to the following URL address: https://app.edna.io/api/message-matchers/get-by-request
Request Format
A JSON object is passed in the request body with the following parameters.
{ "subjectId": 23, "matcherTypes": "OPERATOR" }
Parameter | Data type | Descritpion |
subjectId | integer | Subject identifier. To get it, send a request to edna technical support. |
matcherTypes | string (optional) | Template type. Possible values are: • OPERATOR – Operator template (a template that was registered with a service provider)• USER – User template (a template that was created by a user based on an operator template) |
Response Format
As a response to the request, a JSON object that contains a list of templates is returned.
{ "id": 242, "name": "QA_message_matcher_WA_1_opr_name_1", "channelType": "whatsapp", "language": "RU", "content": { "attachment": null, "action": null, "caption": null, "header": null, "text": "QA_message_matcher_WA_1_body_text", "footer": null, "keyboard": { "rows": [ { "buttons": [] } ] } }, "category": "MARKETING", "status": "APPROVED", "locked": true, "type": "USER", "createdAt": "2021-07-15T14:16:54.417024Z", "updatedAt": "2021-07-16T13:08:26.275414Z" }, { "id": 267, "channelType": "whatsapp", "language": "RU", "content": { "attachment": null, "action": null, "caption": null, "header": null, "text": "QA_message_matcher_WA_1_body_text", "footer": null, "keyboard": { "rows": [ { "buttons": [] } ] } }, "category": "MARKETING", "status": "PENDING", "locked": false, "type": "USER", "createdAt": "2021-07-20T09:21:42.444454Z", "updatedAt": "2021-07-20T09:21:42.444454Z" } }
Parameter | Data type | Description |
id | number | Template identifier |
name | string | Template name |
channelType | string | Interaction channel type. Possible values: , ,
|
language | string | Template language |
content | object | Field that defines the template content |
attachment | object | Field that defines the template attachment |
action | string | Action button link. Only for the viber channels |
caption | string | Action button caption. Only for the viber channels |
headerType | string | Header type. If there is no header in the template, headerType is not passed. Only for the whatsapp channels |
header | object | Field that defines the template header. Only for the whatsapp channels |
text | string | Template text |
footer | object | Field that defines the template footer. Only for the whatsapp channels |
keyboard | object | Field that defines a set of buttons. Only for the whatsapp and viber channels |
row s | object | Field that defines a set of buttons. |
buttons | object | Array of objects in each of which a button is defined |
buttonType | string | Button type |
payload | string | Button code |
category | string | Template category. Only for the whatsapp and viber channels |
status | string | Status of the template registration with an operator (service provider) |
locked | boolean | Attribute that defines whether the template is blocked. Possible values are: • TRUE – The template is blocked• FALSE – The template is active |
type | string | Template type. Possible values are: • OPERATOR – Operator template (a template that was registered with a service provider)• USER – User template (a template that was created by a user based on an operator template) |
createdAt | string | Template creation time |
updatedAt | string | Time when the template was last modified |
Request Response Codes
- ok – The request has been succesfully completed
- error-subject-unknown – The specified signature name does not exist
- error-syntax – The channel type is specified incorrectly