8000 GitHub - formancehq/webhooks at v0.3.2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

formancehq/webhooks

Repository files navigation

Webhooks

Webhooks is a service used to manage user configs and send webhooks to endpoints. A user config is made of the following information:

  • Endpoint: a single URL where messages are sent to.
  • EventTypes: an array of string identifiers denoting the type of message being sent and are the primary way for webhook consumers to configure what events they are interested in receiving. Are stored in lower-case format.
  • Secret: a string used to verify received webhooks. Every webhook and its metadata is signed with a unique key for each endpoint. This signature can then be used to verify the webhook indeed comes from this service. The format is a random string of bytes of size 24, base64 encoded. (larger size after encoding)

The service has 3 starting modes, split into 3 separate commands:

  • server: REST web service API managing webhooks configs for users.
  • worker messages: background service consuming kafka events on selected topics and sending webhooks based on user configs.
  • worker retries: background service periodically finding failed webhooks requests to retry and sending new attempts.

Run the stack locally

docker compose up

Run linters and tests locally

task install:lint
task

Run the tests for a specific package:

task tests:local PKG=./pkg/model

Run a specific test (regexp):

task tests:local RUN=TestServer

Build locally

task build:local

Usage

$> ./webhooks
Usage:
  webhooks [command]

Available Commands:
  help                 Help about any command
  version              Get webhooks version
  server               Start webhooks server
  worker messages      Start webhooks worker messages
  worker retries       Start webhooks worker retries

Flags:
  -h, --help                                          help for webhooks
      --http-bind-address-server string               server HTTP bind address (default ":8080")
      --http-bind-address-worker-messages string      worker messsages HTTP bind address (default ":8081")
      --http-bind-address-worker-retries string       worker retries HTTP bind address (default ":8082")
      --retry-schedule durations                      worker retries schedule (default [1m,5m,30m,5h,24h])
      --retry-cron duration                           worker retries cron (default 1m)
      --kafka-brokers strings                         Kafka brokers (default [localhost:9092])
      --kafka-consumer-group string                   Kafka consumer group (default "webhooks")
      --kafka-password string                         Kafka password
      --kafka-sasl-enabled                            Kafka SASL enabled
      --kafka-sasl-mechanism string                   Kafka SASL mechanism
      --kafka-tls-enabled                             Kafka TLS enabled
      --kafka-topics strings                          Kafka topics (default [default])
      --kafka-username string                         Kafka username
      --log-level string                              Log level (default "info")
      --storage-mongo-conn-string string              Mongo connection string (default "mongodb://admin:admin@localhost:27017/")
      --storage-mongo-database-name string            Mongo database name (default "webhooks")

Use "webhooks [command] --help" for more information about a command.

About

webhooks repository

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages

0