← All guides
· 11 min read

OpenReply: Free, Self-Hosted ManyChat Alternative (Setup Guide)

Deploy OpenReply, the open-source comment-to-DM tool for Instagram, on your own servers and send your first automatic DM. Step by step for beginners.

Stop paying for ManyChat: OpenReply, 2.6k GitHub stars

Someone comments a keyword on your reel and gets your link in their DMs a second later. ManyChat and tools like it charge a monthly fee for that. OpenReply does the same job, it’s free and open source, and it runs on servers you control.

The problem from the reel: comment-to-DM tools charge every month, and the bill grows with your audience.

Plan on an afternoon, most of it spent in Meta’s developer dashboard. You need a GitHub account, a Facebook account, an Instagram Business or Creator account, and a domain you can send email from.

What you’re building

OpenReply describes itself as “the open-source Manychat alternative” (MIT license, 2.6k GitHub stars). It watches the comments on your Instagram posts. When a comment matches a keyword you set, it sends that person a private reply through Meta’s official API, and it can post a public reply under the comment at the same time.

The diwenne/openreply GitHub page: Public, 2.6k stars, 1.1k forks, MIT license, described as The open-source Manychat alternative
The OpenReply repository. Source: GitHub.
How it works, from the reel.

It has two parts, and both must run:

comment on your reel → Meta webhook → web app (checks keywords) → queue → worker → DM
  • The web app shows your dashboard and receives the webhook. A webhook is Meta calling your server the moment something happens, here a new comment.
  • The worker is a separate process that actually sends the DMs. It has to stay on all the time, so it can’t run on Vercel, where code only runs briefly per request.

Both share a PostgreSQL database (campaigns, logs, accounts) and Redis (the send queue).

Besides keyword DMs, the README lists tracked links with click stats, up to two link buttons per DM, an optional follow gate, {username} personalization, and a cap that keeps you under Meta’s 750 private replies per hour.

Before you start: the honest catch

  • The software is free, but hosting might not be. The setup guide uses Vercel for the web app and Railway for the worker, Postgres and Redis, and it tells you to check hosting costs for your usage, because the always-on worker needs a suitable plan. The maintainer runs his own instance at zero cost: Vercel Hobby, Neon for Postgres, Redis Cloud’s free plan, and an Oracle Cloud “Always Free” VM for the worker (stack.md). This guide follows the documented Railway path because every step of it is written down.
  • Meta’s setup takes the longest. The repo’s own docs say the code works out of the box, and getting Meta to send you comment events is where people lose an afternoon.
  • It’s built for your own accounts. You can connect yours, and a few others you add as testers, with no review. Letting strangers connect through your Meta app needs App Review and business verification.
  • OpenReply uses the official API, so it doesn’t scrape, doesn’t drive a browser, and never asks for your Instagram password. Instagram’s policies, permissions, messaging windows and rate limits still apply to you.

There’s also a paid shortcut. Zernio, a sponsor of the project, connects Instagram for you so you can skip creating your own Meta app. This guide uses the free direct-Meta route.

Step 1: Fork the repo and make your secrets

  1. Open github.com/diwenne/openreply and click Fork. Railway and Vercel will both deploy from your fork.
  2. Generate three random secrets in your terminal and save them somewhere private:
openssl rand -base64 32   # NEXTAUTH_SECRET
openssl rand -base64 32   # CRON_SECRET
openssl rand -hex 32      # ENCRYPTION_KEY

ENCRYPTION_KEY encrypts your Instagram token. It has to be exactly 64 hex characters, and the web app and the worker must use the same value.

Check it worked: you have a fork under your GitHub username and three saved values.

Step 2: Set up Railway (database, Redis, worker)

Do Railway first, because Vercel needs its database addresses.

  1. Create an account on Railway and start a New Project.
  2. Click New → Database → Add PostgreSQL.
  3. Click New → Database → Add Redis.
  4. Click New → GitHub Repo and pick your fork. This becomes the worker.
  5. In the worker’s Settings, set:
