README
Last updated
Last updated
Provides a simple .Net client for using Slack's Incoming Webhooks URL's to send messages to a slack channel of your choosing.
The Webhooks API is pretty simple, but it always preferable to have a typed interface to use rather than an untyped (and undocumented) JSON object. So using this library should make it simpler to build a slack message and send it using a webhook URL.
See changelog for version history.
First install the nuget package:
Next simply use the SlackClient
class to send a message:
In the above example i used the webhookUrl
which you obtain by adding the Incoming WebHooks app configuration to the channel you want to send messages to (each url is tied to a specific channel, so if you want to sent to different channels, just add multiple configurations).
Under Post to Channel select the channel you want to send to
Press Add Incoming WebHooks integration
Now copy the Webhook URL
Besides the message, the Slack hook also allows attachments which are pretty neat. In the above example I used a few attachments and fields to illustrate some of the uses. Especially the attachment fields are a good way to include extra detail in a table-like structure (by setting short
flag on field, two fields will be shown in the attachment side-by-side for each row).
My example was generated by this code:
You can find the documentation in SlackWebhook, of particular interest are these:
Interface of the SlackClient
implementation used to send message
Inteface of the message builder used to configure your message
Interface of the attachment builder used to configure attachments added to your message