Skip to content

Optional webhook + email notifier for received payments #8

Description

@Ryjen1

Problem

Today, the only way to know a payment landed is to refresh the link page. For invoicing and storefront use cases the recipient needs a passive notification — email, Slack, Discord, or a generic webhook to their own backend.

Proposal

Add an optional webhook_url and notify_email to the link schema. A small Stellar transaction watcher polls Horizon for the recipient's payments, matches them against open links, and fires a webhook + email when a match is found.

Acceptance criteria

  • Schema additions in scripts/pocketbase-schema.json and frontend/src/lib/types.ts:
    • webhook_url: text (optional, validated as https URL)
    • notify_email: email (optional)
    • notified_at: text (set when notification fires; prevents duplicate sends)
  • CreateLink exposes the two optional fields behind an "Advanced" toggle.
  • Implement a small Node service in services/notifier/ (the first thing in this folder — be honest in the README that adding the service is opt-in):
    • Polls Horizon /accounts/{creator}/payments?cursor=now for each link with an unmet notify condition.
    • On match, POSTs { link_id, payer, amount, asset, tx_hash } to webhook_url (signed with HMAC-SHA256 if a WEBHOOK_SIGNING_SECRET env is set).
    • Sends a plaintext email to notify_email via SMTP (configurable).
    • Stamps notified_at so it doesn't double-fire.
  • Document the service in services/notifier/README.md including a one-liner Docker invocation.
  • Smoke test against testnet: create a link with both fields set, pay it, verify webhook fires and email lands.

Files involved

  • frontend/src/components/CreateLink.tsx
  • frontend/src/lib/types.ts
  • scripts/pocketbase-schema.json
  • services/notifier/ — new (Node + TypeScript, single file is fine)
  • docker-compose.yml — add the optional notifier service

Notes

Keep the notifier completely optional. The frontend MUST stay functional with no notifier deployed — we don't want this to become required infrastructure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew user-facing capabilityhelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions