Copy env.example into .env.[production|test|development].local and fill values for each env
Go to project's settings/environment-variables and create an env vars for each env
- INTERCOM_TOKEN: the intercom app access token
- INTERCOM_ADMIN_ID: the workspace admin user id used to send the first outbound message
- INTERCOM_OUTBOUND_MESSAGE: the outbound message sent when first creating the advisor conversation
- REALM_API_URL: the realm api url
https://app.intercom.com/a/apps/kfms5gdr/developer-hub/app-packages/83917/basic-info
Start dev server:
yarn dev
- register an account with ngrok, register a local token
- ngrok http 3000 --subdomain realm-intercom
- in realm-native app > .env.development > fill ADVISORY_API_URL=/api/advisory
Branches:
- prod: https://realm-intercom.vercel.app -> points to prod realm/intercom
- staging: https://realm-intercom-git-staging-gblejman.vercel.app -> points to staging realm/intercom
- GET [url]/api/config: info about the environment running
- GET [url]/api/advisory/conversation: fetches user conversation, sets it up if missing
- POST [url]/api/advisory/conversation/reply: replies user conversation
- GET [url]/api/setup: pre-emptively sets a conversation if missing
- POST [url]/api/webhook: called by intercom with subscription event data
Will temp use user.social_facebook
field to persist the linking, until properly added in schema and user model
JSON.stringify({
intercom_contact_id: string | null,
intercom_conversation_id: string | null,
});