Get Available Templates API

Overview

Updated 25 October 2023 We have stopped onboarding new agencies to the Gov.sg WhatsApp channel

This endpoint returns information about the available message templates for your account that can be used to send out Gov.sg WhatsApp messages.

Get available templates for GovSG channel

GET/v1/govsg/templates
Authorization
Response

Success

Body
data*array of GovSGTemplate (object)
Request
const response = await fetch('/v1/govsg/templates', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
{
  "data": [
    {
      "id": 0,
      "body": "text",
      "params": [
        "text"
      ],
      "multilingual_support": [
        {
          "language_code": "zh_CN",
          "language": "Chinese (CHN)",
          "body": "text"
        }
      ]
    }
  ]
}

API Response

For general information about our API response formats, see here.

Example Response

{
  "data": [
    {
      "id": 1,
      "body": "<b>From</b>: {{ agency }}\n<b>Subject</b>: Upcoming phone call\n\nDear {{ recipient_name }},\nWe will be calling you today between {{ timeslot }} about {{ topic }}. We request your availability during this period.\n\nSincerely,\n{{ officer_name }}\n{{ officer_designation }}\n{{ agency }}\n\n<i>This is an automated message. Please do not reply.</i>",
      "params": [
        "agency",
        "recipient_name",
        "timeslot",
        "topic",
        "officer_name",
        "officer_designation"
      ],
      "param_metadata": {
        "topic": {
          "displayName": "Topic"
        },
        "agency": {
          "defaultFromMetaField": "agency"
        },
        "timeslot": {
          "displayName": "Timeslot"
        },
        "officer_name": {
          "defaultFromMetaField": "officer_name"
        },
        "recipient_name": {
          "displayName": "Recipient Name"
        },
        "officer_designation": {
          "defaultFromMetaField": "officer_designation"
        }
      },
      "name": "Notify users of an upcoming call",
      "multilingual_support": [
        {
          "languageCode": "zh_CN",
          "language": "Chinese",
          "body": "<b>From</b>: {{ agency }}\n<b>Subject</b>: Upcoming phone call\n\nDear {{ recipient_name }},\nWe will be calling you today between {{ timeslot }} about {{ topic }}. We request your availability during this period.\n\nSincerely,\n{{ officer_name }}\n{{ officer_designation }}\n{{ agency }}\n\n<i>This is an automated message. Please do not reply.</i>"
        }
      ]
    }
  ]
}

Theid and languageCode fields will be used in the sending endpoint later to indicate the specific template and lingual variation that you want to send your message out using.

Last updated