📄 SKILL.md

← Vault

name: comercialrs-whatsapp-webhook-setup

description: Meta WhatsApp Business API webhook setup for ComercialRS — bypass Supabase Cloud JWT requirement using Python server + nginx proxy

category: devops


ComercialRS WhatsApp Webhook Setup

Context

Meta WhatsApp Business API requires webhook verification via GET request with only query params (hub.mode, hub.verify_token, hub.challenge) — no Authorization header. Supabase Cloud Edge Functions require JWT auth on ALL requests, causing Meta's webhook verification to fail with #N/A:WBxP-1061056854.

Solution Architecture

`

Meta → GET/POST /meta-webhook/

↓ nginx (port 8083 proxy)

Python webhook server (port 8083, psycopg2 direct Postgres)

PostgreSQL Docker container (172.23.0.2:5432)

auth.message_log, auth.tasks, auth.message_replies

`

Key finding 1 (CRITICAL - Updated 2026-05-25): The webhook server was connecting to the LOCAL Docker Postgres (172.23.0.2) instead of the Supabase Cloud Postgres. The Docker DB had EMPTY/WRONG data. All production data lives in Supabase Cloud. The VPS has TWO Postgres instances:

After fixes, rebuild with nvm use 20 && npm run build.

Verification

Test GET (webhook verification):

`bash

curl "https://comercialrs.rochasalesseguros.com.br/meta-webhook/?hub.mode=subscribe&hub.verify_token=YOUR_TOKEN&hub.challenge=test123"

Should return: test123

`

Test POST (incoming message simulation):

`bash

curl -X POST "https://comercialrs.rochasalesseguros.com.br/meta-webhook/" \

-H "Content-Type: application/json" \

-d '{"object":"whatsapp_business_account","entry":[...]}'

Should return: OK

`

Meta Dashboard

https://developers.facebook.com/apps//webhooks/