# Create Whatsapp Template

`POST /v1/whatsapp/templates`

Create a template, shared by every number on the Twilio account, and submit it to WhatsApp.

Review usually takes minutes; poll `list_whatsapp_templates` for `status`. Twilio only.

Authenticate with `Authorization: Bearer $TALQING_API_KEY`. Errors use the shared envelope: https://docs.talqing.com/api-reference/errors.md

## OpenAPI

```json
{
 "openapi":"3.1.0",
 "servers":[
  {
   "description":"Talqing API",
   "url":"https://api.talqing.com"
  }
 ],
 "paths":{
  "/v1/whatsapp/templates":{
   "post":{
    "description":"Create a template, shared by every number on the Twilio account, and submit it to WhatsApp.\n\nReview usually takes minutes; poll `list_whatsapp_templates` for `status`. Twilio only.",
    "operationId":"whatsapp.templates.create",
    "requestBody":{
     "content":{
      "application/json":{
       "schema":{
        "$ref":"#/components/schemas/CreateWhatsAppTemplateRequest"
       }
      }
     },
     "required":true
    },
    "responses":{
     "201":{
      "content":{
       "application/json":{
        "schema":{
         "$ref":"#/components/schemas/WhatsAppTemplate"
        }
       }
      },
      "description":"Successful Response"
     },
     "400":{
      "$ref":"#/components/responses/BadRequest"
     },
     "401":{
      "$ref":"#/components/responses/Unauthorized"
     },
     "403":{
      "$ref":"#/components/responses/Forbidden"
     },
     "409":{
      "$ref":"#/components/responses/Conflict"
     },
     "422":{
      "$ref":"#/components/responses/ValidationFailed"
     },
     "default":{
      "$ref":"#/components/responses/Error"
     }
    },
    "security":[
     {
      "BearerAuth":[]
     },
     {
      "SessionCookie":[]
     }
    ],
    "summary":"Create Whatsapp Template",
    "tags":[
     "whatsapp"
    ]
   }
  }
 },
 "components":{
  "responses":{
   "BadRequest":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Well-formed, but rejected by a rule; `detail.errors` lists each problem."
   },
   "Conflict":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The resource's current state forbids this \u2014 a name already taken, a job already running."
   },
   "Error":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Unexpected error. Every error this API returns carries this body."
   },
   "Forbidden":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Authenticated, but this organization role may not perform the operation."
   },
   "Unauthorized":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Missing credential, or one that is revoked or no longer a member of this organization."
   },
   "ValidationFailed":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The request did not match this operation's schema; `detail.errors` lists each field."
   }
  },
  "schemas":{
   "CreateWhatsAppTemplateRequest":{
    "additionalProperties":false,
    "properties":{
     "body":{
      "description":"Variables are named: `{{first_name}}`.",
      "minLength":1,
      "title":"Body",
      "type":"string"
     },
     "buttons":{
      "items":{
       "discriminator":{
        "mapping":{
         "copy_code":"#/components/schemas/WhatsAppTemplateCopyCodeButtonInput",
         "phone_number":"#/components/schemas/WhatsAppTemplatePhoneButtonInput",
         "quick_reply":"#/components/schemas/WhatsAppTemplateQuickReplyButtonInput",
         "url":"#/components/schemas/WhatsAppTemplateUrlButtonInput",
         "voice_call":"#/components/schemas/WhatsAppTemplateVoiceCallButtonInput"
        },
        "propertyName":"type"
       },
       "oneOf":[
        {
         "$ref":"#/components/schemas/WhatsAppTemplateQuickReplyButtonInput"
        },
        {
         "$ref":"#/components/schemas/WhatsAppTemplateUrlButtonInput"
        },
        {
         "$ref":"#/components/schemas/WhatsAppTemplatePhoneButtonInput"
        },
        {
         "$ref":"#/components/schemas/WhatsAppTemplateVoiceCallButtonInput"
        },
        {
         "$ref":"#/components/schemas/WhatsAppTemplateCopyCodeButtonInput"
        }
       ]
      },
      "title":"Buttons",
      "type":"array"
     },
     "category":{
      "enum":[
       "marketing",
       "utility"
      ],
      "title":"Category",
      "type":"string"
     },
     "examples":{
      "additionalProperties":{
       "type":"string"
      },
      "description":"A realistic sample for every variable; WhatsApp reviews them.",
      "title":"Examples",
      "type":"object"
     },
     "footer":{
      "anyOf":[
       {
        "minLength":1,
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Footer"
     },
     "header":{
      "anyOf":[
       {
        "discriminator":{
         "mapping":{
          "document":"#/components/schemas/WhatsAppTemplateMediaHeaderInput",
          "image":"#/components/schemas/WhatsAppTemplateMediaHeaderInput",
          "text":"#/components/schemas/WhatsAppTemplateTextHeaderInput",
          "video":"#/components/schemas/WhatsAppTemplateMediaHeaderInput"
         },
         "propertyName":"type"
        },
        "oneOf":[
         {
          "$ref":"#/components/schemas/WhatsAppTemplateTextHeaderInput"
         },
         {
          "$ref":"#/components/schemas/WhatsAppTemplateMediaHeaderInput"
         }
        ]
       },
       {
        "type":"null"
       }
      ],
      "title":"Header"
     },
     "integration_id":{
      "description":"A Twilio WhatsApp sender; the template is account-wide.",
      "format":"uuid",
      "title":"Integration Id",
      "type":"string"
     },
     "language":{
      "description":"One of the catalog's `whatsapp_template_languages`.",
      "title":"Language",
      "type":"string"
     },
     "name":{
      "description":"Lowercase letters, digits and `_`.",
      "title":"Name",
      "type":"string"
     }
    },
    "required":[
     "integration_id",
     "name",
     "language",
     "category",
     "body"
    ],
    "title":"CreateWhatsAppTemplateRequest",
    "type":"object"
   },
   "ErrorBody":{
    "description":"The structured half of our error contract: a human `message` plus a list\nof individual `errors` (used wherever we surface many problems at once,\nincluding tool publish, op-tree checks, and request validation). The global\nexception handlers normalize every API error to\n`{detail: {message, errors, code}}`, so SDKs can parse one shape consistently.",
    "properties":{
     "code":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "default":null,
      "description":"A stable identifier for this error, when it has one.",
      "title":"Code"
     },
     "errors":{
      "items":{
       "type":"string"
      },
      "title":"Errors",
      "type":"array"
     },
     "message":{
      "title":"Message",
      "type":"string"
     }
    },
    "required":[
     "message",
     "errors"
    ],
    "title":"ErrorBody",
    "type":"object"
   },
   "ErrorResponse":{
    "description":"The body of every error response, at every status code.",
    "properties":{
     "detail":{
      "$ref":"#/components/schemas/ErrorBody"
     }
    },
    "required":[
     "detail"
    ],
    "title":"ErrorResponse",
    "type":"object"
   },
   "WhatsAppTemplate":{
    "description":"A template and where WhatsApp's review of it stands. Only `approved` can be sent.",
    "properties":{
     "body":{
      "title":"Body",
      "type":"string"
     },
     "buttons":{
      "items":{
       "$ref":"#/components/schemas/WhatsAppTemplateButton"
      },
      "title":"Buttons",
      "type":"array"
     },
     "category":{
      "enum":[
       "marketing",
       "utility",
       "authentication"
      ],
      "title":"Category",
      "type":"string"
     },
     "created_at":{
      "format":"date-time",
      "title":"Created At",
      "type":"string"
     },
     "examples":{
      "additionalProperties":{
       "type":"string"
      },
      "title":"Examples",
      "type":"object"
     },
     "footer":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Footer"
     },
     "header":{
      "anyOf":[
       {
        "$ref":"#/components/schemas/WhatsAppTemplateHeader"
       },
       {
        "type":"null"
       }
      ]
     },
     "id":{
      "title":"Id",
      "type":"string"
     },
     "language":{
      "title":"Language",
      "type":"string"
     },
     "name":{
      "title":"Name",
      "type":"string"
     },
     "rejection_reason":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Rejection Reason"
     },
     "status":{
      "enum":[
       "pending",
       "approved",
       "rejected",
       "paused",
       "disabled"
      ],
      "title":"Status",
      "type":"string"
     },
     "unsupported_reason":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Unsupported Reason"
     },
     "variables":{
      "items":{
       "type":"string"
      },
      "title":"Variables",
      "type":"array"
     }
    },
    "required":[
     "id",
     "name",
     "language",
     "category",
     "header",
     "body",
     "footer",
     "buttons",
     "variables",
     "status",
     "rejection_reason",
     "created_at",
     "examples",
     "unsupported_reason"
    ],
    "title":"WhatsAppTemplate",
    "type":"object"
   },
   "WhatsAppTemplateButton":{
    "properties":{
     "code":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Code"
     },
     "phone_number":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Phone Number"
     },
     "text":{
      "title":"Text",
      "type":"string"
     },
     "ttl_minutes":{
      "anyOf":[
       {
        "type":"integer"
       },
       {
        "type":"null"
       }
      ],
      "title":"Ttl Minutes"
     },
     "type":{
      "enum":[
       "url",
       "phone_number",
       "quick_reply",
       "copy_code",
       "voice_call"
      ],
      "title":"Type",
      "type":"string"
     },
     "url":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Url"
     }
    },
    "required":[
     "type",
     "text",
     "url",
     "phone_number",
     "code",
     "ttl_minutes"
    ],
    "title":"WhatsAppTemplateButton",
    "type":"object"
   },
   "WhatsAppTemplateCopyCodeButtonInput":{
    "additionalProperties":false,
    "description":"WhatsApp labels it \"Copy Code\".",
    "properties":{
     "code":{
      "minLength":1,
      "title":"Code",
      "type":"string"
     },
     "type":{
      "const":"copy_code",
      "title":"Type",
      "type":"string"
     }
    },
    "required":[
     "type",
     "code"
    ],
    "title":"WhatsAppTemplateCopyCodeButtonInput",
    "type":"object"
   },
   "WhatsAppTemplateHeader":{
    "properties":{
     "text":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Text"
     },
     "type":{
      "enum":[
       "text",
       "image",
       "video",
       "document"
      ],
      "title":"Type",
      "type":"string"
     },
     "url":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Url"
     }
    },
    "required":[
     "type",
     "text",
     "url"
    ],
    "title":"WhatsAppTemplateHeader",
    "type":"object"
   },
   "WhatsAppTemplateMediaHeaderInput":{
    "additionalProperties":false,
    "properties":{
     "type":{
      "enum":[
       "image",
       "video",
       "document"
      ],
      "title":"Type",
      "type":"string"
     },
     "url":{
      "description":"A public https file; WhatsApp downloads it.",
      "minLength":1,
      "title":"Url",
      "type":"string"
     }
    },
    "required":[
     "type",
     "url"
    ],
    "title":"WhatsAppTemplateMediaHeaderInput",
    "type":"object"
   },
   "WhatsAppTemplatePhoneButtonInput":{
    "additionalProperties":false,
    "properties":{
     "phone_number":{
      "minLength":1,
      "title":"Phone Number",
      "type":"string"
     },
     "text":{
      "minLength":1,
      "title":"Text",
      "type":"string"
     },
     "type":{
      "const":"phone_number",
      "title":"Type",
      "type":"string"
     }
    },
    "required":[
     "type",
     "text",
     "phone_number"
    ],
    "title":"WhatsAppTemplatePhoneButtonInput",
    "type":"object"
   },
   "WhatsAppTemplateQuickReplyButtonInput":{
    "additionalProperties":false,
    "properties":{
     "text":{
      "minLength":1,
      "title":"Text",
      "type":"string"
     },
     "type":{
      "const":"quick_reply",
      "title":"Type",
      "type":"string"
     }
    },
    "required":[
     "type",
     "text"
    ],
    "title":"WhatsAppTemplateQuickReplyButtonInput",
    "type":"object"
   },
   "WhatsAppTemplateTextHeaderInput":{
    "additionalProperties":false,
    "properties":{
     "text":{
      "minLength":1,
      "title":"Text",
      "type":"string"
     },
     "type":{
      "const":"text",
      "title":"Type",
      "type":"string"
     }
    },
    "required":[
     "type",
     "text"
    ],
    "title":"WhatsAppTemplateTextHeaderInput",
    "type":"object"
   },
   "WhatsAppTemplateUrlButtonInput":{
    "additionalProperties":false,
    "properties":{
     "text":{
      "minLength":1,
      "title":"Text",
      "type":"string"
     },
     "type":{
      "const":"url",
      "title":"Type",
      "type":"string"
     },
     "url":{
      "description":"May end in one variable, after a `/`.",
      "minLength":1,
      "title":"Url",
      "type":"string"
     }
    },
    "required":[
     "type",
     "text",
     "url"
    ],
    "title":"WhatsAppTemplateUrlButtonInput",
    "type":"object"
   },
   "WhatsAppTemplateVoiceCallButtonInput":{
    "additionalProperties":false,
    "description":"Starts a WhatsApp call to the sending number.",
    "properties":{
     "text":{
      "minLength":1,
      "title":"Text",
      "type":"string"
     },
     "ttl_minutes":{
      "anyOf":[
       {
        "maximum":43200.0,
        "minimum":1.0,
        "type":"integer"
       },
       {
        "type":"null"
       }
      ],
      "description":"How long the button works after sending. Default 7 days.",
      "title":"Ttl Minutes"
     },
     "type":{
      "const":"voice_call",
      "title":"Type",
      "type":"string"
     }
    },
    "required":[
     "type",
     "text"
    ],
    "title":"WhatsAppTemplateVoiceCallButtonInput",
    "type":"object"
   }
  }
 }
}
```
