BtrzWebhooksEmitter v0.2.0 BtrzWebhooksEmitter View Source

BtrzWebhooksEmitter emits webhooks to SQS for the Betterez platform.

This module has the API to send messages asynchrounously to the BtrzWebhooksEmitter.SQS.

You will have to set these ENV vars:

  • AWS_SERVICE_KEY
  • AWS_SERVICE_SECRET
  • SQS_QUEUE_URL

You can set SQS_QUEUE_URL in your config:

config :btrz_ex_webhooks_emitter, queue_url: "id/name"

If one of them is missing the messages will be ignored.

How to use

You have to send a map with the following required (string) keys:

  • “provider_id”
  • “api_key”
  • “data”

Optional keys:

  • “url”
message = %{
  "provider_id" => "123",
  "api_key" => "PROVIDER_PUBLIC_KEY",
  "data" => %{"foo" => "bar"}
}
BtrzWebhooksEmitter.emit("transaction.created", message)

Link to this section Summary

Functions

Returns the message json encoded

Builds and sends messages asynchrounously to the BtrzWebhooksEmitter.SQS

Link to this section Functions

Link to this function build_message(event_name, attrs) View Source
build_message(binary(), map()) :: binary()

Returns the message json encoded.

Link to this function emit(event_name, attrs) View Source
emit(binary(), map()) :: :ok

Builds and sends messages asynchrounously to the BtrzWebhooksEmitter.SQS