{"componentChunkName":"component---src-templates-docs-js","path":"/en/whatsapp/messaging/quickstart","result":{"data":{"site":{"siteMetadata":{"title":"broadcaster","docsLocation":"https://github.com","docsLocationType":"github","editable":false}},"mdx":{"fields":{"id":"292a0214-6ff4-5f02-bc7a-42cb1daeab6e","title":"Quickstart","slug":"/en/whatsapp/messaging/quickstart","lang":"en"},"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\": \"Quickstart\",\n  \"metaTitle\": \"Quickstart: Send your first message\",\n  \"order\": 0\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar Info = makeShortcode(\"Info\");\nvar Warning = makeShortcode(\"Warning\");\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(\"p\", null, \"This quickstart walks you through sending one message, reading the API response, and confirming delivery through a webhook callback.\"), mdx(\"section\", {\n    \"id\": \"beforeyoustart\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Before you start\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Make sure you have all of the following:\"), mdx(\"ul\", {\n    parentName: \"section\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Hosts, credentials, and IP access provisioned by Operations. Requests from IPs that aren't allowlisted are rejected. See \", mdx(\"a\", {\n    href: \"/whatsapp/description\"\n  }, \"General information\"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"An assigned business sender and WABA (WhatsApp Business Account), including the sender's phone number ID.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"A controlled test recipient, meaning a WhatsApp number you own that has opted in to receive messages from your business.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"An approved template, or an open service window with the test recipient (see below).\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"A registered webhook that can receive status callbacks. Without it, you can't confirm delivery. See \", mdx(\"a\", {\n    href: \"/whatsapp/receive_notifications/webhook\"\n  }, \"Webhook\"), \".\"))), mdx(\"section\", {\n    \"id\": \"choosethemessagetype\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Choose the message type\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Which message you can send depends on whether the customer has messaged you recently:\"), mdx(\"ul\", {\n    parentName: \"section\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"The customer messaged or called you within the last 24 hours\"), \" (the service window is open): you can send a free-form message (service message) such as text, media, or interactive content. See \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/without_template\"\n  }, \"Non-template messages\"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Otherwise:\"), \" you must send an approved template. This includes the first message to a new customer. See \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/with_template\"\n  }, \"Template messages\"), \" and \", mdx(\"a\", {\n    href: \"/whatsapp/administration/template_management/create\"\n  }, \"Create template\"), \".\")), mdx(Info, {\n    mdxType: \"Info\"\n  }, mdx(\"p\", {\n    parentName: \"section\"\n  }, \"If you aren't sure whether the window is open, send a template. Templates are valid both inside and outside the window. A free-form message sent outside the window fails with error \", mdx(\"a\", {\n    href: \"/whatsapp/error_codes\"\n  }, \"470\"), \".\"))), mdx(\"section\", {\n    \"id\": \"step1:sendthemessage\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Step 1: Send the message\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Every message is sent with \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http\"\n  }, \"POST /v1/messaging\"), \" and the messaging token (\", mdx(\"a\", {\n    href: \"/whatsapp/authentication_token\"\n  }, \"how to generate it\"), \"). This example sends an approved template:\"), 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\\\": \\\"template\\\",\\n    \\\"template\\\":\\n    {\\n        \\\"language\\\": \\\"es\\\",\\n        \\\"name\\\": \\\"body_text\\\",\\n        \\\"components\\\":[\\n            {\\n                \\\"type\\\":\\\"body\\\",\\n                \\\"parameters\\\":[\\n                    {\\n                        \\\"type\\\":\\\"text\\\",\\n                        \\\"text\\\":\\\"123456\\\"\\n                    }\\n                ]\\n            }\\n        ]\\n    }\\n}'\\n\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"If the service window is open, you can send free-form text instead by replacing the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"type\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"template\"), \" fields with \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"\\\"type\\\": \\\"text\\\"\"), \" and a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"text\"), \" field:\"), 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\\\": \\\"~Strikethrough text~ \\\\n _Italic text_ \\\\n *Bold text* \\\\n Emojis \\uD83D\\uDE0B\\\"\\n}'\\n\"))), mdx(\"section\", {\n    \"id\": \"step2:readtheresponse\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Step 2: Read the response\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"A successful request returns HTTP 200 with a message ID:\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"[\\n    {\\n        \\\"id\\\": \\\"gBGHUhVUByKUHwIJCSIVo3YWvs8i\\\"\\n    }\\n]\\n\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Save the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"id\"), \": it's the only way to match the status callbacks of this message.\"), mdx(Warning, {\n    mdxType: \"Warning\"\n  }, mdx(\"p\", {\n    parentName: \"section\"\n  }, \"HTTP 200 means the platform \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"accepted\"), \" the request, not that the message was delivered. Delivery is confirmed only by the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"delivered\"), \" status callback (step 3). Errors returned at this point (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"400\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"401\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"500\"), \") are described in \", mdx(\"a\", {\n    href: \"/whatsapp/messaging/http#h-response\"\n  }, \"Response\"), \".\"))), mdx(\"section\", {\n    \"id\": \"step3:matchthestatuscallback\"\n  }, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Step 3: Match the status callback\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Your webhook receives status callbacks carrying the same message ID. The status moves through \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sent\"), \" \\u2192 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"delivered\"), \" \\u2192 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"read\"), \", or ends in \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"failed\"), \". Callbacks can arrive out of order, so match them by \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"id\"), \", not by arrival time.\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"All fields are described in \", mdx(\"a\", {\n    href: \"/whatsapp/receive_notifications/statuses\"\n  }, \"Status notifications\"), \".\")), mdx(\"section\", {\n    \"id\": \"step3:matchthestatuscallback--sent\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"sent\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"statuses\\\": [\\n        {\\n            \\\"id\\\": \\\"gBGHUhVUByKUHwIJCSIVo3YWvs8i\\\",\\n            \\\"status\\\": \\\"sent\\\",\\n            \\\"timestamp\\\": \\\"1693419170\\\",\\n            \\\"recipient_id\\\": \\\"5215500000002\\\",\\n            \\\"conversation\\\":\\n            {\\n                \\\"id\\\": \\\"05b0852529d1652f2ccf3cde096f2150\\\",\\n                \\\"origin\\\":\\n                {\\n                    \\\"type\\\": \\\"utility\\\"\\n                }\\n            },\\n            \\\"pricing\\\":\\n            {\\n                \\\"billable\\\": true,\\n                \\\"pricing_model\\\": \\\"CBP\\\",\\n                \\\"category\\\": \\\"utility\\\"\\n            }\\n        }\\n    ]\\n}\\n\"))), mdx(\"section\", {\n    \"id\": \"step3:matchthestatuscallback--delivered\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"delivered\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"statuses\\\": [\\n        {\\n            \\\"id\\\": \\\"gBGHUhVUByKUHwIJCSIVo3YWvs8i\\\",\\n            \\\"status\\\": \\\"delivered\\\",\\n            \\\"timestamp\\\": \\\"1693419173\\\",\\n            \\\"recipient_id\\\": \\\"5215500000002\\\",\\n            \\\"conversation\\\":\\n            {\\n                \\\"id\\\": \\\"05b0852529d1652f2ccf3cde096f2150\\\",\\n                \\\"origin\\\":\\n                {\\n                    \\\"type\\\": \\\"utility\\\"\\n                }\\n            },\\n            \\\"pricing\\\":\\n            {\\n                \\\"billable\\\": true,\\n                \\\"pricing_model\\\": \\\"CBP\\\",\\n                \\\"category\\\": \\\"utility\\\"\\n            }\\n        }\\n    ]\\n}\\n\"))), mdx(\"section\", {\n    \"id\": \"step3:matchthestatuscallback--read\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"read\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"statuses\\\": [\\n        {\\n            \\\"id\\\": \\\"gBGHUhVUByKUHwIJCSIVo3YWvs8i\\\",\\n            \\\"status\\\": \\\"read\\\",\\n            \\\"timestamp\\\": \\\"1693419180\\\",\\n            \\\"recipient_id\\\": \\\"5215500000002\\\"\\n        }\\n    ]\\n}\\n\"))), mdx(\"section\", {\n    \"id\": \"step3:matchthestatuscallback--failed\"\n  }, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"failed\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"For example, a free-form message sent outside the service window:\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n    \\\"statuses\\\": [\\n        {\\n            \\\"errors\\\": [\\n                {\\n                    \\\"code\\\": 470,\\n                    \\\"title\\\": \\\"Failed to send message because you are outside the support window for freeform messages to this user. Please use a valid HSM notification or reconsider.\\\"\\n                }\\n            ],\\n            \\\"id\\\": \\\"gBGHUhVUByKUHwIJCSIVo3YWvs8i\\\",\\n            \\\"recipient_id\\\": \\\"5215500000002\\\",\\n            \\\"status\\\": \\\"failed\\\",\\n            \\\"timestamp\\\": \\\"1693419173\\\"\\n        }\\n    ]\\n}\\n\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"When the status is \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"failed\"), \", look up \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"errors[].code\"), \" in \", mdx(\"a\", {\n    href: \"/whatsapp/error_codes\"\n  }, \"Error codes\"), \".\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#before-you-start","title":"Before you start"},{"url":"#choose-the-message-type","title":"Choose the message type"},{"url":"#step-1-send-the-message","title":"Step 1: Send the message"},{"url":"#step-2-read-the-response","title":"Step 2: Read the response"},{"url":"#step-3-match-the-status-callback","title":"Step 3: Match the status callback","items":[{"url":"#sent","title":"sent"},{"url":"#delivered","title":"delivered"},{"url":"#read","title":"read"},{"url":"#failed","title":"failed"}]}]},"timeToRead":1,"parent":{"__typename":"File","relativePath":"en/whatsapp/messaging/quickstart.md","fields":null},"frontmatter":{"metaTitle":"Quickstart: Send your first message","showMetadata":null,"editable":null,"showPreviousNext":null,"showToc":null}},"gitBranch":{"name":"20211019-2FACTOR_AUTH"},"gitCommit":{"hash":"50a69cce8c40a2faa0cce76d4bf2bf9281a192c2","date":"2026-11-17 08:36"}},"pageContext":{"id":"292a0214-6ff4-5f02-bc7a-42cb1daeab6e","lang":"en"}},"staticQueryHashes":["12478684","12478684","353167761","353167761","3960160274","3960160274","801980290","801980290"]}