Skip to content

A flexible and easy-to-use Node.js boilerplate for implementing Instagram webhook functionality.

License

Notifications You must be signed in to change notification settings

biggaji/insta-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instagram Webhook Boilerplate

Node.js License

A flexible and easy-to-use Node.js boilerplate for implementing Instagram webhook functionality.

Features

  • 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.

Table of Contents

Getting Started

Prerequisites

Installation

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

Configuration

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.

Usage

Verifying Requests

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.

Handling Instagram Webhook Events

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.

Testing

Run the test suite using the following command:

npm test

References

Meta Webhook

Set Up Webhooks for Instagram

Instagram Object Reference

Thank you and Happy coding!

About

A flexible and easy-to-use Node.js boilerplate for implementing Instagram webhook functionality.

Topics

Resources

License

Stars

Watchers

Forks