Retrieving List of Templates

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"
}
ParameterData typeDescritpion
subjectIdintegerSubject identifier. To get it, send a request to edna technical support.
matcherTypesstring (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"
        }
    }
ParameterData typeDescription
idnumberTemplate identifier
namestringTemplate name
channelTypestringInteraction channel type. Possible values: WHATSAPP, VIBER, SMS
languagestringTemplate language
contentobjectField that defines the template content
attachmentobjectField that defines the template attachment
actionstringAction button link. Only for the viber channels
captionstringAction button caption. Only for the viber channels
headerTypestringHeader type. If there is no header in the template, headerType is not passed. Only for the whatsapp channels
headerobjectField that defines the template header. Only for the whatsapp channels
textstringTemplate text
footerobjectField that defines the template footer. Only for the whatsapp channels
keyboardobjectField that defines a set of buttons. Only for the whatsapp and viber channels
rowsobjectField that defines a set of buttons.
buttonsobjectArray of objects in each of which a button is defined
buttonTypestringButton type
payloadstringButton code
categorystringTemplate category. Only for the whatsapp and viber channels
statusstringStatus of the template registration with an operator (service provider)
lockedbooleanAttribute that defines whether the template is blocked. Possible values are:

TRUE – The template is blocked
FALSE – The template is active
typestringTemplate 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)
createdAtstringTemplate creation time
updatedAtstringTime 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
Receiving Template Registration Status