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.
https://projectdiscovery.io
MIT License
1.27k stars 129 forks source link

Notify providers configuration #57

Closed ehsandeep closed 3 years ago

ehsandeep commented 3 years ago

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.

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.

ehsandeep commented 3 years ago

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}}'
parrasajad commented 3 years ago

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}}'
kyawphyolinn commented 2 months ago

for cliq