MessageTemplate

MessageTemplate is a resource that represents a template for a message that can be sent to a candidate. It can be used in the initial message of a FlowRun. Or as a standalone message. MessageTemplates are a proxy of WhatsApp templates.

This means it is a requirement to have a WhatsApp Business Account/number connected to the platform to create these messages. However, the MessageTemplate can be used to send messages to any channel, not just WhatsApp.

Currently it is not possible to update a MessageTemplate after it has been created.

Endpoints

  • GET /message-templates - Retrieve a list of all MessageTemplates.

  • GET /message-templates/{id} - Retrieve a specific MessageTemplate by ID.

  • POST /message-templates - Create a new MessageTemplate.

  • DELETE /message-templates/{id} - Delete a specific MessageTemplate by ID.

Attributes

Field
Type
Description

name

String

The name of the message template. This is displayed in the message payload.

components

Array

language

String

The language of the message template. This is used by Meta while validating the message template.

category

String

The category of the message template. This can be Marketing, Utility or Authorization.

status

String

The status of the message template.

preview

String

The preview text of the message template.

createdAt

DateTime

The timestamp when the message template was created.

updatedAt

DateTime

The timestamp when the message template was last updated.

Components

Field
Type
Description

text

String

The text content of the component.

type

String

The type of the component. Can be HEADER, BODY, or FOOTER.

format

String

The format of the component, only required for the header.

example

JSON object

The example usage of the component. Only required when using variables.

See Components for more information on the components.

We only support text format for the components at this moment

At this time the header and footer components are not supported in the web preview, but they will work on other channels.

Example POST body

{
  "data": {
    "type": "messageTemplates",
    "attributes": {
      "name": "start_application",
      "components": [
        {
          "text":"Recrubo application!",
          "type": "HEADER",
          "format": "Text"

        },
        {
          "text": "Hi {{1}}, great to see you want to work with us! Reply to this message to schedule your interview.",
          "type": "BODY",
          "example": {
            "body_text": [
              [
                "John"
              ]
            ]
          }
        },
        {
          "text": "Team Recrubo",
          "type": "FOOTER"
        }
      ],
      "language": "en",
      "category": "MARKETING",
      "preview": "Hi {{1}}, great to see you want to work with us! Reply to this message to schedule your interview."
    }
  }
}

Validation errors

Validation is done by The WhatsApp servers at Meta, we will pass the validation errors back to you in the response.

Example validation error response

{
  "errors": [
    {
      "code": "bad_request",
      "status": 400,
      "title": "Bad Request",
      "detail": {
        "message": "Invalid parameter",
        "type": "OAuthException",
        "code": 100,
        "error_subcode": 2388024,
        "is_transient": false,
        "error_user_title": "Content in this language already exists",
        "error_user_msg": "There is already English content for this template. You can create a new template and try again.",
        "fbtrace_id": "AeodpEogjjeg5cgl43HljgP"
      }
    }
  ]
}

OpenAPI

Create a MessageTemplate

post
Authorizations
Body
Responses
201

message_template created

application/vnd.api+json
post
POST /public/v2/message-templates HTTP/1.1
Host: {defaulthost}
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 137

{
  "data": {
    "id": "text",
    "type": "text",
    "attributes": {
      "name": "text",
      "components": [],
      "language": "en",
      "category": "Marketing",
      "preview": "text"
    }
  }
}
{
  "data": {
    "id": "e28a0e38-1b2f-4cc2-82e8-b49101ea2df4",
    "type": "messageTemplates",
    "attributes": {
      "createdAt": "2024-08-20T10:45:08+00:00",
      "updatedAt": "2024-08-20T10:45:08+00:00",
      "name": "contact_request",
      "components": [
        {
          "text": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker",
          "type": "BODY"
        }
      ],
      "language": "nl",
      "category": "some_category",
      "status": "some_status",
      "preview": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker"
    },
    "relationships": {
      "user": {
        "links": {
          "related": null
        }
      }
    }
  },
  "meta": {}
}

Retrieve a single message_template

get
Authorizations
Path parameters
idstringRequired
Responses
200

message_template found

