iachat/spec/controllers/api/v1/accounts
Tanmay Deep Sharma 61d10044a0
feat: Whatsapp embedded signup (#11612)
## Description

This PR introduces WhatsApp Embedded Signup functionality, enabling
users to connect their WhatsApp Business accounts through Meta's
streamlined OAuth flow without manual webhook configuration. This
significantly improves the user experience by automating the entire
setup process.

**Key Features:**

- Embedded signup flow using Facebook SDK and Meta's OAuth 2.0
- Automatic webhook registration and phone number configuration
- Enhanced provider selection UI with card-based design
- Real-time progress tracking during signup process
- Comprehensive error handling and user feedback


## Required Configuration

The following environment variables must be configured by administrators
before this feature can be used:
Super Admin Configuration (via
super_admin/app_config?config=whatsapp_embedded)

- `WHATSAPP_APP_ID`: The Facebook App ID for WhatsApp Business API
integration
- `WHATSAPP_CONFIGURATION_ID`: The Configuration ID for WhatsApp
Embedded Signup flow (obtained from Meta Developer Portal)
- `WHATSAPP_APP_SECRET`: The App Secret for WhatsApp Embedded Signup
flow (required for token exchange)
![Screenshot 2025-06-09 at 11 21
08 AM](https://github.com/user-attachments/assets/1615fb0d-27fc-4d9e-b193-9be7894ea93a)


## How Has This Been Tested?

#### Backend Tests (RSpec):

- Authentication validation for embedded signup endpoints
- Authorization code validation and error handling
- Missing business parameter validation
- Proper response format for configuration endpoint
- Unauthorized access prevention

#### Manual Test Cases:

- Complete embedded signup flow (happy path)
- Provider selection UI navigation
- Facebook authentication popup handling
- Error scenarios (cancelled auth, invalid business data, API failures)
- Configuration presence/absence behavior

## Related Screenshots:

![Screenshot 2025-06-09 at 7 48
18 PM](https://github.com/user-attachments/assets/34001425-df11-4d78-9424-334461e3178f)
![Screenshot 2025-06-09 at 7 48
22 PM](https://github.com/user-attachments/assets/c09f4964-3aba-4c39-9285-d1e8e37d0e33)
![Screenshot 2025-06-09 at 7 48
32 PM](https://github.com/user-attachments/assets/a34d5382-7a91-4e1c-906e-dc2d570c864a)
![Screenshot 2025-06-09 at 10 43
05 AM](https://github.com/user-attachments/assets/a15840d8-8223-4513-82e4-b08f23c95927)
![Screenshot 2025-06-09 at 10 42
56 AM](https://github.com/user-attachments/assets/8c345022-38b5-44c4-aba2-0cda81389c69)


Fixes
https://linear.app/chatwoot/issue/CW-2131/spec-for-whatsapp-cloud-channels-sign-in-with-facebook

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2025-07-14 21:37:06 -07:00
..
actions chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
channels chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
contacts feat: API to create HMAC verified conversations (#7209) 2023-05-29 21:57:24 +05:30
conversations feat: API Endpoints to update message status (#11387) 2025-04-29 15:33:11 -07:00
google refactor: use state-based authentication (#11690) 2025-06-18 17:39:06 +05:30
instagram feat: Added the ability to create Instagram channel (#11182) 2025-04-03 13:57:14 +05:30
integrations feat: Add user attribution to Linear integration with actor authorization (#11774) 2025-07-01 16:49:26 +05:30
microsoft refactor: use state-based authentication (#11690) 2025-06-18 17:39:06 +05:30
notion feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
twitter chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
whatsapp feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
agent_bots_controller_spec.rb feat: Ability to reset api_access_token (#11565) 2025-05-29 14:42:13 +05:30
agents_controller_spec.rb chore: Fix agent API returning 500 error (#9193) 2024-04-04 19:44:47 +05:30
articles_controller_spec.rb chore: Clean up report & knowledge base policies (#11234) 2025-04-03 16:00:32 -07:00
assignable_agents_controller_spec.rb chore: Add Assignable Agents API (#4722) 2022-05-23 19:24:07 +05:30
automation_rules_controller_spec.rb feat: validate query conditions (#10595) 2024-12-17 17:16:37 +05:30
bulk_actions_controller_spec.rb chore: Use find_each instead of .all.each (#6975) 2023-04-25 09:32:35 +05:30
callbacks_controller_spec.rb chore: Handle attachments in Whatsapp Channel (#3299) 2021-11-11 13:03:48 +05:30
campaigns_controller_spec.rb chore: Add validations to campaign model 2025-03-19 17:29:08 -07:00
canned_responses_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
categories_controller_spec.rb chore: Clean up report & knowledge base policies (#11234) 2025-04-03 16:00:32 -07:00
contact_inboxes_controller_spec.rb chore: Add an API to find the contacts using contact inbox sourceId (#8012) 2023-09-28 15:26:28 -07:00
contacts_controller_spec.rb feat: integrate LeadSquared CRM (#11284) 2025-04-29 09:14:00 +05:30
conversations_controller_spec.rb feat: Add conversation delete feature (#11677) 2025-06-05 15:53:17 -05:00
csat_survey_responses_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
custom_attribute_definitions_controller_spec.rb chore: Ability to filter conversations with priority (#10967) 2025-03-03 16:38:22 +05:30
custom_filters_controller_spec.rb fix: Revert the changes for SyncCustomFilterCountJob (#8238) 2023-10-27 10:45:48 -07:00
dashboard_apps_controller_spec.rb fix: validate url for Dashboard Apps [CW-2979] (#8736) 2024-01-18 17:48:30 +05:30
inbox_members_controller_spec.rb feat: invalidate cache after inbox members or team members update (#10869) 2025-02-20 21:28:38 -08:00
inboxes_controller_spec.rb feat: Improve CSAT responses (#11485) 2025-05-16 14:18:52 +05:30
labels_controller_spec.rb chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
macros_controller_spec.rb feat: Add upload under account scope (#7914) 2023-09-19 09:51:54 +05:30
notification_settings_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
notifications_controller_spec.rb feat: Update last_snoozed_at after the un-snooze notification (#8943) 2024-02-20 18:55:39 +05:30
portals_controller_spec.rb chore: Clean up report & knowledge base policies (#11234) 2025-04-03 16:00:32 -07:00
search_controller_spec.rb feat: allow searching articles in omnisearch (#11558) 2025-05-28 13:50:50 +05:30
team_members_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
teams_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
webhook_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30