This article covers an API method for retrieving a list of templates.
message-matchers/get-by-request Method
The method-matchers/get-by-request
method returns code 200
with a JSON object that contains the list of templates for the specified subject ID. If the request fails, the server returns a response with an error code.
For instructions on getting subject IDs for your channels, see Receiving List of Channels.
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 sent in the request body with the following parameters.
{ "subjectId": 23, "matcherTypes": ["OPERATOR","USER","CUSTOM"] }
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)• CUSTOM — Template that you create from scratch. It can contain any content that is allowed for this channel |
Response Format
As a response to the request, a JSON object that contains a list of templates is returned.
[ { "id": 0, "name": "string", "channelType": "SMS", "language": "string", "content": { "attachment": { "id": 0, "fileUrl": "string", "originalFileName": "string", "size": 0 }, "action": "string", "caption": "string", "header": { "headerType": "TEXT", "text": "string", "attachment": { "id": 0, "fileUrl": "string", "originalFileName": "string", "size": 0 }, "headerExampleTextParam": "string", "headerExampleMediaUrl": "string" }, "text": "string", "footer": { "text": "string" }, "keyboard": { "rows": [ { "buttons": [ { "text": "string", "buttonType": "PHONE", "otpType": "COPY_CODE", "url": "string", "urlPostfix": "string", "phone": "string", "payload": "string", "urlTextExample": "string", "autofillText": "string", "packageName": "string", "hash": "string", } ] } ] }, "securityRecommendation": true, "codeExpirationMinutes": 90, "textExampleParams": [ "string" ], }, "contentType": "TEXT", "category": "ACCOUNT_UPDATE", "status": "string", "locked": true, "type": "OPERATOR", "createdAt": "2023-08-31T14:56:44.225Z", "updatedAt": "2023-08-31T14:56:44.225Z" } ]
Parameter | Data type | Description |
id | number | Template identifier |
name | string | Template name |
channelType | string | Interaction channel type. Possible values are: WHATSAPP, VIBER, SMS. |
language | string | Template language |
content | object | Field that defines the template content |
content.attachment | object | Field that defines the template attachment |
content.action | string | Action button link. Only for the VIBER channels. |
content.caption | string | Action button caption. Only for the VIBER channels. |
content.headerType | string | Header type. If there is no header in the template, headerType is not sent. Only for the WHATSAPP channels. |
content.header | object | Field that defines the template header. Only for the WHATSAPP channels. |
content.text | string | Template text |
content.footer | object | Field that defines the template footer. Only for the WHATSAPP channels. |
content.keyboard | object | Field that defines a set of buttons. Only for the WHATSAPP and VIBER channels. |
content.keyboard.rows | object | Field that defines a set of buttons. |
content.keyboard.rows.buttons | object | Array of objects in each of which a button is defined |
content.keyboard.rows.buttons.text | string | Button label |
content.keyboard.rows.buttons.buttonType | string | Button type |
content.keyboard.rows.buttons.otpType | string | The type of one-time password button: COPY_CODE or ONE_TAP |
content.keyboard.rows.buttons.url | string | URL to open when a client presses the button |
content.keyboard.rows.buttons.urlPostfix | string | Dynamic part of URL |
content.keyboard.rows.buttons.phone | string | Phone number to dial when a client presses the button |
content.keyboard.rows.buttons.payload | string | Quick reply text |
content.keyboard.rows.buttons.urlTextExample | string | URL example provided for template registration |
content.keyboard.rows.buttons.autofillText | string | OTP button label. Max length – 25 characters. |
content.keyboard.rows.buttons.packageName | string | Package name for the autofill button |
content.keyboard.rows.buttons.hash | string | Application signature hash for the |
content.securityRecommendation | boolean | Shows if the template displays the security recommendation |
content.codeExpirationMinutes | integer | OTP expiration interval in minutes |
contentType | string | Template content type. Possible values are: TEXT, IMAGE, BUTTON, DOCUMENT, LOCATION, AUDIO, VIDEO, AUTHENTICATION. |
category | string | Template category. Only for the WHATSAPP and VIBER channels. |
status | string | Status of the template registration with an operator (service provider). Possible values are: • APPROVED — active template. Only approved templates can be used for sending messages. • REJECTED — rejected by the operator • PENDING — registration is in progress • NOT_SENT — draft • ARCHIVED — archived • PAUSED — paused • DISABLED — disabled |
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