View Source ExNylas.WebhookNotifications (ExNylas v0.9.0)
Utility functions for webhook notifications.
Summary
Functions
Transform a raw webhook notification into an ExNylas struct.
Transform a raw webhook notification into an ExNylas struct.
Validate the X-Nylas-Signature header from a webhook.
Validate the X-Nylas-Signature header from a webhook.
Functions
@spec to_struct(map()) :: {:ok, ExNylas.WebhookNotification.t()} | {:error, Ecto.Changeset.t()}
Transform a raw webhook notification into an ExNylas struct.
Examples
iex> {:ok, struct} = ExNylas.WebhookNotifications.to_struct(raw_payload)
@spec to_struct!(map()) :: ExNylas.WebhookNotification.t()
Transform a raw webhook notification into an ExNylas struct.
Examples
iex> struct = ExNylas.WebhookNotifications.to_struct!(raw_payload)
@spec validate_signature(String.t(), String.t(), String.t()) :: {:ok, boolean()} | {:error, String.t()}
Validate the X-Nylas-Signature header from a webhook.
Examples
iex> {:ok, match?} = ExNylas.WebhoookNotification.validate_signature(webhook_secret, body, signature_from_webhook_request)
Validate the X-Nylas-Signature header from a webhook.
Examples
iex> valid = ExNylas.WebhoookNotification.validate_signature!(webhook_secret, body, signature_from_webhook_request)