Build Command:  npm run db:generate
Start Command:  npm run worker

Don’t leave the default npm run build. The worker only needs the generated database client, and a build step that tries to reach the database fails here.

  1. In the worker’s Variables, add the values from the environment variables table in Step 5. For the worker, use Railway’s internal addresses (they contain railway.internal).

Railway shows two addresses for each database:

VariableUse it for
DATABASE_URL / REDIS_URL (internal)the Railway worker only
DATABASE_PUBLIC_URL / REDIS_PUBLIC_URLVercel, and running migrations from your computer

Check it worked: three services sit in your Railway project.

Step 3: Create the database tables

On your computer, inside a clone of your fork, run this once with the public Postgres address:

npm install
DATABASE_URL="postgresql://...proxy.rlwy.net.../railway" npm run db:migrate

Check it worked: the command finishes without errors.

Step 4: Set up login email with Resend

OpenReply signs you in with email magic links only, so without email nobody can log in.

  1. Create a Resend account and verify a sender domain.
  2. Create an API key. That’s RESEND_API_KEY.
  3. Pick a sender address on the verified domain. That’s EMAIL_FROM.

Already running your own mail server? Set EMAIL_SERVER to an SMTP URL instead and skip Resend.

Step 5: Deploy the web app on Vercel

  1. On Vercel, click Add New Project and import your fork.
  2. Under Settings → Environment Variables, add:
VariableValue
NEXTAUTH_URLyour Vercel address, e.g. https://your-app.vercel.app
NEXTAUTH_SECRETfrom Step 1
CRON_SECRETfrom Step 1
ENCRYPTION_KEYfrom Step 1, identical to the worker
DATABASE_URLRailway’s DATABASE_PUBLIC_URL
REDIS_URLRailway’s REDIS_PUBLIC_URL
RESEND_API_KEYfrom Step 4
EMAIL_FROMfrom Step 4
ALLOWED_EMAILSyour email address

Give the worker the same values, with two changes: its DATABASE_URL and REDIS_URL are Railway’s internal ones, and its NEXTAUTH_URL is still your Vercel address.

ALLOWED_EMAILS is optional, but set it. Without it, anyone who finds your URL can request a login link and get a workspace on your instance.

  1. Deploy.

You don’t need to buy a domain. The free your-app.vercel.app address works for everything below.

Check it worked: open https://your-app.vercel.app/api/health. It reports the database, Redis, queue and worker. worker.healthy: true means the Railway worker is running and can reach Redis.

Step 6: Create the Meta app and collect its secrets

  1. Go to developers.facebook.com/apps and create an app. App type: Business. Use a contact email you actually read.
  2. When it asks for a use case, filter to All and choose Manage messaging and content on Instagram. Don’t pick “Authenticate with Facebook Login”. OpenReply uses Instagram Login, and the Facebook Login variant breaks the connection later with a mismatched-client error.
  3. Collect these and add them to both Vercel and Railway:
VariableWhere it lives
INSTAGRAM_APP_IDInstagram product → API setup with Instagram login
INSTAGRAM_APP_SECRETsame page, click Show
FACEBOOK_APP_SECRETApp settings → Basic → App secret
WEBHOOK_VERIFY_TOKENany random string you make up
META_GRAPH_API_VERSIONa Graph API version, e.g. v25.0

The Instagram app ID is a different number from the Facebook App ID on the Basic settings page. Use the one under the Instagram product.

Redeploy on Vercel so it picks up the new variables.

Step 7: Add yourself as an Instagram tester

Until the app is approved, only accounts with a role on it can connect, and that includes your own. It has two halves, and both are required.

  1. Meta side: in the app dashboard, open App roles → Roles, find Instagram testers, and invite your exact Instagram username.
  2. Instagram side: in the Instagram app, go to your profile → menu → Settings and activity → Apps and websites → Tester invites, and accept.

Check it worked: the invite shows as accepted. If you skip the second half, Instagram’s login screen says “Insufficient Developer Role”.

Step 8: Connect the redirect and the webhook

