There are two repositories you will need to self host Suprr:
- Suprr chat bubble (https://github.com/nihilanthmf/suprr-chat)
- Suprr nodejs backend (this repo: https://github.com/nihilanthmf/suprr)
Here's a step-by-step instruction on how to self-host the backend:
- Clone this repository (https://github.com/nihilanthmf/suprr)
- Create a .env file inside the repo directory with the following values: DATABASE_URL=postgresql://your-pg-database-url TELEGRAM_BOT_TOKEN=your-telegram-bot-token BASE_URL=the-url-of-your-backend
- Create a postgress database with the schema that is defined in the schema.sql in the root of the project
- Host the database using the provider of your choice (Supabase, render.com, AWS, DigitalOcean, etc.)
- Put your database URL in the DATABASE_URL field in your .env file
- Create a Telegram Account: If you don't already have one, sign up for a Telegram account.
- Find BotFather: Search for "@BotFather" in your Telegram contacts and start a chat with them.
- Create a New Bot: Type "/newbot" in the chat with BotFather.
- Name and Username: BotFather will prompt you to choose a name and a unique username for your bot. Choose any name and username you want.
- Get the Token: Once you've provided the name and username, BotFather will give you a token. This is a unique key for your bot and is essential for accessing the Telegram API.
- Put the Token in the TELEGRAM_BOT_TOKEN in your .env file
- Host the service using (you can either use Commit-to-deploy or Docker, Dockerfile and .dockerignore are already configured in the repository)
- Put the url of your newly-hosted server in the BASE_URL in .env and re-deploy
Congrats! The backend is deployed!
- Create a new row in the "projects" table in your database
- Choose a random id, name, user fields, leave chats as an empty array, lastseen and created_at fields should be automatically set to current time. Enter chatid
- Create a Telegram account (if you don’t have one) at telegram.org
- Create a Telegram group
- Go to the group's settings
- Turn “Topics” on in the Telegram group
- Add your bot to the group
- Give your bot full permissions inside the group
- Go to @raw_data_bot ("https://t.me/raw_data_bot"), start conversation with it, click on a “Chat” button down below and choose your newly created group
- Copy the outputted Chat id and paste it here into the chatid field in the database row that you created on the previous step
- Clone the frontend repo (https://github.com/nihilanthmf/suprr-chat)
- Add your server url (BASE_URL) to the "websiteUrl" variable in the app.js file
- Add the app.js file to your project directory
- Get a project key from the database row that you have created
- Embed the app.js on every page of your website where you want the customer support bubble to show using <script src="app.js?projectKey=your-project-key"></script>