📩Subscribe to Events

POST https://api.getalby.com/nwc/subscriptions

Notifies about new events matching the filter provided via webhooks

Request Body

NameTypeDescription

relayUrl

string

If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1)

webhookUrl*

string

Webhook URL to publish events

filter*

JSON object (see example)

Filters to subscribe to

Filter Example

{
  "ids": ["id1", "id2"],
  "kinds": [1,2],
  "authors": ["author1", "author2"],
  "since": 1721212121,
  "until": 1721212121,
  "limit": 10,
  "search": "example search",
  "#tag1": ["value1", "value2"],
  "#tag2": ["value3"],
  "#tag3": ["value4", "value5", "value6"],
}
// Source: https://pkg.go.dev/github.com/nbd-wtf/go-nostr@v0.30.0#Filter

Response

{
  "subscription_id": "f370d1fc-x0x0-x0x0-x0x0-8f68fa12f32c",
  "webhookUrl": "https://your.webhook.url"
}

Response to Webhook URL

{
  "id": "a16ycf4a01bcxx........xxxxx",
  "pubkey": "a16y69effexxxx........xxxxx",
  "created_at": 1709033612,
  "kind": 23195,
  "tags": [
      [
          "p",
          "f490f5xxxxx........xxxxx"
      ],
      [
          "e",
          "a41aefxxxxx........xxxxx"
      ]
  ],
  "content": "<encrypted content>",
  "sig": "<signature>"
}

Last updated

Logo

Your bitcoin & nostr companion / from 🐝 with 🧡