Wardrik.Notify.Webhook (wardrik v0.1.0-rc.1)

Copy Markdown

Posts notices as JSON to a URL.

audit: {Wardrik.Notify.Webhook, url: "https://hooks.example.com/wardrik", secret: secret}

The body is Wardrik.Notice.json/1. The x-wardrik-event header names the event. Any status other than 2xx is a failure.

Options

  • :url - required. Where to post.
  • :secret - signs the body. The x-wardrik-signature header is then sha256= followed by the hex HMAC-SHA256 of the body. See sign/2.
  • :req_options - merged into the Req request.

Summary

Functions

Returns the x-wardrik-signature value for body signed with secret.

Functions

sign(secret, body)

@spec sign(String.t(), iodata()) :: String.t()

Returns the x-wardrik-signature value for body signed with secret.

Wardrik.Notify.Webhook.sign(secret, body)
#=> "sha256=9f86d0..."