projectdiscovery / notify

Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms.

Home Page:https://projectdiscovery.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notify providers configuration

ehsandeep opened this issue · comments

Similar to cloudlist, it would be better if we can separate providers config details from the default goflag based config for flags.

Providers are a list of services/platforms we support with notify to push notifications.

  • Slack
  • Discord
  • Telegram
  • Pushover
  • Email
  • Custom

This addition will also separate provider-related flags from default CLI as it is moved under the config file and will be directly configured under that file.

As default, providers.yaml will be used for providers configuration file and a custom config file can be used with -provider-config flag.

Example:- providers.yaml

profile: subfinder
provider: slack
slack_webhook_url: https://a.b.c/slack
slack_username: test
slack_channel: test
slack_threads: true

profile: subfinder
provider: discord
discord_webhook_url: https://discord.com/api/webhooks/XXXXX
discord_username: lol

profile: abc
provider: discord
discord_webhook_url: https://discord.com/api/webhooks/XXXXX
discord_username: aaa

profile: xyz
provider: telegram
telegram_apikey: XXXXX9218891:AAEQPydThIZXXXXX
telegram_chat_id: 36808XXXXX


profile: test
provider: custom
custom_webook_url: http://127.0.0.1:8000/api/v1/webhook
custom_method: POST
custom_headers: '{"X-Api-Key":"XXXXX", "Content-Type":"application/json"}' # Multi header input support
custom_body: '{{data}}'
commented

Updated example provider config:

slack:
  - profile: subfinder
    slack_webhook_url: https://a.b.c/slack
    slack_username: test
    slack_channel: test
    #if slack_thread_ts valid message time stamp, it will be sent as a reply in thread
    slack_thread_ts: 346XXXXXX.46
  - profile: test
    slack_webhook_url: https://a.b.c/slack
    slack_username: test
    slack_channel: random
discord:
  - profile: aXX
    discord_webhook_url: https://discord.com/api/webhooks/XXXXX
    discord_username: aXX
    discord_channel: teXX
telegram:
  - profile: xyz
    telegram_apikey: XXXXX9218891:AAEQPydThIZXXXXX
    telegram_chat_id: 36808XXXXX
custom:
  - profile: test
    custom_webook_url: http://127.0.0.1:8000/api/v1/webhook
    custom_method: POST
    custom_headers: '{"X-Api-Key":"XXXXX", "Content-Type":"application/json"}' # Multi header input support
    custom_body: '{{data}}'