Search SMS Template API
Follow
 

BETA

This is a Beta Feature. To enable it, please reach out to your CSM or mail us at support@moenage.com.

The Search SMS Template  API can be used to look up the SMS templates created in your MoEngage account.

API Endpoint

POST https://api-0X.moengage.com/v1.0/custom-templates/sms/search

Each customer is hosted on a different data center; you can find your data center number (value of X) by checking the data center and API endpoint mapping page.

Authentication

Basic authentication sends a Base64-encoded string containing a username and password for all API requests.

Do the following when you are using the API for the first-time authentication:

      1. Navigate to Settings > APIs > TRANSACTION PUSH/REPORT Settings.
      2. Click on the Click here to show APP Secret link to see the APP Secret key.
      3. User name - APP ID and Password - API SECRET

For example, basic Authentication encodes a 'username:password' using base64 encoding and prepends it with the string 'Basic '. The string is passed in the authorization header as follows:

{"Authorization":"Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}

Request Headers

Key Required Sample Values Description

Content-Type

Required

{"Content-Type": "application/json"}

Set the Content-Type header to application/json.

MOE-APPKEY Required

{“MOE-APPKEY”: “APP ID”}

This is the APP ID of your MoEngage account. The MOE-APPKEY has to be passed along with the request. You can find your MoEngage APP ID in the MoEngage Dashboard API Settings. Navigation: Settings -> APIs -> General Settings -> TRANSACTION PUSH/REPORT Settings section. For more information, refer to Authentication.

 

Request Body

Key Required Values Description
page Optional Integer This field contains the index of the pages to be returned in the search result.
entries Optional Integer This field contains the number of entries per page in the search result. 
template_name Optional String This field indicates the name of the template. When this value is specified, the template that matches the name specified in this field will be returned.
platform Optional List This field indicates the list of platforms. Allowed values: ANDROID, IOS. When specified, the templates whose platform matches that specified in this list will be returned.
template_source Optional List This field indicates the template source that created the template. For example: ["AEM", "MOENGAGE"]. When specified, the templates whose source matches that specified in this list will be returned.
template_type Optional List This field indicates whether the template is a custom one or a pre-built one. Allowed values: CUSTOM, PRE_BUILT. When specified, the templates whose template type matches that specified in this list will be returned.
created_by Optional List

This field indicates the user who created the template. When specified, the templates for which the created_by user information matches that specified in this list will be returned. 

Example: ["user1@moengage.com", "user2@moengage.com"]

updated_by Optional List

This field indicates the user who updated the template. When specified, the templates for which the updated_by user information matches that specified in this list will be returned.

Example: ["user1@moengage.com", "user2@moengage.com"]

sort_params Optional

List of attributes and sort orders

This field indicates the sorting parameters for the search result and the sort order.

Example:

"sort_params":[{"template_name": "ASCENDING","last_modified_date": "ASCENDING","last_modified_by": "ASCENDING"}]

template_ids Optional

List of template ids

This field indicates the list of the template ids that must be fetched. When this value is specified, the template that matches the id specified in this field will be returned.

Example:

"template_ids":[{"external_template_id": "e1c95cb8-4f15-4f22-ae73-e9f47c9925c8", "version": 1}]

Note:

  1. You can send empty filters to fetch all the SMS templates.
  2. You can send only template_ids if you want specific older versions of the SMS template. In other cases, you will receive the latest version of the template.

Response

Key Data Type Description
data Array of JSON Objecys

This field contains the list of the SMS templates that satisfy the search criteria.

"data": [
  {
        "external_template_id": "<template_id",
        "version": 1,
        "basic_details": {"message":"<SMS to be sent to the user>"},

        "meta_info": {<teamplate's meta info>},

        "created_by": "<created by user name>",
        "created_at": "<timestamp>",
        "updated_by": "<created by user name>",
        "updated_at": "<timestamp>"

  }

 {...}

]

For information about the basic_details and meta_info objects, refer to Template Details. <add link to Create SMS API's Template Details section - to be done once the doc is published>
 

title String This field contains a brief description of the error.
description String This field contains a description of the error.
code String This field contains the error code.
message String This field contains the error message.

Response Codes

Status Code Request State Description

200

Success

This response is returned when the request is processed successfully. 

400

Bad Request

This response is returned when the required parameters are missing from the request or when the provided parameters are invalid, or when a template already exists with the same version, name, or id.

429

Rate Limit Breach

This response is returned when the number of requests per minute has exceeded the rate limit.

5xx

Internal Server Error

This response is returned when the system runs into an unexpected error.

Rate Limit

The rate limit is 100 RPM. 

Sample cURL Request


curl --location 'https://api-0X.moengage.com/v1.0/custom-templates/sms/search'\
--header 'MOE-APPKEY: {{APP-KEY}}\
--header 'Content-Type: application/json' \
--data '{
    "template_name": "Basic",
}'

Sample Response

200 400 5xx

Sample Response for a successful request
{
  "data": [
  {
      "external_template_id": "b564524f-aa08-4149-a498-dbde0b7b3740",
      "version": 1,
      "basic_details": {
         "message": "Sample SMS Template message"
       },
      "meta_info": {
        "template_id": "Stylizedandroid1",
        "template_name": "Stylized Android Template 2",
        "template_version": "1",
        "created_by": "Jane Doe",
        "channel": "SMS",
        "template_type": "CUSTOM"
      },
      "created_by": "Jane Doe",
      "created_at": "2023-02-27T12:33:05.575000",
      "updated_by": "John Doe",
      "updated_at": "2023-02-27T12:33:05.575000"
  }
  ]
}

Postman Collections

We have made it easy for you to test the APIs. Click here to view it in Postman.

 
 
Was this article helpful?
0 out of 0 found this helpful