name: comercialrs-webhook-debug
description: Debug ComercialRS WhatsApp webhook — button clicks not updating tasks
ComercialRS WhatsApp Webhook Debug
Debug the ComercialRS WhatsApp integration when reports say "buttons aren't working" or "tasks aren't updating".
CRITICAL: Never confuse systems
- - ComercialRS Meta WhatsApp: webhook at
/var/www/comercialrs/data/meta_webhook_vps_service.pyon VPS 31.97.243.106, port 8083. Direct integration with Meta Business API. - - Meta Chatwoot: completely separate integration. Has NOTHING to do with ComercialRS.
- - New:
in_progress|TASK_IDorcompleted|TASK_ID(pipe separator with UUID) - - Old/fallback: just
in_progress,completed, orremarketing(no pipe) - - Current log:
/var/www/comercialrs/data/meta_webhook_vps.log(or rotated to/var/log/meta_webhook.log) - - Old log:
/var/www/comercialrs/data/meta_webhook.log(May 28)
When user says "meta" or "whatsapp", ALWAYS clarify which system unless context is already obvious.
Debug checklist (in order)
Step 1: Check if button clicks are arriving
`bash
sshpass -p 'Marcia19671951@' ssh root@31.97.243.106 "grep -E '\[button\]' /var/www/comercialrs/data/meta_webhook_vps.log | tail -30"
`
If zero [button] entries → the webhook is NOT receiving clicks. Problem is upstream (Meta not sending, or phone number mismatch).
Step 2: Check the RPC works
`bash
curl -s -X POST 'https://dauftiqcvgaydddoxqhh.supabase.co/rest/v1/rpc/update_task_status_rpc' \
-H "apikey: eyJ_REDACTED" \
-H "Authorization: Bearer eyJ_REDACTED" \
-H "Content-Type: application/json" \
-d '{"p_task_id": "00000000-0000-0000-0000-000000000001", "p_status": "in_progress"}'
`
If RPC returns empty/success → the update function works fine.
Step 3: Check webhook service is running
`bash
sshpass -p 'Marcia19671951@' ssh root@31.97.243.106 "ss -tlnp | grep 8083; ps aux | grep meta_webhook | grep -v grep"
`
Step 4: Check team_member phone matches sender
If clicks arrive but tasks aren't found, the sender's phone may not match any team_members.phone in the database.
Common failure modes
1. No [button] in logs → Meta webhook not reaching VPS, or sender phone not in team_members
2. RPC returns error → function or parameters changed in Supabase
3. Service down (Address in use) → old process crashed, run fuser -k 8083/tcp then restart
4. "Nao entendi a acao" reply → payload not in BUTTON_STATUSES (parse_button_payload fails to parse)
Payload format
The webhook receives payloads in two formats:
Only in_progress, completed, remarketing (and their Portuguese variants) are valid button payloads. Do NOT invent payloads like nao_tenho_interesse — those don't exist in this system.