This repository complements the Front Application Webhooks tutorial. Refer to the tutorial for specifics about how to work with Front Application Webhooks.
This sample app should provide you with a basic template to help scaffold your own Application Webhooks, including secure verification of payload content.
In the project directory, you can run the following commands:
Install dependencies.
npm installRun the app in development mode; useful for quick restarts during development.
npm run devBuilds a production-ready version of your app.
npm run buildRun the built production version of the app.
npm run startWhen creating the Webhook connector in Front, ensure you follow these steps;
- Copy your Front App Secret and paste it into the
FRONT_APP_SECRETenvironment variable in the.envfile, or local environment settings. - Create a Server using the base URL of your app (see Exposing your endpoint (Local Development) if you're working locally)
- The app will serve the webhook endpoint at
<your-app-url>/webhook.
For local development, you can use tools like ngrok, zrok.io or localcan to expose your local server to the internet.
If using ngrok, run ngrok http 3000 to create a public URL that forwards to the app running locally on your machine at port 3000.
This uses Express as a fast and minimalist framework to handle incoming webhook calls. We make use of Express Middleware to perform validation and verification on incoming requests.