FeedMe Connect
Project Setup
To get started with the project, run the following commands:
pnpm install
Compile and Hot-Reload for Development
pnpm dev
Type-Check, Compile and Minify for Production
pnpm build
Feature Flags
Connect uses @feedmepos/feature-flag directly in the frontend. WhatsApp Bot
shares the business flag loading used by broadcast channels in
src/feature-flag.ts and uses the connect_whatsapp_bot flag.
| Feature | Flagsmith key |
|---|---|
| WhatsApp Bot | connect_whatsapp_bot |
| Broadcast App Inbox | connect_broadcast_app_inbox_countries |
| Broadcast Push | connect_broadcast_push_countries |
| Broadcast WhatsApp | connect_broadcast_whatsapp_countries |
WhatsApp Bot and broadcast channel flags must be enabled and allow the current
business country. Their values are
comma-separated country codes, such as MY,SG; an empty value or * allows every
country. Country codes are case-insensitive.
Connect checks country lists locally; it does not send country traits to
Flagsmith. To enable WhatsApp Bot for Malaysia, enable connect_whatsapp_bot
at the environment level and set its value to MY. Use MY,SG for both countries.
Country segment rules are not needed for this setup.
Connect loads flags on startup and when the selected business changes. Country changes re-evaluate the country checks locally. The WhatsApp sidebar entry stays hidden and WhatsApp views stay unmounted while flags load. Direct links show a loading screen until the check finishes; disabled or failed checks redirect to analytics.
Local setup
Set the frontend Flagsmith API key in Connect's local environment, then restart the Vite dev server:
FEATURE_FLAG_API_KEY=<Development environment client key>
This is the same frontend configuration used by broadcast channel flags.
Enable selected businesses
- In https://flagsmith.feedme.farm, open organisation Feedme, project MAIN, and Development for local testing.
- Create or rename the flag to
connect_whatsapp_bot, disabled by default. - Open Connect with the desired business selected. The first flag evaluation registers that business ID as a Flagsmith identity.
- In Identities, find
business-<businessId>and enable theconnect_whatsapp_botoverride. Identity or segment overrides can enable selected businesses. Set the effective value to the allowed countries, such asMY,SG, or*for every country; enabling an override still applies this country check. - Reload Connect, then open
/whatsapp. To revoke access, disable the override and reload.
Configure Production separately with its frontend API key. This flag controls page visibility; existing WhatsApp API permissions continue to apply.
Verify locally
With Connect signed in, inspect the browser's Network tab for the frontend
Flagsmith request using identity business-<businessId>. Verify the WhatsApp Bot
navigation entry and /whatsapp are available only when
connect_whatsapp_bot is enabled and its value allows the selected country.
Disabled, missing, country-excluded, or failed flag checks keep the
entry hidden and redirect direct links to analytics.
Formatting is with prettier, set default formatter to Prettier
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}