snowflakedb / SnowAlert

Security Analytics Using The Snowflake Data Warehouse
Apache License 2.0
184 stars 57 forks source link

Adding handler for MS Teams #471

Closed zoltan-fedor closed 3 years ago

zoltan-fedor commented 3 years ago

This allows us to send alerts to MS Teams channels via webhooks.

If you don't know how to get the webhook for an MS Teams channel: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook

A typical handler using this new 'msteams' handler would look like the following:

      ARRAY_CONSTRUCT(
        OBJECT_CONSTRUCT(
           'type', 'msteams',
           'webhook', 'https://outlook.office.com/webhook/xxxxxx/IncomingWebhook/xxxxx/xxxxx',
           'title', 'Resource created in Snowflake.',
           'color', '#FF0000',
           'message', 'This is a test alert; the actor is ' || actor || ' and the action is ' || action || '.'
        )
      )
sfc-gh-pkommini commented 3 years ago

Hi @zoltan-fedor, Thank you for your contribution!

Changes look good to me. Could you provide a note on the tests that you have done? Asking as we don't have a way to test these changes.

zoltan-fedor commented 3 years ago

Hi @sfc-gh-pkommini, Yes, I was looking at what unit tests the other handlers have and saw that they had mostly nothing, so I didn't write a unit test for it.

But we are using this in production - we have active MS Teams handlers using this same code and sending alerts to the MS Teams channels.

sfc-gh-afedorov commented 3 years ago

thank you!