Still in the Instagram product:

  1. Under Business login settings → OAuth redirect URIs, add exactly:
https://your-app.vercel.app/api/instagram/callback

No trailing slash.

  1. Under Configure webhooks:
    • Callback URL: https://your-app.vercel.app/api/webhook
    • Verify token: your WEBHOOK_VERIFY_TOKEN
    • Click Verify and save
    • Subscribe to comments and messages

comments carries comment-to-DM. messages carries DMs and Story replies.

Check it worked: click Test next to comments, then Send to My Server. You have to click both; Test alone only previews the payload.

Meta's developer documentation page Send a Private Reply to a Commenter, with the steps: a user comments, a webhook fires, your app sends a private reply
The official Meta API that OpenReply sends through. Source: Meta developer docs.

Step 9: Publish the app

Real comment events only arrive once the app is Live. In Development mode, only the dashboard’s Test button delivers anything. The docs call this the most common reason for “I set everything up and nothing happens”.

  1. Open Publish in the left sidebar.
  2. Fill in the three policy URLs. OpenReply already serves these pages:
https://your-app.vercel.app/privacy
https://your-app.vercel.app/terms
https://your-app.vercel.app/data-deletion
  1. Publish.

Step 10: Connect Instagram and send your first DM

  1. Open your Vercel URL, sign in with the magic link, and go to Settings → Connect Instagram.
  2. Create a campaign on one of your posts with the keyword TEST.
  3. From a different Instagram account, comment TEST on that post. OpenReply ignores your own comments on purpose.
What happens on a match, from the reel.

Check it worked: the DM arrives, and the DM Logs page shows a SENT row.

Troubleshooting

Comments come in but no DM is sent

Check /api/health. If worker.healthy is false, the worker isn’t running or can’t reach Redis. Webhooks still arrive, but nothing sends.

“Insufficient Developer Role” on the Instagram login

You haven’t accepted the tester invite inside Instagram yet (Step 7, second half).

Connecting a second account fails with “Unsupported request - method type: get”

Publishing the app doesn’t widen who can use it. Every account you connect needs its own tester invite, sent and accepted. Accounts you don’t control need App Review.

Every send fails to decrypt

The web app and the worker have different ENCRYPTION_KEY values. Make them identical.

Vercel hangs or times out on the database

You gave Vercel an internal railway.internal address. Vercel runs outside Railway’s network, so it needs the public addresses.

The first DM works, but button taps fail with “not the thread owner”

The account was once connected to ManyChat or another DM tool, and that tool still owns the conversations. In Meta Business Suite, open Settings → Integrations → Conversation routing → Partner apps. Disconnect the old tool from inside the tool itself, then click Manage next to your OpenReply app and turn on Access all conversations and Take control of conversations.

What else you can do with it

  • Turn on the DM trigger in a campaign, and “Reply LINK to this Story” works with no post at all.
  • Add a follow gate, so commenters have to follow before the link arrives. OpenReply checks Meta’s follow flag, and if Instagram doesn’t return it, it sends the link anyway, so a real follower is never stuck.
  • Send up to two buttons per DM, each with its own tracked link and click stats.
  • Run it for clients with workspaces, owner, admin and member roles, and invite links.
  • Let an AI assistant do the setup. The setup guide ends with a ready-made prompt for Claude Code or Cursor that walks you through every step.

Quick recap

  1. Fork the repo and generate NEXTAUTH_SECRET, CRON_SECRET and ENCRYPTION_KEY.
  2. On Railway, add Postgres, Redis and a worker (npm run worker).
  3. Run npm run db:migrate against the public database address.
  4. Set up Resend for login emails.
  5. Deploy the web app on Vercel and check /api/health.
  6. Create a Meta Business app with the Instagram messaging use case and copy its secrets.
  7. Invite yourself as an Instagram tester and accept it inside Instagram.
  8. Add the OAuth redirect and the webhook (comments and messages).
  9. Publish the app.
  10. Connect Instagram, make a TEST campaign, and comment from a second account.