Head to https://www.originprotocol.com/developers to learn more about what we're building and how to get involved.
Origin Notifications Server
This service is capable of contacting users on various channels. Right now it supports email, browser push, and mobile push.
Messages are normally triggered by a POST to the
/events endpoint on this server. See the
test directory for examples manually triggering messages for testing.
--override-emailor env var
OVERRIDE_EMAIL: Email which will recieve all emails. This can be useful for testing on live data where you want to see what emails users would receive.
--fromEmailor env var
SENDGRID_FROM_EMAIL: Email from which messages are sent
--asmGroupIdor env var
ASM_GROUP_ID: SendGrid ASM group for handling unsubscribes.
--email-file-outor env var
EMAIL_FILE_OUT: Write emails also to files, using this directory+prefix. e.g. "emails/finalized"
Typical debug invocation
export LOG_LEVEL=DEBUG ./node_modules/.bin/nodemon src/app.js \ --email@example.com \
Browser Notifcations (Old)
The Easy Way
We recommend running Origin Box to simplify the process of configuring and running all of the modules within the Origin Monorepo.
The Not-As-Easy Way
If you're interested in running just the notifications service (and the event listener) without messaging, attestations, etc, here are some suggestions for making that happen:
- Install and run PostgreSQL
npm install web-push -g
- Add database url, email address, public and private keys to origin-notifications/.env
DATABASE_URL=postgresql://localhost/notification VAPID_EMAIL_ADDRESS=XXXXXXXXXX-your-email-address-XXXXXXXXXX VAPID_PRIVATE_KEY=XXXXXXXXXX-your-private-key-XXXXXXXXXX VAPID_PUBLIC_KEY=XXXXXXXXXX-your-public-key-XXXXXXXXXX
npm install -g sequelize-cli
npm run start:development
NOTE: VAPID key is for web-push. More detail here.
- Add public key and notifications url to origin-dapp/.env
- Add variables to origin-discovery/.env
AFFILIATE_ACCOUNT=0x821aea9a577a9b44299b9c15c88cf3087f3b5544 ARBITRATOR_ACCOUNT=0x0d1d4e623d10f9fba5db95830f7d3839406c6af2 BLOCK_EPOCH=0 DATABASE_URL=postgresql://localhost/discovery NETWORK_ID=999 IPFS_URL=http://localhost:8080/ WEB3_URL=http://localhost:8545/
node src/listener/listener.js --continue-file=continue --notifications-webhook=http://localhost:3456/events
(From time to time, you may need to
rm continue in origin-discovery.)
To test in the DApp...
- Create a listing
- Enable notifications
- Make an offer from a different account
For more (outdated) information, see the original pull request.
For local testing, these options are usual for testing against
export DATABASE_URL=postgresql://origin@localhost/origin npm run start:listener:development -- --identity --growth --marketplace \ --network=rinkeby \ --continue-file=../continue \ --notifications-webhook=http://localhost:3456/events \ --verbose ```