Prerequisite

You need an account before publishing messages, create one here.

Introduction

QStash is an HTTP based messaging and scheduling solution for the serverless and edge runtimes.

  • 100% serverless, no stateful connections required. Messages are pushed to your API.
  • At-least-once delivery guaranteed to any public API
  • Pubsub via topics
  • Delay message delivery
  • Message deduplication
  • Scheduling via CRON

Requirements

1. Public API

Make sure you have a publicly available HTTP API that you want to send your messages to. If you don’t, you can use something like requestcatcher.com or webhook.site to try it out.

2. Get your token

Go to Upstash Console and copy the QSTASH_TOKEN.

Publish a message

A message can be any shape or form: json, xml, binary, anything, that can be transmitted in the http request body. We do not impose any restrictions other than a size limit of 1 MB (which can be customized at your request).

In addition to the request body itself, you can also send HTTP headers. Learn more about this in the message publishing section.

curl -XPOST \
    -H 'Authorization: Bearer <QSTASH_TOKEN>' \
    -H "Content-type: application/json" \
    -d '{ "hello": "world" }' \
    'https://qstash.upstash.io/v2/publish/https://<your-api-url>'

See more examples in the example section.

Check Response

You should receive a response with a unique message ID.

{
  "messageId": "msg_xxxxxxxxxxxxxxxxxx"
}

Check Message Status

Head over to Upstash Console and go to the Logs tab where you can see your message activities.

Learn more about different states here.