View Source ExNylas.WebhookNotifications (ExNylas v0.9.0)

Utility functions for webhook notifications.

Nylas docs

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

Link to this function

to_struct(raw_notification)

View Source
@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)
Link to this function

to_struct!(raw_notification)

View Source
@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)

Link to this function

validate_signature(webhook_secret, body, signature)

View Source
@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)
Link to this function

validate_signature!(webhook_secret, body, signature)

View Source
@spec validate_signature!(String.t(), String.t(), String.t()) :: boolean()

Validate the X-Nylas-Signature header from a webhook.

Examples

iex> valid = ExNylas.WebhoookNotification.validate_signature!(webhook_secret, body, signature_from_webhook_request)