{"id":19385407,"url":"https://github.com/micdah/slackwebhook","last_synced_at":"2025-04-23T22:32:00.969Z","repository":{"id":96573068,"uuid":"107972476","full_name":"micdah/SlackWebhook","owner":"micdah","description":"Client used to build and send Slack messages to a channel, using a slack incoming webhook which can easily configured","archived":false,"fork":false,"pushed_at":"2019-02-11T16:26:19.000Z","size":149,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T20:44:44.391Z","etag":null,"topics":["csharp","incoming-webhooks","net-standard","slack"],"latest_commit_sha":null,"homepage":"https://slackwebhook.micdah.dk/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micdah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-23T11:25:12.000Z","updated_at":"2022-09-06T09:55:35.000Z","dependencies_parsed_at":"2023-04-22T21:37:21.288Z","dependency_job_id":null,"html_url":"https://github.com/micdah/SlackWebhook","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micdah%2FSlackWebhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micdah%2FSlackWebhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micdah%2FSlackWebhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micdah%2FSlackWebhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micdah","download_url":"https://codeload.github.com/micdah/SlackWebhook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250527091,"owners_count":21445301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","incoming-webhooks","net-standard","slack"],"created_at":"2024-11-10T09:36:06.599Z","updated_at":"2025-04-23T22:32:00.957Z","avatar_url":"https://github.com/micdah.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SlackWebhook\n[![Build status](https://ci.appveyor.com/api/projects/status/xg5n46bdf223dj2b/branch/master?svg=true)](https://ci.appveyor.com/project/MichaelDahl/slackwebhook/branch/master)\n[![NuGet](https://img.shields.io/nuget/v/SlackWebhook.svg)](https://www.nuget.org/packages/SlackWebhook/)\n\nProvides a simple .Net client for using Slack's [Incoming Webhooks](https://api.slack.com/incoming-webhooks) URL's to \nsend messages to a slack channel of your choosing.\n\nThe Webhooks API is pretty simple, but it always preferable to have a typed interface to use rather than an untyped \n(_and undocumented_) JSON object. So using this library should make it simpler to build a slack message and send it \nusing a webhook URL.\n\nSee [changelog](CHANGELOG.md) for version history.\n\n## Example\n\n![Foo](https://raw.githubusercontent.com/micdah/SlackWebhook/master/demo.png)\n\n## How to use\n\nFirst **install** the nuget package:\n```bash\nPM\u003e Install-Package SlackWebhook\n```\n\nNext simply use the `SlackClient` class to send a message:\n```csharp\nawait new SlackClient(webhookUrl).SendAsync(b =\u003e b\n    .WithUsername(\"Slack Bot Name\")\n    .WithIcon(IconType.Url, \"http://my.host/bot_icon.png\")\n    .WithText(\"Something very interesting just happened\")\n);\n```\n\n### How to obtain Incoming Webhook URL\n\nIn the above example i used the `webhookUrl` which you obtain by adding the **Incoming WebHooks** app configuration\nto the channel you want to send messages to (_each url is tied to a specific channel, so if you want to sent to\ndifferent channels, just add multiple configurations_).\n\n1. Open [slack.com/services/new/incoming-webhook](https://slack.com/services/new/incoming-webhook)\n2. Under _Post to Channel_ select the channel you want to send to\n3. Press _Add Incoming WebHooks integration_\n4. Now copy the _Webhook URL_\n\n\n## What is supported?\n\nBesides the message, the Slack hook also allows attachments which are pretty neat. \nIn the above example I used a few attachments and fields to illustrate some of the uses. Especially the attachment\nfields are a good way to include extra detail in a table-like structure (_by setting `short` flag on field, two fields\nwill be shown in the attachment side-by-side for each row_).\n\nMy example was generated by this code:\n```csharp\nawait new SlackClient(webhookUrl).SendAsync(b =\u003e b\n    .WithText(\"Hello from *SlackWebhook*\")\n    .WithUsername(\"SlackWebhook\")\n    .WithIcon(IconType.Url, \"https://raw.githubusercontent.com/micdah/SlackWebhook/master/icon.png\")\n    .WithAttachment(a =\u003e a\n        .WithTitle(\"How to install\")\n        .WithText(\"`PM\u003e Install-Package SlackWebhook`\")\n        .WithColor(Color.DarkSlateBlue))\n    .WithAttachment(a =\u003e a\n        .WithTitle(\"Find out more\")\n        .WithText(\"Find out more by taking a look at github.com/micdah/SlackWebhook\")\n        .WithLink(\"https://github.com/micdah/SlackWebhook\")\n        .WithField(\n            \"Use builder pattern\",\n            \"```\\n\" +\n            \"await slackClient.SendASync(b =\u003e b\\n\" +\n            \"   .WithUsername(\\\"My Bot\\\")\\n\" +\n            \"   .WithText(\\\"Hello *World*\\\"));\\n\" +\n            \"```\")\n        .WithField(\n            \"Use object initializer\",\n            \"```\\n\" +\n            \"await slackClient.SendAsync(new SlackMessage {\\n\" +\n            \"   Username = \\\"My Bot\\\",\\n\" +\n            \"   Text = \\\"Hello *World*\\\"\\n\" +\n            \"});\\n\" +\n            \"```\")));\n```\n\n\n## Documentation\n\nYou can find the documentation in [SlackWebhook](SlackWebhook.md), of particular \ninterest are these:\n\n- [`ISlackClient`](SlackWebhook.md#T-SlackWebhook-ISlackClient): \n  Interface of the `SlackClient` implementation used to send message\n- [`ISlackMessageBuilder`](SlackWebhook.md#T-SlackWebhook-ISlackMessageBuilder):\n  Inteface of the message builder used to configure your message\n- [`ISlackAttachmentBuilder`](SlackWebhook.md#T-SlackWebhook-ISlackAttachmentBuilder):\n  Interface of the attachment builder used to configure attachments added to your message","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicdah%2Fslackwebhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicdah%2Fslackwebhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicdah%2Fslackwebhook/lists"}