Messenger Setup
Last update: 2022/11/5
Bringing users back to you application is an important part of the modern user experience. This guide will show you how to add email, sms, and push notification support to your application.
REQUIREMENTS: A gmail account, a twilio account
The messaging service is currently configured to use gmail servers. If you would like to use a different service, the script can be modified
To set up the emailing service with your gmail account, you first need to create an app password using this link: https://myaccount.google.com/apppasswords To generate the password, select Other and set the name to something memorable (ex: Website Backend)
Then, you will need to set the following environment variables in the .env
file:
SITE_EMAIL_USERNAME - What you login as (ex: personalaccount@gmail.ccom)
SITE_EMAIL_ALIAS - What sender address the user sees. Can be the same as SITE_EMAIL_USERNAME, or can be an alias you've set up
SITE_EMAIL_FROM - What sender name the user sees
SITE_EMAIL_PASSWORD - The app password generated in the previous step
SMS
REQUIREMENTS: A twilio account
You will need to set the following environment variables in the .env
file:
TWILIO_ACCOUNT_SID - Can be found at twilio.com/console
TWILIO_AUTH_TOKEN - Can be found at twilio.com/console
Push Notifications
You will need to set the following environment variables in the .env
file:
VAPID_PUBLIC_KEY - The public key sent to the client VAPID_PRIVATE_KEY - The private key used to sign the push notifications
Both of these keys - which are called VAPID keys - can be generated by running the following command from the root of the project:
./node_modules/.bin/web-push generate-vapid-keys