# Chatbot templates

## Retrieves a specific WhatsApp template

> \
> \
> \*\*Required Permission:\*\* \`chatbots.templates.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot templates","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/workspaces/{workspaceId}/chatbots/{chatbotId}/templates/{templateId}":{"get":{"operationId":"ChatbotTemplateController_getTemplate[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"templateId","required":true,"in":"path","description":"The ID of the template to be retrieved.","schema":{"type":"string"}},{"name":"channelId","required":true,"in":"query","description":"The ID of the channel to which the template belongs.","schema":{}},{"name":"workspaceId","required":true,"in":"path","description":"The ID of the workspace.","schema":{"type":"string"}}],"responses":{"200":{"description":"Template details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplateResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Retrieves a specific WhatsApp template","tags":["Chatbot templates"],"description":"\n\n**Required Permission:** `chatbots.templates.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"WhatsAppTemplateResponseDto":{"type":"object","properties":{"template":{"description":"The WhatsApp template.","allOf":[{"$ref":"#/components/schemas/WhatsAppTemplateDto"}]},"error":{"type":"string","description":"Optional error message."}}},"WhatsAppTemplateDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the template."},"name":{"type":"string","description":"The name of the template."},"category":{"type":"string","description":"The category of the template (e.g., UTILITY, MARKETING)."},"rejectReason":{"type":"string","description":"The reason for rejection, if the template was rejected."},"created":{"type":"string","description":"Timestamp of when the template was created."},"updated":{"type":"string","description":"Timestamp of when the template was last updated."},"translations":{"type":"object","description":"An object containing translations for different languages.","additionalProperties":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsDto"}}},"required":["id","name","category","created","updated","translations"]},"WhatsAppTemplateTranslationsDto":{"type":"object","properties":{"bodyText":{"type":"string","description":"The body text of the translation."},"buttonType":{"type":"string","description":"The type of buttons."},"buttons":{"description":"The buttons attached to the template.","type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsButtonDto"}},"createdAt":{"type":"string","description":"Timestamp of creation."},"footerText":{"type":"string","description":"The text in the footer."},"headerMediaType":{"type":"string","description":"The media type of the header (e.g., \"TEXT\")."},"headerText":{"type":"string","description":"The text in the header."},"headerType":{"type":"string","description":"The type of the header."},"language":{"type":"string","description":"The language code (ISO 639-1)."},"rejectReason":{"type":"string","description":"The reason for rejection, if applicable."},"status":{"type":"string","description":"The status of the translation (e.g., \"APPROVED\")."},"templateId":{"type":"string","description":"The ID of the template at Meta."},"updatedAt":{"type":"string","description":"Timestamp of the last update."}},"required":["bodyText","buttons","createdAt","footerText","headerMediaType","headerText","headerType","language","rejectReason","status","templateId","updatedAt"]},"WhatsAppTemplateTranslationsButtonDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the button (e.g., QUICK_REPLY, URL, PHONE_NUMBER)."},"text":{"type":"string","description":"The display text of the button."},"url":{"type":"string","description":"The URL to open when the button is clicked (for URL type buttons)."},"phoneNumber":{"type":"string","description":"The phone number to call when the button is clicked (for PHONE_NUMBER type buttons)."}},"required":["type","text"]}}}}
```

## Creates a new WhatsApp template

> \
> \
> \*\*Required Permission:\*\* \`chatbots.templates.create\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot templates","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/workspaces/{workspaceId}/chatbots/{chatbotId}/templates":{"post":{"operationId":"ChatbotTemplateController_createTemplate[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"workspaceId","required":true,"in":"path","description":"The ID of the workspace.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWhatsAppTemplateRequestDto"}}}},"responses":{"201":{"description":"Template successfully submitted for review.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplateResponseDto"}}}},"400":{"description":"Invalid input data."},"403":{"description":"Insufficient permissions."}},"summary":"Creates a new WhatsApp template","tags":["Chatbot templates"],"description":"\n\n**Required Permission:** `chatbots.templates.create`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"CreateWhatsAppTemplateRequestDto":{"type":"object","properties":{"channelId":{"type":"string","description":"The ID of the channel for which the template is created."},"name":{"type":"string","description":"The name of the template."},"category":{"type":"string","description":"The category of the template (e.g., \"UTILITY\", \"MARKETING\")."},"translations":{"type":"object","description":"The template translations as key-value pairs (language code -> translation).","additionalProperties":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsCreateDto"}}},"required":["channelId","name","category","translations"]},"WhatsAppTemplateTranslationsCreateDto":{"type":"object","properties":{"bodyText":{"type":"string","description":"The body text of the template. Supports placeholders like {{1}}."},"buttons":{"description":"The buttons to attach to the template.","type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsButtonDto"}},"footerText":{"type":"string","description":"The text to display in the footer."},"headerText":{"type":"string","description":"The text to display in the header."},"headerType":{"type":"string","description":"The type of the header (e.g., TEXT, IMAGE, VIDEO, DOCUMENT)."},"language":{"type":"string","description":"The language code (ISO 639-1) for this translation."}},"required":["bodyText","buttons","footerText","headerText","headerType","language"]},"WhatsAppTemplateTranslationsButtonDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the button (e.g., QUICK_REPLY, URL, PHONE_NUMBER)."},"text":{"type":"string","description":"The display text of the button."},"url":{"type":"string","description":"The URL to open when the button is clicked (for URL type buttons)."},"phoneNumber":{"type":"string","description":"The phone number to call when the button is clicked (for PHONE_NUMBER type buttons)."}},"required":["type","text"]},"WhatsAppTemplateResponseDto":{"type":"object","properties":{"template":{"description":"The WhatsApp template.","allOf":[{"$ref":"#/components/schemas/WhatsAppTemplateDto"}]},"error":{"type":"string","description":"Optional error message."}}},"WhatsAppTemplateDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the template."},"name":{"type":"string","description":"The name of the template."},"category":{"type":"string","description":"The category of the template (e.g., UTILITY, MARKETING)."},"rejectReason":{"type":"string","description":"The reason for rejection, if the template was rejected."},"created":{"type":"string","description":"Timestamp of when the template was created."},"updated":{"type":"string","description":"Timestamp of when the template was last updated."},"translations":{"type":"object","description":"An object containing translations for different languages.","additionalProperties":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsDto"}}},"required":["id","name","category","created","updated","translations"]},"WhatsAppTemplateTranslationsDto":{"type":"object","properties":{"bodyText":{"type":"string","description":"The body text of the translation."},"buttonType":{"type":"string","description":"The type of buttons."},"buttons":{"description":"The buttons attached to the template.","type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplateTranslationsButtonDto"}},"createdAt":{"type":"string","description":"Timestamp of creation."},"footerText":{"type":"string","description":"The text in the footer."},"headerMediaType":{"type":"string","description":"The media type of the header (e.g., \"TEXT\")."},"headerText":{"type":"string","description":"The text in the header."},"headerType":{"type":"string","description":"The type of the header."},"language":{"type":"string","description":"The language code (ISO 639-1)."},"rejectReason":{"type":"string","description":"The reason for rejection, if applicable."},"status":{"type":"string","description":"The status of the translation (e.g., \"APPROVED\")."},"templateId":{"type":"string","description":"The ID of the template at Meta."},"updatedAt":{"type":"string","description":"Timestamp of the last update."}},"required":["bodyText","buttons","createdAt","footerText","headerMediaType","headerText","headerType","language","rejectReason","status","templateId","updatedAt"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatcaptain.com/api/api-dokumentation/chatbot-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
