Nostr Write icon

Nostr Write

Consume Nostr API

Actions4

  • Event(advanced) Actions
  • Raw Json Event(advanced) Actions
  • Encrypted Direct Message(nip-04) Actions
  • BasicNote Actions

Overview

This node allows sending events to the Nostr network, a decentralized protocol for creating and sharing notes and messages. It supports multiple event types including basic notes, advanced custom events, raw JSON events, and encrypted direct messages (NIP-04). The node constructs the event data, optionally signs it, and sends it to one or more specified relay servers.

Common scenarios where this node is useful include:

  • Publishing simple text notes or messages on the Nostr network.
  • Creating advanced events with custom kinds and tags for specialized applications.
  • Sending encrypted direct messages securely between users.
  • Broadcasting raw JSON events that may have been constructed externally.

Practical examples:

  • A user wants to post a public note with some content and tags.
  • An application needs to send an encrypted message to a specific recipient.
  • A developer wants to send a fully customized event with a specific kind and metadata.
  • Sending a pre-built raw JSON event directly to relays.

Properties

Name Meaning
Content The main textual content of the event or note.
Kind Numeric identifier representing the type of event according to Nostr event kinds (see https://github.com/nostr-protocol/nips#event-kinds).
Tags JSON array of tags associated with the event, used for metadata and indexing (see https://github.com/nostr-protocol/nips#standardized-tags).
ShowOtherOption (otherOption) Boolean flag indicating whether to manually specify additional event fields like event ID, public key, signature, and creation time. If false, these are calculated automatically.
EventId Hexadecimal string representing the event ID. Required if "ShowOtherOption" is true.
Pubkey Hexadecimal string of the public key associated with the event. Required if "ShowOtherOption" is true.
Sig Signature string of the event. Required if "ShowOtherOption" is true.
CreatedAt Unix timestamp (number) indicating when the event was created. Required if "ShowOtherOption" is true.
Custom Relay Comma-separated list of WebSocket relay URLs to which the event will be sent. Defaults to a predefined set of popular relays.

Output

The node outputs an array of objects, each containing:

  • event: The full event object that was sent, including all fields such as content, kind, tags, id, pubkey, sig, and created_at.
  • sendResults: An array of results from sending the event to each relay, indicating success or failure per relay connection.

If binary data were involved (not in this resource-operation), it would be summarized accordingly, but this node deals only with JSON event data.

Dependencies

  • Requires an API secret key credential to sign events before sending.
  • Uses the nostr-tools library for event encryption, signing, and finalization.
  • Uses WebSocket connections to communicate with Nostr relay servers.
  • Relays must support the Nostr protocol over WebSocket.
  • No other external services are required beyond the configured relays.

Troubleshooting

  • Invalid secret key error: If the provided secret key credential is missing or malformed, the node throws an error. Ensure a valid secret key is configured.
  • Invalid tags error: Tags must be a valid JSON array. Providing invalid JSON or non-array data causes an error. Validate tag input format.
  • JSON parse failed: When using the raw JSON event resource, the input must be valid JSON. Malformed JSON will cause parsing errors.
  • Relay connection issues: If relays are unreachable or reject the event, sending may fail silently or return error results. Verify relay URLs and network connectivity.
  • Signature or event ID mismatch: When manually specifying event ID, pubkey, signature, and created_at, ensure they correspond correctly; otherwise, the event may be rejected by relays.

Links and References

Discussion