iachat/app/services/whatsapp
Muhsin Keloth c77d935e38
fix: Subscribe app to WABA before overriding webhook callback URL (#13279)
#### Problem
Meta requires the app to be subscribed to the WABA before
`override_callback_uri` can be used. The current implementation tries to
use `override_callback_uri` directly, which fails with:

> Error 100: "Before override the current callback uri, your app must be
subscribed to receive messages for WhatsApp Business Account"

This causes embedded signup to fail silently, the inbox appears
connected but never receives messages.

  #### Solution

  Split `subscribe_waba_webhook` into two sequential API calls:

  ```ruby
  def subscribe_waba_webhook(waba_id, callback_url, verify_token)
    # Step 1: Subscribe app to WABA first (required before override)
    subscribe_app_to_waba(waba_id)

    # Step 2: Override callback URL for this specific WABA
    override_waba_callback(waba_id, callback_url, verify_token)
  end
```

#### References
  - Subscribe app to WABA's webhooks: https://www.postman.com/meta/whatsapp-business-platform/request/ju40fld/subscribe-app-to-waba-s-webhooks
  - Override Callback URL (Embedded Signup): https://www.postman.com/meta/whatsapp-business-platform/request/l6a09ow/override-callback-url

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2026-02-02 16:50:35 +05:30
..
phone_normalizers fix: Duplicate contacts creating for Argentina numbers (#11173) 2025-10-13 11:07:07 +05:30
providers fix: Remove phone_number_id param from WhatsApp media retrieval for incoming messages (#13319) 2026-01-20 20:32:23 +04:00
channel_creation_service.rb fix: Remove the same account validation for whatsapp channels (#12811) 2025-11-06 21:18:52 +05:30
csat_template_service.rb feat: Add support for sending CSAT surveys via templates (Whatsapp Twilio) (#13143) 2026-01-13 16:32:02 +04:00
embedded_signup_service.rb fix: Setup webhooks for manual WhatsApp Cloud channel creation (#13278) 2026-01-19 14:12:36 +04:00
facebook_api_client.rb fix: Subscribe app to WABA before overriding webhook callback URL (#13279) 2026-02-02 16:50:35 +05:30
health_service.rb feat: Add WhatsApp health monitoring and self-service registration completion (#12556) 2025-10-02 11:25:48 +05:30
incoming_message_base_service.rb feat: Handle external echo messages from native apps (#13371) 2026-02-02 15:52:53 +05:30
incoming_message_service_helpers.rb feat: Handle external echo messages from native apps (#13371) 2026-02-02 15:52:53 +05:30
incoming_message_service.rb feat: Support for Whatsapp Cloud API (#4938) 2022-07-06 21:45:03 +02:00
incoming_message_whatsapp_cloud_service.rb fix: Remove phone_number_id param from WhatsApp media retrieval for incoming messages (#13319) 2026-01-20 20:32:23 +04:00
oneoff_campaign_service.rb fix: Prevent WhatsApp campaign duplicate messages by updating status immediately (#12955) 2025-11-26 15:25:49 +05:30
phone_info_service.rb feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
phone_number_normalization_service.rb fix: Extend phone number normalization to Twilio WhatsApp (#12655) 2025-10-28 18:16:29 +05:30
populate_template_parameters_service.rb fix: Normalize URLs with spaces in WhatsApp template parameters (#12594) 2025-10-08 15:33:06 +05:30
reauthorization_service.rb feat: add reauth flow for wa embedded signup (#11940) 2025-08-08 01:48:45 +05:30
send_on_whatsapp_service.rb fix: Improve WhatsApp template message error handling (#12168) 2025-08-12 16:31:56 +05:30
template_parameter_converter_service.rb fix: Handle nil processed_params for WhatsApp templates without params (#12177) 2025-08-12 22:56:53 +05:30
template_processor_service.rb fix: Case-insensitive language matching for WhatsApp template messages (#13269) 2026-01-14 17:33:02 +04:00
token_exchange_service.rb feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
token_validation_service.rb feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
webhook_setup_service.rb feat: Add WhatsApp health monitoring and self-service registration completion (#12556) 2025-10-02 11:25:48 +05:30
webhook_teardown_service.rb feat: Remove subscription on WhatsApp inbox delete (#11977) 2025-07-24 14:04:19 +04:00