A flexible and easy-to-use Node.js boilerplate for implementing Instagram webhook functionality.
- Instagram Verification: Handles verification requests to ensure the webhook is properly set up.
- Payload Verification: Compares the received signature with the locally generated HMAC signature for payload integrity.
- Flexible Structure: Easily customizable and extendable for your specific use cases.
- Tested: Includes a comprehensive test suite using Chai and Supertest.
Clone the repository:
git clone https://github.com/biggaji/insta-webhook.git
Install dependencies:
Using npm
cd insta-webhook
npm install
Using yarn
cd insta-webhook
yarn
Create a .env
file in the root directory and configure the following variables:
META_HUB_VERIFY_TOKEN=
META_APP_SECRET=
Replace META_HUB_VERIFY_TOKEN
and META_APP_SECRET
with your actual Instagram Hub Verify Token and App Secret.
It perfectly handles Instagram verification requests sent by Meta GraphAPI to verify your webhook endpoint.
The endpoint /meta/webhook/verify_request
handles that. You can modify the API path to suit your use case.
Check the index.js
file for code implementation.
Instagram webhook events are sent to this path /meta/webhook/instagram
. Be sure to modify the logic to
implement your desired business logic in the index.js
file. For now it only verifies the webhook sha256
signature, saving you the time for writing the logic to verify and compare signatures. Check the index.js
file for code implementation.
Run the test suite using the following command:
npm test
Thank you and Happy coding!