{"componentChunkName":"component---src-templates-docs-js","path":"/whatsapp/direct_send/messages","result":{"data":{"site":{"siteMetadata":{"title":"broadcaster","docsLocation":"https://github.com","docsLocationType":"github","editable":false}},"mdx":{"fields":{"id":"622f034e-0918-5d23-9408-2c76deccb8b1","title":"Messages","slug":"/whatsapp/direct_send/messages"},"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Messages\",\n  \"order\": 1\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Integration summary\")), mdx(\"ul\", {\n    parentName: \"blockquote\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Endpoint:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"POST https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Token:\"), \" messaging token, in the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"Authorization: Bearer {{wa-msg-api-token}}\"), \" header (\", mdx(\"a\", {\n    href: \"/whatsapp/authentication_token\"\n  }, \"how to generate it\"), \")\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Common fields:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"from\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"to\"), \" (phone number or BSUID) and \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"type\"), \" (\", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http#h-commonfields\"\n  }, \"details\"), \")\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Activation field:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"category\"), \" with the value \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"\\\"utility\\\"\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Response:\"), \" the same for every message (\", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http#h-response\"\n  }, \"see response\"), \")\"))), mdx(\"p\", null, \"The messages you can send with Direct Send, with their fields and examples. All are sent with \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http\"\n  }, \"POST /v1/messaging\"), \" adding the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"category\"), \" field.\"), mdx(\"section\", {\n    \"id\": \"generalstructure\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"General structure\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Fields in addition to the \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http#h-commonfields\"\n  }, \"common fields\"), \":\"), mdx(\"table\", {\n    parentName: \"section\"\n  }, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Name\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Requirements\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"text\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Message text.\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"String\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"ul\", null, mdx(\"li\", null, \"Required.\"), mdx(\"li\", null, \"Maximum length: 1,024 characters.\")))), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"category\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Direct Send activation category. Valid value: \", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"utility\"), \". Sending \", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"service\"), \" is considered outside Direct Send and follows the existing send behavior.\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"String\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"ul\", null, mdx(\"li\", null, \"Required to use Direct Send API.\"), mdx(\"li\", null, \"If omitted, it is treated as a normal message send.\")))), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"ttl_seconds\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Lets you configure the TTL; it is added below the \", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"category\"), \" field. For \", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"utility\"), \": \", mdx(\"ul\", null, mdx(\"li\", null, \"30 days by default.\"), mdx(\"li\", null, \"Minimum 30 seconds.\"), mdx(\"li\", null, \"Maximum 43,200 seconds (12 hours).\"))), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"String\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Optional.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    href: \"#h-templateattribution\"\n  }, \"direct_send_config\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Object to attribute the messages to a template with an explicit name.\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Object\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Optional.\"))))), mdx(\"section\", {\n    \"id\": \"textmessage\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Text message\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Sends a Direct Send text message. The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"type\"), \" field must be \\\"text\\\" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"category\"), \" must be \\\"utility\\\".\")), mdx(\"section\", {\n    \"id\": \"textmessage--example\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Example\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"HTTP request\")), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \\\\\\n-H 'Authorization: Bearer {{wa-msg-api-token}}' \\\\\\n-H 'Content-Type: application/json' \\\\\\n-d '{\\n    \\\"from\\\": \\\"5215500000001\\\",\\n    \\\"to\\\": \\\"5215500000002\\\",\\n    \\\"type\\\": \\\"text\\\",\\n    \\\"text\\\": \\\"Your order is on its way.\\\",\\n    \\\"category\\\": \\\"utility\\\"\\n}'\\n\")), mdx(\"br\", null), mdx(\"hr\", {\n    parentName: \"section\"\n  })), mdx(\"section\", {\n    \"id\": \"templateattribution\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Template attribution\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"By default, Direct Send automatically matches the message against existing templates or creates a new one with a name generated by Meta. If you need every message in the same flow to always be attributed to the same template, you can set an explicit name in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"direct_send_config\"), \" object.\")), mdx(\"section\", {\n    \"id\": \"templateattribution--body\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Body\"), mdx(\"table\", {\n    parentName: \"section\"\n  }, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Name\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Requirements\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"template_name\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Explicit name of the template to create or reuse. Unique per WABA. Only valid together with \", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"category: \\\"utility\\\"\"), \".\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"String\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"ul\", null, mdx(\"li\", null, \"Optional.\"), mdx(\"li\", null, \"Lowercase letters, numbers and underscore only (\", mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"^[a-z0-9_]{1,512}$\"), \").\"))))))), mdx(\"section\", {\n    \"id\": \"templateattribution--example\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Example\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"HTTP request\")), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \\\\\\n-H 'Authorization: Bearer {{wa-msg-api-token}}' \\\\\\n-H 'Content-Type: application/json' \\\\\\n-d '{\\n    \\\"from\\\": \\\"5215500000001\\\",\\n    \\\"to\\\": \\\"5215500000002\\\",\\n    \\\"type\\\": \\\"text\\\",\\n    \\\"text\\\": \\\"Your order TC01-9988 is on its way.\\\",\\n    \\\"category\\\": \\\"utility\\\",\\n    \\\"direct_send_config\\\": { \\\"template_name\\\": \\\"order_on_its_way_v1\\\" }\\n}'\\n\")), mdx(\"br\", null), mdx(\"hr\", {\n    parentName: \"section\"\n  })), mdx(\"section\", {\n    \"id\": \"combinedbuttons(ctaurl+reply)\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Combined buttons (CTA URL + reply)\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"A single interactive message can combine URL buttons (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"cta_url\"), \") and reply buttons (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"reply\"), \"), defined in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"buttons\"), \" array of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"replyButtons\"), \" object. The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"type\"), \" field must be \\\"interactive\\\" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"category\"), \" must be \\\"utility\\\". See \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/interactive/reply_buttons\"\n  }, \"Reply buttons\"), \" for the full object.\"), mdx(\"ul\", {\n    parentName: \"section\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Up to 10 buttons in total.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Maximum 2 buttons of type \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"cta_url\"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"cta_url\"), \" buttons must come before the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"reply\"), \" buttons in the array.\"))), mdx(\"section\", {\n    \"id\": \"combinedbuttons(ctaurl+reply)--example\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Example\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Body\")), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"from\\\": \\\"5215500000001\\\",\\n    \\\"to\\\": \\\"5215500000002\\\",\\n    \\\"type\\\": \\\"interactive\\\",\\n    \\\"category\\\": \\\"utility\\\",\\n    \\\"direct_send_config\\\": {\\n        \\\"template_name\\\": \\\"order_update_btns\\\"\\n    },\\n    \\\"replyButtons\\\": {\\n        \\\"body\\\": \\\"Choose an option\\\",\\n        \\\"buttons\\\": [\\n            { \\\"type\\\": \\\"cta_url\\\", \\\"title\\\": \\\"Visit site\\\", \\\"url\\\": \\\"https://www.conceptomovil.com\\\" },\\n            { \\\"type\\\": \\\"reply\\\", \\\"id\\\": \\\"btn_1\\\", \\\"title\\\": \\\"Option 1\\\" },\\n            { \\\"type\\\": \\\"reply\\\", \\\"id\\\": \\\"btn_2\\\", \\\"title\\\": \\\"Option 2\\\" }\\n        ]\\n    }\\n}\\n\")), mdx(\"br\", null), mdx(\"hr\", {\n    parentName: \"section\"\n  })), mdx(\"section\", {\n    \"id\": \"voicecallbutton\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Voice call button\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"The WhatsApp voice call button (\\\"Call on WhatsApp\\\") lets a user tap to start a WhatsApp voice call to the business phone number. It is sent as a free-form interactive message with the top-level \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"category: \\\"utility\\\"\"), \" label and a single call button, defined in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"voice_call\"), \" object. See \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/interactive/voice_call\"\n  }, \"Call button (voice call)\"), \" for the full object.\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note:\"), \" to use this feature the number must have WhatsApp Calling enabled in WhatsApp Manager; otherwise, Meta returns error 138000 (\\\"Calling API not enabled\\\") even if the JSON is correct.\")), mdx(\"section\", {\n    \"id\": \"voicecallbutton--example\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Example\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Body\")), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"from\\\": \\\"5215500000001\\\",\\n    \\\"to\\\": \\\"5215500000002\\\",\\n    \\\"type\\\": \\\"interactive\\\",\\n    \\\"category\\\": \\\"utility\\\",\\n    \\\"direct_send_config\\\": {\\n        \\\"template_name\\\": \\\"order_confirmation_call\\\"\\n    },\\n    \\\"voice_call\\\": {\\n        \\\"body\\\": \\\"We will call you to confirm your order\\\",\\n        \\\"action\\\": {\\n            \\\"parameters\\\": {\\n                \\\"display_text\\\": \\\"Call now\\\",\\n                \\\"ttl_minutes\\\": 60\\n            }\\n        }\\n    }\\n}\\n\")), mdx(\"br\", null), mdx(\"hr\", {\n    parentName: \"section\"\n  })), mdx(\"section\", {\n    \"id\": \"accountwithoutdirectsendenabled\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Account without Direct Send enabled\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"If the WABA does not have Direct Send enabled, the message fails and the following notification is sent to the webhook:\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n  \\\"statuses\\\": [{\\n    \\\"id\\\": \\\"\\\",\\n    \\\"recipient_id\\\": \\\"5512345678\\\",\\n    \\\"status\\\": \\\"failed\\\",\\n    \\\"timestamp\\\": \\\"...\\\",\\n    \\\"errors\\\": [{\\n      \\\"code\\\": 100,\\n      \\\"title\\\": \\\"Internal error, please retry. If the problem persist, please contact support\\\",\\n      \\\"details\\\": \\\"(#100) Invalid parameter.Parameter Invalid: The 'category' value requires Direct Send, which isn't enabled for this account. Use an approved message template instead.\\\"\\n    }]\\n  }]\\n}\\n\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"The Direct Send-specific error codes (1148 to 1151) and the rest of the API codes are in \", mdx(\"a\", {\n    href: \"/whatsapp/error_codes\"\n  }, \"Error codes\"), \".\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#general-structure","title":"General structure"},{"url":"#text-message","title":"Text message","items":[{"url":"#example","title":"Example"}]},{"url":"#template-attribution","title":"Template attribution","items":[{"url":"#body","title":"Body"},{"url":"#example-1","title":"Example"}]},{"url":"#combined-buttons-cta-url--reply","title":"Combined buttons (CTA URL + reply)","items":[{"url":"#example-2","title":"Example"}]},{"url":"#voice-call-button","title":"Voice call button","items":[{"url":"#example-3","title":"Example"}]},{"url":"#account-without-direct-send-enabled","title":"Account without Direct Send enabled"}]},"timeToRead":1,"parent":{"__typename":"File","relativePath":"whatsapp/direct_send/messages.md","fields":null},"frontmatter":{"metaTitle":null,"showMetadata":null,"editable":null,"showPreviousNext":null,"showToc":null}},"gitBranch":{"name":"20211019-2FACTOR_AUTH"},"gitCommit":{"hash":"9713e1925aeb8cad930f91b6bf05d0b5937b2bb5","date":"2026-11-13 06:39"}},"pageContext":{"id":"622f034e-0918-5d23-9408-2c76deccb8b1"}},"staticQueryHashes":["12478684","12478684","2882937274","2882937274","353167761","353167761"]}