Innovative way to market 📣 and communicate 💬
-
Clone project to your computer with :
git clone https://github.com/Nummenpojat/suppis-core.git
-
Run
npm install
to install dependencies of Suppis-core -
Configure Firebase 🔥
- Make Firebase project
- Go to Authentication and enable Google as sign-in provider
- Enable AppCheck. Check docs for the information how to do it
- Note that some steps on the documentation referenced above apply to frontend
- Go to project settings >> Service accounts >> Firebase Admin sdk >> and download your private key
- Copy the serviceAccountKey.json file to your project
-
Make
.env
file to the root -
Configure all environment variables as in
.env.example
and belowPORT= # Port number FIREBASE_SECRET_KEY_PATH= # File path to Firebase service key. Example: "/config/firebase-admin-secrets/secret-key.json" WHATSAPP_SESSION_PATH= # File path where whatsapp-web.js stores session
-
Run
npm install -g ts-node
to run Suppis in development -
Now you can run
npm run dev
ornpm run start
to start up the app- If you want to build the app run
npm run build
- If you want to build the app run
- Install Docker
- Configure env variables in
Dockerfile
anddocker-compose.yml
- Run
docker compose up
(If something does not work, be sure to consult docs)
Suppis uses as it's main component Whatsapp-Web.js library, which is used to send messages and Firebase for authentication and API security Also some other technologies that Suppis uses are Express for API, Typescript for better developer experience and React on the frontend for the admin panel
Every request must contain these headers like this 👇
{
"X-Firebase-IdToken": "Your Firebase IdToken here",
"X-Firebase-AppCheck": "Your Firebase AppCheckToken here"
}
Check Firebase docs how to get IdToken and AppCheckToken
- Make user admin on
/admin/set
- Put request
- Takes email in body
"email": <email>
- Responses with string on the body containing message
- Remove admin from user on
/admin/remove
- Delete request
- Takes email in body
"email": <email>
- Responses with string containing message
- Check status of Whatsapp client on
/whatsapp/status
- Any request type
- Responses with string on the body containing message
- On status code 409 responses with object like 👇
{ "type": "qr" "data": "<qr code as text>" }
- Send message to one person on
/whatsapp/send/one
- Post request
- Takes a message and a number in body
- Responses with string on the body containing message
- Send message to list of people on
/whatsapp/send/list
- Post request
- Takes a message and list of numbers in body
- Responses with string on the body containing message