application/vnd.api+json
get
GET /public/v2/message-templates/{id} HTTP/1.1
Host: {defaulthost}
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "id": "1b38de11-5735-487f-9de4-10c500c37e3e",
    "type": "messageTemplates",
    "attributes": {
      "createdAt": "2024-08-20T10:45:08+00:00",
      "updatedAt": "2024-08-20T10:45:08+00:00",
      "name": "contact_request",
      "components": [
        {
          "text": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker",
          "type": "BODY"
        }
      ],
      "language": "nl",
      "category": "TRANSACTIONAL",
      "status": "approved",
      "preview": "Hey! Wat leuk dat je interesse hebt in een baan bij Blokker. 😁 \n \nAntwoord met start om de sollicitatie te starten."
    },
    "relationships": {
      "user": {
        "links": {
          "related": null
        }
      }
    }
  },
  "meta": {}
}

Retrieve all MessageTemplates

get
Authorizations
Responses
200

message_templates found

application/vnd.api+json
get
GET /public/v2/message-templates HTTP/1.1
Host: {defaulthost}
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "id": "760063d0-f554-4dcd-af0f-bfc763a640d0",
      "type": "messageTemplates",
      "attributes": {
        "createdAt": "2024-08-20T10:45:08+00:00",
        "updatedAt": "2024-08-20T10:45:08+00:00",
        "name": "contact_request",
        "components": [
          {
            "text": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker",
            "type": "BODY"
          }
        ],
        "language": "nl",
        "category": "TRANSACTIONAL",
        "status": "approved",
        "preview": "Hey! Wat leuk dat je interesse hebt in een baan bij Blokker. 😁 \n \nAntwoord met start om de sollicitatie te starten."
      },
      "relationships": {
        "user": {
          "links": {
            "related": null
          }
        }
      }
    },
    {
      "id": "cb5bb820-6d28-4624-9796-91456a249c4a",
      "type": "messageTemplates",
      "attributes": {
        "createdAt": "2024-08-20T10:45:08+00:00",
        "updatedAt": "2024-08-20T10:45:08+00:00",
        "name": "contact_request",
        "components": [
          {
            "text": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker",
            "type": "BODY"
          }
        ],
        "language": "nl",
        "category": "TRANSACTIONAL",
        "status": "approved",
        "preview": "Hey! Wat leuk dat je interesse hebt in een baan bij Blokker. 😁 \n \nAntwoord met start om de sollicitatie te starten."
      },
      "relationships": {
        "user": {
          "links": {
            "related": null
          }
        }
      }
    },
    {
      "id": "2fd7c499-0ba2-48ff-a60e-c0ade0f603e4",
      "type": "messageTemplates",
      "attributes": {
        "createdAt": "2024-08-20T10:45:08+00:00",
        "updatedAt": "2024-08-20T10:45:08+00:00",
        "name": "contact_request",
        "components": [
          {
            "text": "Hi {{1}}, enige tijd geleden heb je bij Blokker gesolliciteerd. Heb je nog steeds interesse in de vacature? Klik op ja/nee knop hieronder, indien jouw antwoord ja is nemen we contact met je op. Gr. Team Blokker",
            "type": "BODY"
          }
        ],
        "language": "nl",
        "category": "TRANSACTIONAL",
        "status": "approved",
        "preview": "Hey! Wat leuk dat je interesse hebt in een baan bij Blokker. 😁 \n \nAntwoord met start om de sollicitatie te starten."
      },
      "relationships": {
        "user": {
          "links": {
            "related": null
          }
        }
      }
    }
  ],
  "meta": {
    "total": 3,
    "totalUnfiltered": 3,
    "currentSize": 25,
    "currentPage": 1,
    "maxPage": 1
  }
}

Destroy a Candidate

delete
Authorizations
Path parameters
idstringRequired
Responses
204

candidate destroyed

No content

delete
DELETE /public/v2/candidates/{id} HTTP/1.1
Host: {defaulthost}
Authorization: YOUR_API_KEY
Accept: */*

No content

Destroy a MessageTemplate

delete
Authorizations
Path parameters
idstringRequired
Responses
204

message_template destroyed

No content

delete
DELETE /public/v2/message-templates/{id} HTTP/1.1
Host: {defaulthost}
Authorization: YOUR_API_KEY
Accept: */*

No content

Last updated