Retrieving List of Templates

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"]
}
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)
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"
  }
]
ParameterData typeDescription
idnumberTemplate identifier
namestringTemplate name
channelTypestringInteraction channel type. Possible values are: WHATSAPP, VIBER, SMS.
languagestringTemplate language
contentobjectField that defines the template content
content.attachmentobjectField that defines the template attachment
content.actionstringAction button link. Only for the VIBER channels.
content.captionstringAction button caption. Only for the VIBER channels.
content.headerTypestringHeader type. If there is no header in the template, headerType is not sent. Only for the WHATSAPP channels.
content.headerobjectField that defines the template header. Only for the WHATSAPP channels.
content.textstringTemplate text
content.footerobjectField that defines the template footer. Only for the WHATSAPP channels.
content.keyboardobjectField that defines a set of buttons. Only for the WHATSAPP and VIBER channels.
content.keyboard.rowsobjectField that defines a set of buttons.
content.keyboard.rows.buttonsobjectArray of objects in each of which a button is defined
content.keyboard.rows.buttons.textstringButton label
content.keyboard.rows.buttons.buttonTypestringButton type
content.keyboard.rows.buttons.otpTypestringThe type of one-time password button: COPY_CODE or ONE_TAP
content.keyboard.rows.buttons.urlstringURL to open when a client presses the button
content.keyboard.rows.buttons.urlPostfixstringDynamic part of URL
content.keyboard.rows.buttons.phonestringPhone number to dial when a client presses the button
content.keyboard.rows.buttons.payloadstringQuick reply text
content.keyboard.rows.buttons.urlTextExamplestringURL example provided for template registration
content.keyboard.rows.buttons.autofillTextstringOTP button label. Max length – 25 characters.
content.keyboard.rows.buttons.packageNamestringPackage name for the autofill button
content.keyboard.rows.buttons.hashstringApplication signature hash for the
content.securityRecommendationbooleanShows if the template displays the security recommendation
content.codeExpirationMinutesintegerOTP expiration interval in minutes
contentTypestringTemplate content type. Possible values are: TEXT, IMAGE, BUTTON, DOCUMENT, LOCATION, AUDIO, VIDEO, AUTHENTICATION.
categorystringTemplate category. Only for the WHATSAPP and VIBER channels.
statusstringStatus 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
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