Skip to main content
Source Code This is a step by step guide on how to receive webhooks from qstash in your Next.js app.
1

Create a new nextjs app named `qstash-receiver`

There are great tutorials on how to setup Next.js on Vercel, so I won’t go into details here.
2

Install qstash

3

Write your function

/pages/api/qstash-serverless.ts
verifySignature or verifySignatureEdge will try to load QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY from the environment. If one of them is missing, an error is thrown. We will set these in step 5.
4

Deploy to Vercel

I’m deploying using Vercel’s CLI, but you could also push your project to a remote repo and deploy that way. If you have never used the cli, please run npx vercel login before. See hereYou can accept all the default settings.
5

Set Signing Keys in Vercel

Go to your project’s settings and set the following environment variables:
6

Redeploy to use the new environment variables

To make the added environment variables take effect, you must redeploy your project.
7

Publish a message

Go to your project’s logs and then publish a new message.
In the logs you should see something like this:
That’s it, you have successfully created a secure Next.js API route, that receives and verifies incoming webhooks from qstash. Learn more about publishing a message to qstash here