Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: webhook example #34

Merged
merged 3 commits into from
Jun 26, 2023
Merged

feat: webhook example #34

merged 3 commits into from
Jun 26, 2023

Conversation

heilhead
Copy link
Collaborator

Description

This adds a webhook example and some minor fixes to RPC types surrounding watch registration and webhook dispatch.

Note: To run the example make sure the relay is running locally to be able to dispatch webhooks to the local server.

[publisher] client id: did:key:z6MkrNnCuEkjEE2wbF4NUQwX6RoBWYRn2HC3rFdAMM2CKZvV
[subscriber] client id: did:key:z6Mkge373J7U6BfvLsCBzDA1Hf7W3wEtUJSApbfmGDGw1gXM
[subscriber] watch registered: relay_id=did:key:z6MksL1xGunmRDzskniANbwMzPMUWUdyuUVfrd4WhvgHKK1Q
[publisher] watch registered: relay_id=did:key:z6MksL1xGunmRDzskniANbwMzPMUWUdyuUVfrd4WhvgHKK1Q
[publisher] message published: topic=37931305f08feb99a361828a30529aa00921d657d7d2df636b0a9cec3d79d71c message=Hello WalletConnect!
[subscriber] received message: Hello WalletConnect!
[webhook] publisher: url=http://127.0.0.1:10100/publisher_webhook data={
  "iss": "did:key:z6MksL1xGunmRDzskniANbwMzPMUWUdyuUVfrd4WhvgHKK1Q",
  "aud": "http://127.0.0.1:10100",
  "sub": "did:key:z6MkrNnCuEkjEE2wbF4NUQwX6RoBWYRn2HC3rFdAMM2CKZvV",
  "iat": 1687598503,
  "act": "irn_watchEvent",
  "typ": "publisher",
  "whu": "http://127.0.0.1:10100/publisher_webhook",
  "evt": {
    "status": "accepted",
    "topic": "37931305f08feb99a361828a30529aa00921d657d7d2df636b0a9cec3d79d71c",
    "message": "Hello WalletConnect!",
    "publishedAt": 1687598503347,
    "tag": 1100
  }
}
[webhook] subscriber: url=http://127.0.0.1:10100/subscriber_webhook data={
  "iss": "did:key:z6MksL1xGunmRDzskniANbwMzPMUWUdyuUVfrd4WhvgHKK1Q",
  "aud": "http://127.0.0.1:10100",
  "sub": "did:key:z6Mkge373J7U6BfvLsCBzDA1Hf7W3wEtUJSApbfmGDGw1gXM",
  "iat": 1687598503,
  "act": "irn_watchEvent",
  "typ": "subscriber",
  "whu": "http://127.0.0.1:10100/subscriber_webhook",
  "evt": {
    "status": "queued",
    "topic": "37931305f08feb99a361828a30529aa00921d657d7d2df636b0a9cec3d79d71c",
    "message": "Hello WalletConnect!",
    "publishedAt": 1687598503347,
    "tag": 1100
  }
}

How Has This Been Tested?

Manually.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@heilhead heilhead merged commit 77f5fef into main Jun 26, 2023
@heilhead heilhead deleted the feat/webhook-example branch June 26, 2023 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants