Microservice to send Snapshot related notifications to multiple communication channels.
- Node.js 22.6+
- PostgreSQL 14+
- Fork this repository then run this command to install dependencies:
yarn install- Create a PostgreSQL database then setup a new file
.envwith the PostgreSQL connection string (the app applies its own migrations at startup):
DATABASE_URL=postgres://...
HUB_URL=https://hub.snapshot.org # Use https://testnet.hub.snapshot.org for the demo instance
SERVICE_EVENTS=1- Set the replay cursor (the app refuses to start without it, to prevent an accidental full-history replay). This applies the migrations and sets
last_mcito the given value, creating or overwriting it — use it to seed a fresh database or to resume from a specific MCI during a cutover:
yarn db:set-mci <mci>-
Fresh install: set
<mci>to the hub's current MCI — query{ messages(first: 1, orderBy: "mci", orderDirection: desc) { mci } }on<HUB_URL>/graphql. Using0replays the entire hub history. -
After each schema change (
src/schema.ts), runyarn db:generateto generate the matching migration. -
Comment line(s) on this file to disable provider(s).
-
Run the
devscript to start the server
yarn dev- Run
yarn test. Requires a local PostgreSQL database namedsnapshot_webhook_test(connection defaults intest/.env.test) — migrations are applied automatically before the suite runs.
Create a new file with the name of the provider in the folder ./src/providers and expose a method send following the same format than on others files in the same folder. Then add the provider in the file ./src/providers/index.
MIT.