{"id":49764958,"url":"https://github.com/knocklabs/knock-dotnet","last_synced_at":"2026-05-11T10:26:00.371Z","repository":{"id":40404196,"uuid":"431143219","full_name":"knocklabs/knock-dotnet","owner":"knocklabs","description":"Official .NET SDK for interacting with the Knock API","archived":false,"fork":false,"pushed_at":"2025-06-11T16:47:23.000Z","size":99,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-20T22:44:35.040Z","etag":null,"topics":["csharp","dotnet","knock","notifications"],"latest_commit_sha":null,"homepage":"https://github.com/knocklabs/knock-dotnet/","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/knocklabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-23T15:00:12.000Z","updated_at":"2025-07-04T03:58:20.000Z","dependencies_parsed_at":"2024-06-25T19:12:31.166Z","dependency_job_id":"15707c80-5941-406d-a0b1-5391b24708da","html_url":"https://github.com/knocklabs/knock-dotnet","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/knocklabs/knock-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knocklabs","download_url":"https://codeload.github.com/knocklabs/knock-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32890458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dotnet","knock","notifications"],"created_at":"2026-05-11T10:25:59.322Z","updated_at":"2026-05-11T10:26:00.319Z","avatar_url":"https://github.com/knocklabs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knock .NET Library\n\nKnock API access for applications using .NET. Supports .NET Standard 2.0+ and .NET Framework 4.6.1+.\n\n## Documentation\n\nSee the [API documentation](https://docs.knock.app) for usage examples.\n\n## Installation\n\nThere are several options to install the Knock .NET SDK.\n\n### Via the NuGet Package Manager\n\n```\nnuget install Knock.net\n```\n\n### Via the .NET Core Command Line Tools\n\n```\ndotnet add package Knock.net\n```\n\n### Via Visual Studio IDE\n\n```\nInstall-Package Knock.net\n```\n\n## Configuration\n\nTo use the Knock client, you must provide an API key from the Knock dashboard.\n\n```c#\nusing Knock;\n\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n```\n\n## Usage\n\n### Identifying users\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\nvar identifyUserParams = new Dictionary\u003cstring, object\u003e{\n  { \"name\", \"John Hammond\" },\n  { \"email\", \"jhammond@ingen.net\" }\n};\n\nvar user = await knockClient.Users.Identify(\"jhammond\", identifyUserParams)\n```\n\n### Retrieving users\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\nvar user = await knockClient.Users.Get(\"jhammond\")\n```\n\n### Triggering workflows\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\nvar workflowTrigger = new TriggerWorkflow {\n  // list of user ids for who should receive the notif\n  Recipients = [\"jhammond\", \"agrant\", \"imalcolm\", \"esattler\"],\n  // user id of who performed the action\n  Actor: \"dnedry\",\n  // an optional cancellation key\n  CancellationKey: alert.Id,\n  // an optional tenant\n  Tenant: \"jurassic-park\",\n  // data payload to send through\n  Data: new Dictionary\u003cstring, object\u003e{\n    {\"type\", \"trex\"},\n    {\"priority\", \"1\"}\n  },\n};\n\nvar result = await knockClient.Workflows.Trigger(\"dinosaurs-loose\", workflowTrigger)\n```\n\n### Preferences\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\n// Set preference set for user\nvar preferenceSetUpdate = new SetPreferenceSet {\n  ChannelTypes = new Dictionary\u003cstring, boolean\u003e {\n    {\"email\", false}\n  }\n};\n\nvar result = await knockClient.Users.SetPreferences(\"jhammond\", preferenceSetUpdate);\n\n// Set granular channel type preferences\nvar result = await knockClient.Users.SetChannelTypePreferences(\"jhammond\", \"email\", true);\n\n// Set granular workflow preferences\nvar result = await knockClient.Users.SetWorkflowPreferences(\"jhammond\", \"dinosaurs-loose\", false);\n\n// Retrieve preferences\nvar preferenceSet = await knockClient.Users.GetPreferences(\"jhammond\");\n```\n\n### Getting and setting channel data\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\n// Set channel data for an APNS channel\nvar channelData = new Dictionary\u003cstring, List\u003cstring\u003e\u003e{\n  {\"tokens\", [apnsToken]},\n};\n\nvar result = await knockClient.Users.SetChannelData(\"jhammond\", knockApnsChannelId, channelData);\n\n// Get channel data for the APNS channel\nvar result = await knockClient.Users.GetChannelData(\"jhammond\", knockApnsChannelId);\n```\n\n### Canceling notifies\n\n```c#\nvar knockClient = new KnockClient(\n  new KnockOptions { ApiKey = \"sk_12345\" });\n\nvar cancelParams = new CancelWorkflow {\n  // Optional list of recipients to cancel the workflow run for\n  Recipients = [\"dnedry\"],\n  // The cancellation key that corresponds with the original workflow run\n  CancellationKey = alert.id,\n};\n\nvar result = await knockClient.Workflows.cancel(\"dinosaurs-loose\", cancelParams);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknocklabs%2Fknock-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknocklabs%2Fknock-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknocklabs%2Fknock-dotnet/lists"}