Skip to main content
Two minutes from npm install to a webhook receiving real Instagram DMs on your laptop.

What you’ll have

In a few minutes you’ll be sending and receiving real Instagram DMs from your own app, running on your laptop. DM a sandbox Instagram account from your own account, watch the message land in your code in under a second, and reply right back.

Install and authenticate

npm install -g @gethookmyapp/cli
hookmyapp login
hookmyapp login opens a browser tab. After sign-in, the CLI writes a credential token to a local file in your config directory.

Start a sandbox session

hookmyapp sandbox start instagram
The CLI prints an ig.me deep link to the sandbox Instagram account. DM that account from the Instagram account you want to bind. That message is what pins the session to your account (it proves you control it; we can’t take your word for it). Open the deep link on your phone to start the DM with the code prefilled. The sandbox is a test Instagram account you can use right away. It removes Meta paperwork: no Business Manager, no connected account of your own, no access token.

Clone and run the starter kit

git clone https://github.com/hookmyapp/webhook-starter-kit.git
cd webhook-starter-kit
npm install
hookmyapp sandbox env --write .env
npm start
The starter kit ships signature-verifying receivers at POST /webhook/instagram and POST /webhook/whatsapp (it serves both channels at once), per-channel send(to, text) helpers, an auto-reply you can customize, and an .env.example the CLI fills in. hookmyapp sandbox env --write .env writes the sandbox proxy URL, your session activation code, the test account’s ID, and a VERIFY_TOKEN for HMAC verification.

Open the tunnel

hookmyapp sandbox listen --path /webhook/instagram
This opens a secure tunnel from a HookMyApp-managed public hostname to http://localhost:3000/webhook/instagram. The tunnel lives as long as the CLI process runs.

Send a test message

DM the sandbox Instagram account from your pinned account. Your receiver logs the inbound webhook. The starter kit’s auto-reply lands back in your DMs. You can also send a one-shot test from the CLI:
hookmyapp sandbox send --message "hello from my app"

From the sandbox to your own account

When you’re ready for your own Instagram account, the dev loop stays the same: same receiver code, same local tunnel, just a real channel.

Connect your Instagram account

hookmyapp channels connect instagram
Opens Meta embedded signup in a browser tab. Sign in, pick the Instagram login path (Instagram Login directly, or Instagram via a linked Facebook Page), grant the messaging permissions, and select the account. The CLI lands you back with a new Channel ID (ch_xxxxxxxx). Confirm with:
hookmyapp channels list
See Connect Instagram for the full flow and what you get back.

Pull your account’s env

hookmyapp channels env ch_xxxxxxxx --write .env
Overwrites the sandbox values in .env with your own account’s: INSTAGRAM_GRAPH_API_URL (the HookMyApp gateway, <gateway>/<graph-version>), your INSTAGRAM_USER_ID, and a scoped gateway access token (hmat_…) in INSTAGRAM_ACCESS_TOKEN. Both base URLs point at the gateway, which swaps the hmat_ token for the real Meta token server-side. The receiver code does not change.

Listen locally against your account

hookmyapp channels listen ch_xxxxxxxx --path /webhook/instagram
Same shape as hookmyapp sandbox listen, but on your own channel. Opens a secure tunnel from a HookMyApp-managed hostname to localhost:3000/webhook/instagram and points Meta at it while the CLI runs. Stop the CLI (Ctrl-C) and the tunnel is reclaimed; Meta’s webhook URL reverts to whatever was set before. Real DMs to your connected account now arrive on your laptop. The same auto-reply works.

Set your own webhook URL (when you deploy)

When your receiver is deployed behind a stable public URL, replace the tunnel with that URL:
hookmyapp channels webhook set ch_xxxxxxxx \
  --url https://api.yourapp.com/webhook/instagram \
  --verify-token $(openssl rand -hex 32)
HookMyApp writes it to Meta’s override_callback_uri via the Graph API.

Next steps