Skip to main content
Glama
TitanmindAGI

Titanmind WhatsApp MCP

by TitanmindAGI

register_msg_template_for_approval

Create and submit WhatsApp message templates for approval, enabling structured messaging with customizable components like headers, body text, and interactive buttons.

Instructions

creates and registers a new whatsapp message template for approval.
Args:
    template_name (str): name of the whatsapp message template, It only accepts a single word without no special characters except underscores
    language (str): language of the whatsapp message template (default is "en")
    category (str): category of the whatsapp message template (default is "MARKETING"), other possible values are "UTILITY", "AUTHENTICATION"
    message_content_components (dict): the message content that needs to be sent. It needs to be structured like the below example, 
    components are required to have BODY component at least, like this: {"type": "BODY", "text": "lorem body text"}, BODY component is for the simple text.
    All other components are optional. 
    HEADER component can have any of the below format, but only one format at a time can be used.: TEXT(the header component with TEXT needs to be like this
    {
    "type": "HEADER",
    "format": "TEXT",
    "text": "lorem header text"
    }
    ), VIDEO(the header component with VIDEO needs to be like this
    {
     "type":"HEADER",
     "format":"VIDEO",
     "example":{
        "header_handle":[
           "https://sample_video_url.jpg"
        ]
     }
    }
    )
    , IMAGE(the header component with IMAGE needs to be like this 
    {
     "type":"HEADER",
     "format":"IMAGE",
     "example":{
        "header_handle":[
           "https://sample_image_url.jpg"
        ]
     }
    }),
   DOCUMENT (the header component with DOCUMENT needs to be like this 
    {
     "type":"HEADER",
     "format":"DOCUMENT",
     "example":{
        "header_handle":[
           "https://sample_document_url"
        ]
     }
  }),
    message_content_components value with all other type of components is mentioned below.
        [
                {
                    "type": "HEADER",
                    "format": "TEXT",
                    "text": "lorem header text"
                },
                {
                    "type": "BODY",
                    "text": "lorem body text"
                },
                {
                    "type": "FOOTER",
                    "text": "lorem footer text"
                },
                {
                    "type": "BUTTONS",
                    "buttons": [
                        {
                            "type": "QUICK_REPLY",
                            "text": "lorem reply bt"
                        },
                        {
                          "type": "URL",
                          "text": "cta",
                          "url": "https:sample.in"
                        },
                        {
                          "type": "PHONE_NUMBER",
                          "text": "call ",
                          "phone_number": "IN328892398"
                        }
                    ]
                }
            ]
    Buttons need to follow order of first QUICK_REPLY, then URL, and then PHONE_NUMBER.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYes
message_content_componentsYes
languageNoen
categoryNoMARKETING

Implementation Reference

  • The core handler function that executes the logic to register a WhatsApp message template for approval by making a POST request to the API endpoint.
    def register_msg_template_for_approval(
            template_name: str, language: str, category: str, message_content_components: list[dict[str, Any]]
    ):
        return asdict(
            TitanMindAPINetworking().make_request(
                endpoint=f"whatsapp/template/",
                payload={
                    "name": template_name,
                    "language": language,
                    "category": category,
                    "components": message_content_components
                },
                success_message="whatsapp template registered for approval.",
                method=HTTPMethod.POST,
            )
        )
  • The MCP tool registration using the @mcp.tool() decorator. Includes the function signature, detailed docstring describing input schema and usage, and delegates to the core handler.
    @mcp.tool()
    def register_msg_template_for_approval(
            template_name: str,
            message_content_components: list[dict[str, Any]],
            language: str = "en", category: str = "MARKETING",
    ) -> Optional[Dict[str, Any]]:
        """
        creates and registers a new whatsapp message template for approval.
        Args:
            template_name (str): name of the whatsapp message template, It only accepts a single word without no special characters except underscores
            language (str): language of the whatsapp message template (default is "en")
            category (str): category of the whatsapp message template (default is "MARKETING"), other possible values are "UTILITY", "AUTHENTICATION"
            message_content_components (dict): the message content that needs to be sent. It needs to be structured like the below example, 
            components are required to have BODY component at least, like this: {"type": "BODY", "text": "lorem body text"}, BODY component is for the simple text.
            All other components are optional. 
            HEADER component can have any of the below format, but only one format at a time can be used.: TEXT(the header component with TEXT needs to be like this
            {
            "type": "HEADER",
            "format": "TEXT",
            "text": "lorem header text"
            }
            ), VIDEO(the header component with VIDEO needs to be like this
            {
             "type":"HEADER",
             "format":"VIDEO",
             "example":{
                "header_handle":[
                   "https://sample_video_url.jpg"
                ]
             }
            }
            )
            , IMAGE(the header component with IMAGE needs to be like this 
            {
             "type":"HEADER",
             "format":"IMAGE",
             "example":{
                "header_handle":[
                   "https://sample_image_url.jpg"
                ]
             }
            }),
           DOCUMENT (the header component with DOCUMENT needs to be like this 
            {
             "type":"HEADER",
             "format":"DOCUMENT",
             "example":{
                "header_handle":[
                   "https://sample_document_url"
                ]
             }
          }),
            message_content_components value with all other type of components is mentioned below.
                [
                        {
                            "type": "HEADER",
                            "format": "TEXT",
                            "text": "lorem header text"
                        },
                        {
                            "type": "BODY",
                            "text": "lorem body text"
                        },
                        {
                            "type": "FOOTER",
                            "text": "lorem footer text"
                        },
                        {
                            "type": "BUTTONS",
                            "buttons": [
                                {
                                    "type": "QUICK_REPLY",
                                    "text": "lorem reply bt"
                                },
                                {
                                  "type": "URL",
                                  "text": "cta",
                                  "url": "https:sample.in"
                                },
                                {
                                  "type": "PHONE_NUMBER",
                                  "text": "call ",
                                  "phone_number": "IN328892398"
                                }
                            ]
                        }
                    ]
            Buttons need to follow order of first QUICK_REPLY, then URL, and then PHONE_NUMBER.
        """
    
        return titan_mind_functions.register_msg_template_for_approval(
            template_name, language, category, message_content_components
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TitanmindAGI/titanmind-whatsapp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server