{"id":2345,"date":"2026-11-24T19:40:56","date_gmt":"2026-11-24T19:40:56","guid":{"rendered":"https:\/\/vectalk.com.br\/blog\/totvs-protheus-whatsapp-api\/"},"modified":"2026-11-24T19:41:01","modified_gmt":"2026-11-24T19:41:01","slug":"totvs-protheus-whatsapp-api","status":"publish","type":"post","link":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/","title":{"rendered":"TOTVS Protheus + official WhatsApp Business API: integration via API"},"content":{"rendered":"\n<p><em>Updated on November 24, 2026<\/em><\/p>\n\n\n\n<p>TOTVS Protheus does not talk to the official WhatsApp Business API directly: a middleware sits between them (your own service or an integration platform) that reads ERP events, sends Meta-approved templates and writes the result back. On the TOTVS side, the bridge is the Protheus REST server, enabled in <code>appserver.ini<\/code>, with Basic or Bearer token authentication. On the WhatsApp side, it is a template <code>POST<\/code> and a status webhook.<\/p>\n\n\n\n<p>Below: REST setup according to TDN (the TOTVS developer network), an entry point that feeds an outbox table, a REST service in AdvPL and a worker that sends the template. The general ERP overview is in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-erp-integration\/\">WhatsApp API ERP integration<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Does TOTVS have its own WhatsApp product?<\/h2>\n\n\n\n<p>On the TOTVS website, the &#8220;Atendimento e Chatbot&#8221; (customer service and chatbot) menu points to RD Atendimento (RD Station Conversas), from RD Station, one of the business units TOTVS lists. According to the <a href=\"https:\/\/www.rdstation.com\/produtos\/conversas\/\" target=\"_blank\" rel=\"noreferrer noopener\">product page<\/a>, it works with the official WhatsApp Business API. In the official pages we checked, we found no native Protheus feature that sends WhatsApp templates from billing or finance events. <a href=\"https:\/\/www.totvs.com\/totvs-ipaas\/\" target=\"_blank\" rel=\"noreferrer noopener\">TOTVS iPaaS<\/a>, presented as a systems integration tool, can play the middleware role.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture: Protheus, queue and WhatsApp<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Step<\/th><th>Where it runs<\/th><th>What it does<\/th><\/tr><\/thead><tbody><tr><td>1. Event<\/td><td>Protheus (entry point or job)<\/td><td>Writes a row to an outbox table<\/td><\/tr><tr><td>2. Read<\/td><td>Middleware<\/td><td>Queries the table through Protheus REST<\/td><\/tr><tr><td>3. Queue<\/td><td>Middleware<\/td><td>Enqueues each send with a unique key<\/td><\/tr><tr><td>4. Send<\/td><td>Worker<\/td><td>Calls the WhatsApp API with the template<\/td><\/tr><tr><td>5. Write-back<\/td><td>Worker<\/td><td>Stores the <code>wamid<\/code> in Protheus through REST<\/td><\/tr><tr><td>6. Status<\/td><td>Webhook<\/td><td>Receives <code>delivered<\/code>, <code>read<\/code> or <code>failed<\/code> and updates Protheus<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>With an outbox table, the ERP only does a local <code>RecLock<\/code>. Queues, retries and idempotency are covered in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-integration-architecture\/\">WhatsApp API integration architecture<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: enable REST in Protheus<\/h2>\n\n\n\n<p>The TDN page <a href=\"https:\/\/tdn.totvs.com\/x\/gkkSCw\" target=\"_blank\" rel=\"noreferrer noopener\">01. Configura\u00e7\u00e3o<\/a> (in Portuguese) describes the AdvPL REST server. A minimal <code>appserver.ini<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-ini\">[GENERAL]\nMAXSTRINGSIZE=10\n\n[ONSTART]\nJOBS=HTTPJOB\nREFRESHRATE=120\n\n[HTTPJOB]\nMAIN=HTTP_START\nENVIRONMENT=environment\n\n[HTTPV11]\nEnable=1\nSockets=HTTPREST\n\n[HTTPREST]\nPort=8080\nURIs=HTTPURI\nSecurity=1\n\n[HTTPURI]\nURL=\/rest\nPrepareIn=All\nInstances=2,5<\/code><\/pre>\n\n\n\n<p>What matters from TDN:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>MAXSTRINGSIZE<\/code> with a minimum value of 10 is required for requests larger than 1 MB.<\/li>\n\n\n<li>Since release 12.1.33, services require authentication when the <code>Security<\/code> key is missing; since the October 2024 release, the key can no longer be changed and authentication is always required.<\/li>\n\n\n<li>With <code>PrepareIn=All<\/code>, the company group and branch come in the <code>tenantId<\/code> header (e.g., <code>T1,D MG 01<\/code>), as described in <a href=\"https:\/\/tdn.totvs.com\/display\/framework\/02.+REST+com+ERP+Microsiga+Protheus\" target=\"_blank\" rel=\"noreferrer noopener\">REST com ERP Microsiga Protheus<\/a>.<\/li>\n\n\n<li>TLS 1.2 and 1.3 are enabled with the <code>TLS1_2<\/code> and <code>TLS1_3<\/code> keys in <code>[HTTPREST]<\/code>.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: authenticate with a token<\/h2>\n\n\n\n<p>Basic auth sends the username and password on every request. The TDN <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=465383509\" target=\"_blank\" rel=\"noreferrer noopener\">access token API<\/a> describes the <code>\/api\/oauth2\/v1\/token<\/code> endpoint, with username and password sent as headers:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-bash\">curl -X POST \"https:\/\/erp.yourcompany.com:8080\/rest\/api\/oauth2\/v1\/token?grant_type=password\" \\\n  -H \"username: whatsapp.integration\" \\\n  -H \"password: $PROTHEUS_PASS\"<\/code><\/pre>\n\n\n\n<p>The response contains <code>access_token<\/code>, <code>refresh_token<\/code>, <code>token_type: \"Bearer\"<\/code> and <code>expires_in: 3600<\/code>. The access token lasts one hour and the refresh token 24 hours; neither can be changed. To renew, call the same endpoint with <code>grant_type=refresh_token&amp;refresh_token=...<\/code>. Use a dedicated integration user with minimal access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: standard APIs or your own service<\/h2>\n\n\n\n<p>TOTVS publishes standard APIs in the <code>\/api\/&lt;segment&gt;\/v1\/&lt;resource&gt;<\/code> format. The <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=894394585\" target=\"_blank\" rel=\"noreferrer noopener\">FAT0321<\/a> page documents, for example, <code>\/api\/crm\/v1\/customerVendor<\/code> (customers, table SA1) and <code>\/api\/fat\/v1\/carrier<\/code> (carriers). The <a href=\"https:\/\/tdn.totvs.com\/display\/INT\/Guia+de+implementacao+das+APIs+TOTVS\" target=\"_blank\" rel=\"noreferrer noopener\">TOTVS API implementation guide<\/a> defines pagination with <code>page<\/code> and <code>pageSize<\/code> and responses with <code>items<\/code> and <code>hasNext<\/code>.<\/p>\n\n\n\n<p>For WhatsApp, though, you need &#8220;what changed and has not been notified yet&#8221;. The cleanest path is a custom outbox table and your own REST service.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The M460FIM entry point<\/h3>\n\n\n\n<p>According to TDN, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=6784180\" target=\"_blank\" rel=\"noreferrer noopener\">M460FIM<\/a> runs after the outbound invoice is saved (MATA461), outside the transaction, and receives the number, series, customer and store in <code>PARAMIXB<\/code>. The example writes the row to table <code>ZW1<\/code>, which you create in the data dictionary (field names are illustrative):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-advpl\">#INCLUDE \"PROTHEUS.CH\"\n\nUser Function M460FIM()\n    Local aArea  := GetArea()\n    Local cDoc   := PARAMIXB[1]\n    Local cSerie := PARAMIXB[2]\n    Local cCli   := PARAMIXB[3]\n    Local cLoja  := PARAMIXB[4]\n\n    DbSelectArea(\"SA1\")\n    DbSetOrder(1)\n    If DbSeek(xFilial(\"SA1\") + cCli + cLoja)\n        RecLock(\"ZW1\", .T.)\n        ZW1-&gt;ZW1_FILIAL := xFilial(\"ZW1\")\n        ZW1-&gt;ZW1_CHAVE  := \"NF\" + cSerie + cDoc\n        ZW1-&gt;ZW1_EVENTO := \"NF_EMITIDA\"\n        ZW1-&gt;ZW1_NOME   := SA1-&gt;A1_NOME\n        ZW1-&gt;ZW1_FONE   := AllTrim(SA1-&gt;A1_DDD) + AllTrim(SA1-&gt;A1_TEL)\n        ZW1-&gt;ZW1_STATUS := \"P\"\n        MsUnLock()\n    EndIf\n    RestArea(aArea)\nReturn Nil<\/code><\/pre>\n\n\n\n<p>Other triggers on TDN: <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=6784155\" target=\"_blank\" rel=\"noreferrer noopener\">M410STTS<\/a> runs after the sales order changes are saved and receives the operation (3 = insert). MT410TOK is a <em>validation<\/em> entry point (it can block the save): do not use it to send messages. For invoices about to fall due, a daily job on table SE1 (<code>E1_VENCREA<\/code>, <code>E1_SALDO<\/code>) works better than an entry point.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The REST service that exposes the queue<\/h3>\n\n\n\n<p>The TDN page <a href=\"https:\/\/tdn.totvs.com\/display\/framework\/02.+Criando+uma+classe+REST\" target=\"_blank\" rel=\"noreferrer noopener\">Criando uma classe REST<\/a> shows the <code>WSRESTFUL<\/code> syntax. A service with a <code>GET<\/code> for pending rows and a <code>POST<\/code> to store the result:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-advpl\">#INCLUDE \"TOTVS.CH\"\n#INCLUDE \"RESTFUL.CH\"\n\nWSRESTFUL waoutbox DESCRIPTION \"WhatsApp outbox\"\n    WSMETHOD GET PEND DESCRIPTION \"Pending\" PATH \"\/waoutbox\"\n    WSMETHOD POST STAT DESCRIPTION \"Send result\" PATH \"\/waoutbox\/{chave}\"\nEND WSRESTFUL\n\nWSMETHOD GET PEND WSSERVICE waoutbox\n    Local cAli  := GetNextAlias()\n    Local cJson := \"[\"\n    ::SetContentType(\"application\/json\")\n    BeginSQL Alias cAli\n        SELECT ZW1_CHAVE, ZW1_EVENTO, ZW1_NOME, ZW1_FONE\n        FROM %table:ZW1% ZW1\n        WHERE ZW1.ZW1_STATUS = 'P' AND ZW1.%notdel%\n    EndSQL\n    While (cAli)-&gt;(!Eof())\n        cJson += If(Len(cJson) &gt; 1, \",\", \"\") + '{\"chave\":\"' + AllTrim((cAli)-&gt;ZW1_CHAVE) + ;\n                 '\",\"evento\":\"' + AllTrim((cAli)-&gt;ZW1_EVENTO) + ;\n                 '\",\"nome\":\"' + StrTran(AllTrim((cAli)-&gt;ZW1_NOME), '\"', '') + ;\n                 '\",\"fone\":\"' + AllTrim((cAli)-&gt;ZW1_FONE) + '\"}'\n        (cAli)-&gt;(DbSkip())\n    EndDo\n    (cAli)-&gt;(DbCloseArea())\n    ::SetResponse(cJson + \"]\")\nReturn .T.\n\nWSMETHOD POST STAT WSSERVICE waoutbox\n    Local jBody := JsonObject():New()\n    jBody:FromJson(::GetContent())\n    DbSelectArea(\"ZW1\")\n    DbSetOrder(1) \/\/ ZW1_FILIAL + ZW1_CHAVE\n    If !DbSeek(xFilial(\"ZW1\") + ::aURLParms[1])\n        SetRestFault(404, \"key not found\")\n        Return .F.\n    EndIf\n    RecLock(\"ZW1\", .F.)\n    ZW1-&gt;ZW1_STATUS := jBody:GetJsonText(\"status\")\n    ZW1-&gt;ZW1_WAMID  := jBody:GetJsonText(\"wamid\")\n    MsUnLock()\n    ::SetResponse('{\"ok\":true}')\nReturn .T.<\/code><\/pre>\n\n\n\n<p>A REST class compiled after <code>HTTP_START<\/code> is only published after the AppServer restarts. For TL++, the page <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=553337101\" target=\"_blank\" rel=\"noreferrer noopener\">Migra\u00e7\u00e3o WsRESTful para REST tlppCore<\/a> shows the same service with the <code>@Get<\/code> and <code>@Post<\/code> annotations, <code>oRest:getBodyRequest()<\/code> and <code>oRest:setResponse()<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: the worker that sends the template<\/h2>\n\n\n\n<p>The worker gets the token, reads pending rows, sends the template and returns the <code>wamid<\/code>. It uses the Vectalk URL; with the Cloud API directly, swap in Meta&#8217;s URL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-js\">const PROTHEUS = process.env.PROTHEUS_URL; \/\/ e.g. https:\/\/erp.yourcompany.com:8080\/rest\nconst sent = new Map(); \/\/ in production: Redis or the middleware database\n\nasync function protheus(path, opts = {}) {\n  const r = await fetch(`${PROTHEUS}${path}`, opts);\n  if (!r.ok) throw new Error(`${path}: ${r.status}`);\n  return r.json();\n}\n\nasync function sendTemplate(item) {\n  const r = await fetch(\"https:\/\/apis.vectalk.com.br\/api\/messages\", {\n    method: \"POST\",\n    headers: { Authorization: `Bearer ${process.env.VECTALK_TOKEN}`, \"Content-Type\": \"application\/json\" },\n    body: JSON.stringify({\n      messaging_product: \"whatsapp\",\n      to: \"55\" + item.fone.replace(\/\\D\/g, \"\"),\n      type: \"template\",\n      template: {\n        name: \"nf_emitida\",\n        language: { code: \"pt_BR\" },\n        components: [{ type: \"body\", parameters: [item.nome, item.chave.slice(2)].map((text) =&gt; ({ type: \"text\", text })) }],\n      },\n    }),\n  });\n  return r.json();\n}\n\nasync function run() {\n  const { access_token } = await protheus(\"\/api\/oauth2\/v1\/token?grant_type=password\", {\n    method: \"POST\",\n    headers: { username: process.env.PROTHEUS_USER, password: process.env.PROTHEUS_PASS },\n  });\n  const headers = { Authorization: `Bearer ${access_token}`, tenantId: \"T1,D MG 01\", \"Content-Type\": \"application\/json\" };\n  for (const item of await protheus(\"\/waoutbox\", { headers })) {\n    let wamid = sent.get(item.chave); \/\/ already sent: only the ERP write-back is missing\n    if (!wamid) {\n      const res = await sendTemplate(item);\n      wamid = res.messages?.[0]?.id;\n      if (!wamid) { console.error(item.chave, res.error?.message); continue; }\n      sent.set(item.chave, wamid);\n    }\n    await protheus(`\/waoutbox\/${item.chave}`, { method: \"POST\", headers, body: JSON.stringify({ status: \"E\", wamid }) });\n  }\n}\n\nrun();<\/code><\/pre>\n\n\n\n<p>Production notes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Idempotency.<\/strong> The outbox key (<code>NF<\/code> + series + number) is the idempotency key. Store the key and <code>wamid<\/code> in the middleware database <em>before<\/em> updating Protheus: if the write-back <code>POST<\/code> fails, the next run does not resend.<\/li>\n\n\n<li><strong>Phone numbers.<\/strong> Normalize <code>A1_DDD<\/code> + <code>A1_TEL<\/code> (leading zero, dashes, the extra ninth digit on Brazilian mobiles) and drop anything that does not have 12 or 13 digits including country code <code>55<\/code>.<\/li>\n\n\n<li><strong>Throughput.<\/strong> The Cloud API supports up to 80 messages per second per phone number by default and returns error <code>130429<\/code> above that (<a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/throughput\" target=\"_blank\" rel=\"noreferrer noopener\">throughput<\/a>).<\/li>\n\n\n<li><strong>Retries.<\/strong> 5xx and network errors go back to the queue with growing backoff; an invalid template or number becomes status <code>F<\/code> in Protheus.<\/li>\n\n<\/ul>\n\n\n\n<p>Variables and buttons: <a href=\"https:\/\/vectalk.com.br\/blog\/en\/send-whatsapp-template-message-api\/\">how to send a WhatsApp template message via the API<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: status webhook back to Protheus<\/h2>\n\n\n\n<p>The <code>sent<\/code>, <code>delivered<\/code>, <code>read<\/code> or <code>failed<\/code> status arrives at the webhook with the same <code>wamid<\/code> returned at send time. The middleware finds the key by <code>wamid<\/code> and calls <code>POST \/waoutbox\/{chave}<\/code>. Meta retries failed webhook deliveries for up to 7 days and warns this can produce duplicate notifications, according to the <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">webhooks overview<\/a>: return 200 quickly, process later and ignore repeated statuses. See <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-webhooks\/\">WhatsApp API webhooks<\/a> and how to handle <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-duplicate-events-idempotency\/\">duplicate webhooks<\/a>. To track delivery rate per event, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-delivery-rate-monitoring\/\">how to monitor deliveries<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use cases in Protheus<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Event<\/th><th>Trigger<\/th><th>Template (likely category)<\/th><\/tr><\/thead><tbody><tr><td>Outbound invoice (NF) issued<\/td><td>M460FIM<\/td><td>&#8220;Hi {{1}}. Your invoice {{2}} has been issued&#8221; (utility)<\/td><\/tr><tr><td>Sales order created<\/td><td>M410STTS with operation 3<\/td><td>Order confirmation (utility)<\/td><\/tr><tr><td>Invoice about to fall due<\/td><td>Daily job on SE1<\/td><td>Reminder of the customer&#8217;s own invoice (utility)<\/td><\/tr><tr><td>Sales rep alert<\/td><td>M410STTS<\/td><td>Internal alert with the order number (utility)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Payment reminders only for the customer&#8217;s own invoices: the <a href=\"https:\/\/business.whatsapp.com\/policy\" target=\"_blank\" rel=\"noreferrer noopener\">WhatsApp Business Messaging Policy<\/a> prohibits collecting third-party debt. To design the reminder sequence, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-billing-reminders\/\">WhatsApp billing reminders<\/a>. Meta sets the category at approval, and a notice mixed with an offer becomes marketing, per <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/templates\/template-categorization\" target=\"_blank\" rel=\"noreferrer noopener\">template categorization<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How much it costs<\/h2>\n\n\n\n<p>In Meta&#8217;s rate card for Brazilian numbers in effect since October 1, 2026, utility costs BRL 0.0350 per message and marketing BRL 0.3217. Since that date, utility templates are charged even inside the customer service window and do not count toward the free tier of 1,000 service messages per month per number. Example: 3,000 invoices a month with one notice each is BRL 105.00 in Meta fees, if all are delivered. Run your numbers in the <a href=\"https:\/\/vectalk.com.br\/en\/whatsapp-api-pricing-calculator.html\">WhatsApp API pricing calculator<\/a> and check the rules on <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Meta&#8217;s pricing page<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to do this with Vectalk<\/h2>\n\n\n\n<p>Vectalk is a proxy for Meta&#8217;s official Cloud API: the worker calls <code>POST https:\/\/apis.vectalk.com.br\/api\/messages<\/code> with the same template JSON as Meta (<a href=\"https:\/\/docs.vectalk.com.br\/api-reference\/messages\/send-template\">send template docs<\/a>) and your endpoint receives the same Meta webhooks (<a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">webhook docs<\/a>). In the dashboard you create templates (there is a Template Library), generate API keys and check logs. Billing is prepaid: each delivered message is deducted from your balance, and you do not add a card with Meta.<\/p>\n\n\n\n<p>Vectalk has no native inbox, bulk sending or AI, and no ready-made Protheus connector: the integration is the middleware described here. The foundation: <a href=\"https:\/\/vectalk.com.br\/blog\/en\/official-whatsapp-api\/\">official WhatsApp API guide<\/a>. Sign up at <a href=\"https:\/\/apps.vectalk.com.br\/register\">apps.vectalk.com.br\/register<\/a>. Another ERP: <a href=\"https:\/\/vectalk.com.br\/blog\/en\/conta-azul-whatsapp-api\/\">Conta Azul + WhatsApp<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I call the WhatsApp API directly from AdvPL?<\/h3>\n\n\n\n<p>Yes, with an AdvPL HTTP client, but errors, retries and network waits then run inside the ERP. With an outbox table, sending happens outside.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should I use Basic or Bearer on Protheus REST?<\/h3>\n\n\n\n<p>TDN recommends Bearer: the username and password only travel in the call to <code>\/api\/oauth2\/v1\/token<\/code>. The token lasts one hour and is renewed with the <code>refresh_token<\/code>, which lasts 24 hours.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Protheus is on the internal network. Will the webhook work?<\/h3>\n\n\n\n<p>The webhook reaches the middleware, which needs a public HTTPS address. Protheus REST can stay reachable only by the middleware, through a VPN or an IP allowlist.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Official sources checked on November 24, 2026:<\/strong> <a href=\"https:\/\/tdn.totvs.com\/x\/gkkSCw\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: REST configuration<\/a>, <a href=\"https:\/\/tdn.totvs.com\/display\/framework\/02.+REST+com+ERP+Microsiga+Protheus\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: REST with ERP Microsiga Protheus<\/a>, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=465383509\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: access token<\/a>, <a href=\"https:\/\/tdn.totvs.com\/display\/framework\/02.+Criando+uma+classe+REST\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: creating a REST class<\/a>, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=553337101\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: WsRESTful to tlppCore REST migration<\/a>, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=894394585\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: FAT0321<\/a>, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=6784180\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: M460FIM<\/a>, <a href=\"https:\/\/tdn.totvs.com\/pages\/viewpage.action?pageId=6784155\" target=\"_blank\" rel=\"noreferrer noopener\">TDN: M410STTS<\/a>, <a href=\"https:\/\/www.totvs.com\/totvs-ipaas\/\" target=\"_blank\" rel=\"noreferrer noopener\">TOTVS iPaaS<\/a>, <a href=\"https:\/\/www.rdstation.com\/produtos\/conversas\/\" target=\"_blank\" rel=\"noreferrer noopener\">RD Atendimento<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">Webhooks (Meta)<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/throughput\" target=\"_blank\" rel=\"noreferrer noopener\">Throughput (Meta)<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/templates\/template-categorization\" target=\"_blank\" rel=\"noreferrer noopener\">Template categorization (Meta)<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Pricing (Meta)<\/a>, <a href=\"https:\/\/business.whatsapp.com\/policy\" target=\"_blank\" rel=\"noreferrer noopener\">WhatsApp Business Messaging Policy<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\">Vectalk documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to connect Protheus to the official WhatsApp API: Protheus REST, OAuth2 token, the M460FIM entry point, an outbox table, a Node.js worker and the status webhook.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-2345","post","type-post","status-publish","format-standard","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>TOTVS Protheus + WhatsApp API integration | Vectalk<\/title>\n<meta name=\"description\" content=\"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TOTVS Protheus + WhatsApp API integration | Vectalk\" \/>\n<meta property=\"og:description\" content=\"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Vectalk\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-24T19:40:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-24T19:41:01+00:00\" \/>\n<meta name=\"author\" content=\"wanderleyfcunha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"wanderleyfcunha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/\"},\"author\":{\"name\":\"wanderleyfcunha\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"headline\":\"TOTVS Protheus + official WhatsApp Business API: integration via API\",\"datePublished\":\"2026-11-24T19:40:56+00:00\",\"dateModified\":\"2026-11-24T19:41:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/\"},\"wordCount\":1373,\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/\",\"name\":\"TOTVS Protheus + WhatsApp API integration | Vectalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\"},\"datePublished\":\"2026-11-24T19:40:56+00:00\",\"dateModified\":\"2026-11-24T19:41:01+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"description\":\"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/totvs-protheus-whatsapp-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TOTVS Protheus + official WhatsApp Business API: integration via API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\",\"name\":\"Blog Vectalk\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\",\"name\":\"wanderleyfcunha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"caption\":\"wanderleyfcunha\"},\"sameAs\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"TOTVS Protheus + WhatsApp API integration | Vectalk","description":"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/","og_locale":"en_US","og_type":"article","og_title":"TOTVS Protheus + WhatsApp API integration | Vectalk","og_description":"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.","og_url":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/","og_site_name":"Blog Vectalk","article_published_time":"2026-11-24T19:40:56+00:00","article_modified_time":"2026-11-24T19:41:01+00:00","author":"wanderleyfcunha","twitter_card":"summary_large_image","twitter_misc":{"Written by":"wanderleyfcunha","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/#article","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/"},"author":{"name":"wanderleyfcunha","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"headline":"TOTVS Protheus + official WhatsApp Business API: integration via API","datePublished":"2026-11-24T19:40:56+00:00","dateModified":"2026-11-24T19:41:01+00:00","mainEntityOfPage":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/"},"wordCount":1373,"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/","url":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/","name":"TOTVS Protheus + WhatsApp API integration | Vectalk","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/#website"},"datePublished":"2026-11-24T19:40:56+00:00","dateModified":"2026-11-24T19:41:01+00:00","author":{"@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"description":"Integrate TOTVS Protheus with the official WhatsApp Business API using Protheus REST, the M460FIM entry point, a queue and middleware. Config and code.","breadcrumb":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vectalk.com.br\/blog\/en\/totvs-protheus-whatsapp-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vectalk.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"TOTVS Protheus + official WhatsApp Business API: integration via API"}]},{"@type":"WebSite","@id":"https:\/\/vectalk.com.br\/blog\/#website","url":"https:\/\/vectalk.com.br\/blog\/","name":"Blog Vectalk","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vectalk.com.br\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b","name":"wanderleyfcunha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","caption":"wanderleyfcunha"},"sameAs":["https:\/\/vectalk.com.br\/blog"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/comments?post=2345"}],"version-history":[{"count":1,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2345\/revisions"}],"predecessor-version":[{"id":2348,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2345\/revisions\/2348"}],"wp:attachment":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/media?parent=2345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/categories?post=2345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/tags?post=2345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}