Alby Developer Guide
User GuideDeveloper Portal
NWC API
NWC API
  • Introduction
    • ❔What is Nostr Wallet Connect?
  • Building Lightning Apps
    • ⛓️NWC HTTP API
      • ℹ️Fetch NWC Info
      • 📢Publish NWC Request
      • ✍️Publish Event
      • 📩Subscribe to Events
      • 🔔Subscribe to NWC Notifications
      • 🔕Delete Subscriptions
      • ↔️Code examples: Creating Requests
    • ⚡NWC JS SDK
  • Building NWC Wallet Services
    • 🗼Alby NWC Relay
Powered by GitBook
LogoLogo

Our content

  • Website
  • Blog
  • GitHub

Follow us

  • Nostr
  • Twitter / X
  • Youtube

Contact us

  • E-mail
  • Community Chat
  • Open Hours

Your bitcoin & nostr companion / from 🐝 with 🧡

On this page
  • Without Webhook
  • With Webhook

Was this helpful?

  1. Building Lightning Apps
  2. NWC HTTP API

Publish NWC Request

Publishes the NWC request event and returns the response

Without Webhook

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

Request Body

Name
Type
Description

relayUrl

string

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

walletPubkey*

string

Pubkey of the NWC Wallet Provider

event*

Signed request event

Event Example

{
  "id": "a16ycf4a01bcxx........xxxxx",
  "pubkey": "a16y69effexxxx........xxxxx",
  "created_at": 1700000021,
  "kind": 23194,
  "tags": [
    [
      "p",
      "a16y6sfa01bcxx........xxxxx"
    ]
  ],
  "content": "<encrypted content>",
  "sig": "<signature>"
}
// Source: https://pkg.go.dev/github.com/nbd-wtf/go-nostr@v0.30.0#Event

Response

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

With Webhook

POST https://api.getalby.com/nwc/nip47/webhook

Request Body

Name
Type
Description

relayUrl

string

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

webhookUrl*

string

Webhook URL to publish the response event, returns the event directly if not provided

walletPubkey*

string

Pubkey of the NWC Wallet Provider

event*

Signed request event

Response

{
  "state": "WEBHOOK_RECEIVED"
}

Response to webhook

{
  "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 1 year ago

Was this helpful?

JSON object (see )

JSON object (see )

⛓️
📢
example
example