Skip to content

Create a template in project
GA

Request

Creates a new template with the request data. If the status field is set to submit the template will be created immediately, otherwise it will be saved as a draft.

Security
BasicAuth and BearerAuth and OAuth2Production
Path
projectIdstringrequired

The unique ID of the project. You can find this on the Sinch Dashboard.

Bodyapplication/jsonrequired

Template data

namestring, <= 512 characters^[a-z0-9][a-z0-9_]*[a-z0-9]$required
languagestring(WhatsappInputTemplateLanguages)required
Enum:"AF""AR""AZ""BG""BN""CA""CS""DA""DE""EL"
categorystring(WhatsappTemplateInputCategory)required
Enum:"AUTHENTICATION""MARKETING""UTILITY"
detailsobject(WhatsappTemplateDetailsInputDto)required

'Template input details and information.' Not required for draft.

statusstring(WhatsappActions)

Create as draft or submit. Defaults to submit.

Default:"SUBMIT"
Enum:"DRAFT""SUBMIT"
saveDraftOnFailureboolean

Flag to save template as draft if submission fails. Defaults to false.

Default:false
allowCategoryChangeboolean

True if Meta should be allowed to change the category if they determine the category is wrong. If false, Meta might reject the template if they determine the category is wrong based on the template contents. Defaults to false.

Default:false

Full body to create a Marketing or Utility template.

curl -i -X POST \
  -u '<username>:<password>' \
  'https://provisioning.api.sinch.com/v1/projects/{projectId}/whatsapp/templates' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "my_template",
    "category": "MARKETING",
    "language": "EN",
    "details": {
      "components": [
        {
          "type": "HEADER",
          "format": "LOCATION"
        },
        {
          "type": "HEADER",
          "format": "TEXT",
          "text": "Save {{1}}% on your next purchase!",
          "example": "20"
        },
        {
          "type": "HEADER",
          "format": "DOCUMENT",
          "example": {
            "url": "https://example.com/photos/1.png"
          }
        },
        {
          "type": "BODY",
          "text": "Good morning {{1}}, your package has arrived.",
          "examples": [
            "Mr. Smith"
          ],
          "addSecurityRecommendation": true
        },
        {
          "type": "FOOTER",
          "text": "To track your order please click the '\''Track Your Order'\'' button",
          "codeExpirationMinutes": 5
        },
        {
          "type": "BUTTONS",
          "buttons": [
            {
              "type": "PHONE_NUMBER",
              "text": "Example text.",
              "phoneNumber": "+48 777 777777"
            },
            {
              "type": "URL",
              "text": "Example test",
              "url": "https://www.my-website.com?name={{1}}",
              "example": "https://www.my-website.com?name=john"
            },
            {
              "type": "QUICK_REPLY",
              "text": "Track Your Order"
            },
            {
              "type": "OTP",
              "otpType": "COPY_CODE",
              "text": "Example text."
            },
            {
              "type": "FLOW",
              "text": "Start Flow",
              "flowId": "flow-id",
              "navigateScreen": "QUESTION_ONE",
              "flowAction": "NAVIGATE"
            },
            {
              "type": "REQUEST_CONTACT_INFO"
            }
          ]
        },
        {
          "type": "CAROUSEL",
          "cards": [
            {
              "components": [
                {
                  "type": "HEADER",
                  "format": "IMAGE",
                  "example": {
                    "url": "https://example.com/photos/1.png"
                  }
                },
                {
                  "type": "BODY",
                  "text": "Good morning {{1}}, your package has arrived.",
                  "examples": [
                    "Mr. Smith"
                  ]
                },
                {
                  "type": "BUTTONS",
                  "buttons": [
                    {
                      "type": "URL",
                      "text": "Example test",
                      "url": "https://www.my-website.com?name={{1}}",
                      "example": "https://www.my-website.com?name=john"
                    },
                    {
                      "type": "QUICK_REPLY",
                      "text": "Track Your Order"
                    },
                    {
                      "type": "PHONE_NUMBER",
                      "text": "Example text.",
                      "phoneNumber": "+48 777 777777"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  }'

Responses

Created template

Bodyapplication/json
namestringrequired
languagestring(WhatsappTemplateLanguages)required
Enum:"AF""AR""AZ""BG""BN""CA""CS""DA""DE""EL"
categorystring(WhatsappTemplateCategory)required
Enum:"AUTHENTICATION""MARKETING""UTILITY""UNRECOGNIZED"
analyticsArray of objects(WhatsappTemplateAnalyticsDto)required

Template analytics.

isMetaGeneratedbooleanrequired

Indicates if the template was auto-generated by Meta.

whatsappIdstring
statestring(WhatsappTemplateStates)
Enum:"APPROVED""DISABLED""PAUSED""REJECTED"
rejectionCodestring(WhatsappTemplateRejectionCode)

Rejection code if template is in status 'REJECTED'

Enum:"ABUSIVE_CONTENT""INCORRECT_CATEGORY""INVALID_FORMAT""NONE""SCAM""UNRECOGNIZED"
qualityScorestring(WhatsappTemplateQualityScore)

Quality score of the HSM.

Enum:"QUALITY_SCORE_GREEN""QUALITY_SCORE_RED""QUALITY_SCORE_YELLOW""QUALITY_SCORE_UNKNOWN""UNRECOGNIZED"
changesobject(WhatsappTemplateChangesDto)

Object containing changes on the template. If empty the changes has been approved and applied to the template.

detailsobject(WhatsappTemplateDetailsDto)

Template details and information.

Response

Response when successfully creating a template.

{ "name": "My WhatsApp Template", "category": "UTILITY", "language": "EN_US", "qualityScore": "QUALITY_SCORE_GREEN", "changes": { "status": "DRAFT", "details": { … } }, "analytics": [], "isMetaGenerated": false }

Callbacks

WhatsApp Template received a comment
post
WhatsApp Template approved
post
WhatsApp Template rejected
post
WhatsApp Template status updated
post
WhatsApp Template deleted
post
WhatsApp Template quality score updated
post
WhatsApp Template category updated
post
WhatsApp Template category coming update
post
We'd love to hear from you!
Rate this content: