đŸ“ĸPublish NWC Request

Publishes the NWC request event and returns the response

Without Webhook

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

Request Body

NameTypeDescription

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*

JSON object (see example)

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

NameTypeDescription

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*

JSON object (see example)

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

Logo

Your bitcoin & nostr companion / from 🐝 with 🧡