iachat/app/javascript/dashboard/i18n/locale/en
Muhsin Keloth d827e66453
feat: Instagram Inbox using Instagram Business Login (#11054)
This PR introduces basic minimum version of **Instagram Business
Login**, making Instagram inbox setup more straightforward by removing
the Facebook Page dependency. This update enhances user experience and
aligns with Meta’s recommended best practices.

Fixes
https://linear.app/chatwoot/issue/CW-3728/instagram-login-how-to-implement-the-changes


## Why Introduce Instagram as a Separate Inbox?


Currently, our Instagram integration requires linking an Instagram
account to a Facebook Page, making setup complex. To simplify this
process, Instagram now offers **Instagram Business Login**, which allows
users to authenticate directly with their Instagram credentials.

The **Instagram API with Instagram Login** enables businesses and
creators to send and receive messages without needing a Facebook Page
connection. While an Instagram Business or Creator account is still
required, this approach provides a more straightforward integration
process.

| **Existing Approach (Facebook Login for Business)** | **New Approach
(Instagram Business Login)** |
| --- | --- |
| Requires linking Instagram to a Facebook Page | No Facebook Page
required |
| Users log in via Facebook credentials | Users log in via Instagram
credentials |
| Configuration is more complex | Simpler setup |

Meta recommends using **Instagram Business Login** as the preferred
authentication method due to its easier configuration and improved
developer experience.

---

## Implementation Plan

The core messaging functionality is already in place, but the transition
to **Instagram Business Login** requires adjustments.

### Changes & Considerations

- **API Adjustments**: The Instagram API uses `graph.instagram`, whereas
Koala (our existing library) interacts with `graph.facebook`. We may
need to modify API calls accordingly.
- **Three Main Modules**:
  1. **Instagram Business Login** – Handle authentication flow.
2. **Permissions & Features** – Ensure necessary API scopes are granted.
  3. **Webhooks** – Enable real-time message retrieval.

![CleanShot 2025-03-10 at 21 32
28@2x](https://github.com/user-attachments/assets/1b019001-8d16-4e59-aca2-ced81e98f538)


---

## Instagram Login Flow

1. User clicks **"Create Inbox"** for Instagram.
2. App redirects to the [Instagram Authorization
URL](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/business-login#embed-the-business-login-url).
3. After authentication, Instagram returns an authorization code.
5. The app exchanges the code for a **long-lived token** (valid for 60
days).
6. Tokens are refreshed periodically to maintain access.
7. Once completed, the app creates an inbox and redirects to the
Chatwoot dashboard.

---

## How to Test the Instagram Inbox

1. Create a new app on [Meta's Developer
Portal](https://developers.facebook.com/apps/).
2. Select **Business** as the app type and configure it.
3. Add the Instagram product and connect a business account.
4. Copy Instagram app ID and Instagram app secret
5. Add the Instagram app ID and Instagram app secret to your app config
via `{Chatwoot installation
url}/super_admin/app_config?config=instagram`
6. Configure Webhooks:
   - Callback URL: `{your_chatwoot_url}/webhooks/instagram`
   - Verify Token: `INSTAGRAM_VERIFY_TOKEN`
- Subscribe to `messages`, `messaging_seen`, and `message_reactions`
events.
7. Set up **Instagram Business Login**:
   - Redirect URL: `{your_chatwoot_url}/instagram/callback`
8. Test inbox creation via the Chatwoot dashboard.


## Troubleshooting & Common Errors

### Insufficient Developer Role Error

- Ensure the Instagram user is added as a developer:
- **Meta Dashboard → App Roles → Roles → Add People → Enter Instagram
ID**

### API Access Deactivated

- Ensure the **Privacy Policy URL** is valid and correctly set.

### Invalid request: Request parameters are invalid: Invalid
redirect_uri

- Please configure the Frontend URL. The Frontend URL does not match the
authorization URL.
---


## To-Do List

- [x] Basic integration setup completed.  
- [x] Enable sending messages via [Messaging
API](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/messaging-api).
- [x] Implement automatic webhook subscriptions on inbox creation.  
- [x] Handle **canceled authorization errors**.  
- [x] Handle all the errors
https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/error-codes
- [x] Dynamically fetch **account IDs** instead of hardcoding them.  
- [x] Prevent duplicate Instagram channel creation for the same account.
- [x] Use **Global Config** instead of environment variables.  
- [x] Explore **Human Agent feature** for message handling.  
- [x] Write and refine **test cases** for all scenarios.  
- [x] Implement **token refresh mechanism** (tokens expire after 60
days).
Fixes https://github.com/chatwoot/chatwoot/issues/10440

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-04-08 10:47:41 +05:30
..
advancedFilters.json feat(v4): Add new conversation filters component (#10502) 2024-11-27 20:05:54 -08:00
agentBots.json chore: Update settings to match the new design (#11084) 2025-03-14 14:28:14 +05:30
agentMgmt.json fix: Translate "None" option in agent assignment dropdown (#11060) 2025-03-11 14:49:27 -07:00
attributesMgmt.json chore: update interpolation syntax for i18n files (#10198) 2024-10-07 11:12:40 -07:00
auditLogs.json chore: update interpolation syntax for i18n files (#10198) 2024-10-07 11:12:40 -07:00
automation.json chore(i18n): Improvements in automation and macros (#11231) 2025-04-02 15:48:42 -07:00
bulkActions.json chore: update interpolation syntax for i18n files (#10198) 2024-10-07 11:12:40 -07:00
campaign.json feat(v4): Update the campaigns page design (#10371) 2024-10-31 11:57:13 +05:30
cannedMgmt.json feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
chatlist.json feat: Adds support for telegram contact sharing (#10841) 2025-02-06 14:23:08 +05:30
components.json feat: Add support for feature spotlight components (#11012) 2025-03-18 13:17:42 -07:00
contact.json fix: Incorrect translation in contact merge modal and resolve z-index issue (#10943) 2025-02-20 22:01:36 -08:00
contactFilters.json fix: Contact filter attribute groups (#10080) 2024-09-06 13:41:48 +05:30
conversation.json feat(apps): Shopify Integration (#11101) 2025-03-19 15:37:55 -07:00
csatMgmt.json feat: more CSAT filters (#7038) 2023-05-18 22:50:46 +05:30
customRole.json feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
datePicker.json feat: Custom date picker (#9247) 2024-04-29 14:43:57 +05:30
emoji.json feat: Adds the ability to set an emoji for help center category (#8111) 2023-10-20 13:52:30 +05:30
general.json feat: Eslint rules (#9839) 2024-08-05 14:02:16 +05:30
generalSettings.json feat: Ability to delete account for administrators (#1874) 2025-04-03 10:41:39 +05:30
helpCenter.json feat(v4): Help center portal redesign improvements (#10349) 2024-10-28 21:04:43 -07:00
inbox.json feat(v4): Update Inbox view card design (#10599) 2025-01-07 21:11:54 +05:30
inboxMgmt.json feat: Instagram Inbox using Instagram Business Login (#11054) 2025-04-08 10:47:41 +05:30
index.js chore: Update translations, add pnpm sync:i18n command (#10893) 2025-02-12 17:43:46 -08:00
integrationApps.json chore: Update settings to match the new design (#11084) 2025-03-14 14:28:14 +05:30
integrations.json feat(apps): Shopify Integration (#11101) 2025-03-19 15:37:55 -07:00
labelsMgmt.json feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
login.json feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
macros.json feat: Add webhook event support for macros (#11235) 2025-04-02 20:26:55 -07:00
report.json feat: Add per-page support for agent and team overview report pagination (#11110) 2025-03-19 16:45:59 +05:30
resetPassword.json feat: Support dark mode in login pages (#7420) 2023-07-01 07:49:52 +05:30
search.json feat: show email subject in conversation search results (#10843) 2025-02-06 10:38:57 +05:30
setNewPassword.json feat: update product copy [CWM-45] (#6372) 2023-04-25 22:02:15 -07:00
settings.json chore: Remove old buttons from Vue2 design (#11159) 2025-03-31 17:51:38 -07:00
signup.json fix: signup form broken in production (#10206) 2024-10-03 11:23:30 +05:30
sla.json feat: Update the design for integration page (#9825) 2024-07-24 16:35:40 -07:00
teamsSettings.json chore: update interpolation syntax for i18n files (#10198) 2024-10-07 11:12:40 -07:00
webhooks.json Feature: As a admin, I should be able to add webhooks to account (#572) 2020-02-29 17:43:49 +05:30
whatsappTemplates.json chore: update interpolation syntax for i18n files (#10198) 2024-10-07 11:12:40 -07:00