{"id":21406641,"url":"https://github.com/ringcentral/ringcentral-csharp-client","last_synced_at":"2025-10-17T06:09:52.714Z","repository":{"id":60774019,"uuid":"65003447","full_name":"ringcentral/ringcentral-csharp-client","owner":"ringcentral","description":"RingCentral C# Client","archived":false,"fork":false,"pushed_at":"2021-01-23T21:05:32.000Z","size":691,"stargazers_count":19,"open_issues_count":2,"forks_count":18,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-08-05T13:53:32.278Z","etag":null,"topics":["ringcentral"],"latest_commit_sha":null,"homepage":"https://developer.ringcentral.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ringcentral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-05T08:43:26.000Z","updated_at":"2024-06-12T02:33:50.000Z","dependencies_parsed_at":"2022-10-04T15:31:25.909Z","dependency_job_id":null,"html_url":"https://github.com/ringcentral/ringcentral-csharp-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ringcentral/ringcentral-csharp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-csharp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-csharp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-csharp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-csharp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ringcentral","download_url":"https://codeload.github.com/ringcentral/ringcentral-csharp-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-csharp-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271740725,"owners_count":24812642,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"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":["ringcentral"],"created_at":"2024-11-22T16:41:10.710Z","updated_at":"2025-10-17T06:09:47.661Z","avatar_url":"https://github.com/ringcentral.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ringcentral-csharp-client\n\n[![Build status](https://travis-ci.org/ringcentral/ringcentral-csharp-client.svg?branch=master)](https://travis-ci.org/ringcentral/ringcentral-csharp-client)\n[![Coverage Status](https://coveralls.io/repos/github/ringcentral/ringcentral-csharp-client/badge.svg?branch=master\u0026t=20160812)](https://coveralls.io/github/ringcentral/ringcentral-csharp-client?branch=master)\n[![NuGet Version](https://img.shields.io/nuget/v/RingCentral.Client.svg)](https://www.nuget.org/packages/RingCentral.Client/)\n[![Chat](https://img.shields.io/badge/chat-on%20glip-orange.svg)](https://glipped.herokuapp.com/)\n[![Twitter](https://img.shields.io/twitter/follow/ringcentraldevs.svg?style=social\u0026label=follow)](https://twitter.com/RingCentralDevs)\n\n\n---\n\n# RingCentral.Net\n\n[RingCentral.Net](https://github.com/ringcentral/ringcentral.net) is the successor of this project.\nAll users are recommended to use [RingCentral.Net](https://github.com/ringcentral/ringcentral.net) instead.\n\n## Reference\n\n- [RingCentral.Net on NuGet](https://www.nuget.org/packages/RingCentral.Net/)\n- Article: [Announcing the New RingCentral SDK for .NET](https://medium.com/ringcentral-developers/new-ringcentral-sdk-for-net-a43417b2538c)\n- Article: [RingCentral SDK for .NET Upgrade Guide](https://medium.com/ringcentral-developers/ringcentral-sdk-for-net-upgrade-guide-8ead6bcdaf99)\n\n---\n\n\n__[RingCentral Developers](https://developer.ringcentral.com/api-products)__ is a cloud communications platform which can be accessed via more than 70 APIs. The platform's main capabilities include technologies that enable:\n__[Voice](https://developer.ringcentral.com/api-products/voice), [SMS/MMS](https://developer.ringcentral.com/api-products/sms), [Fax](https://developer.ringcentral.com/api-products/fax), [Glip Team Messaging](https://developer.ringcentral.com/api-products/team-messaging), [Data and Configurations](https://developer.ringcentral.com/api-products/configuration)__.\n\n[API Reference](https://developer.ringcentral.com/api-docs/latest/index.html) and [APIs Explorer](https://developer.ringcentral.com/api-explorer/latest/index.html).\n\nRingCentral C# client.\n\n**Notice:** any issues or questions, please do let me know by [creating an issue](https://github.com/ringcentral/ringcentral-csharp-client/issues/new).\n\nFeel free to :star: and :fork_and_knife: this repository.\n\n\n## Video tutorial\n\n[Setup project, authorization and sending fax](https://www.youtube.com/watch?v=lECKMrX_Dgw)\n\nDeprecated: [Work with .NET 4.5 \u0026 WebForm](https://www.youtube.com/watch?v=0RjYTCDpn3A) You should not use legacy .NET versions. But if you have to, please watch the video.\n\n\n## Installation\n\n```powershell\nInstall-Package RingCentral.Client\n```\n\n\n## API Reference\n\n[RingCentral API Reference](https://developer.ringcentral.com/api-docs/latest/index.html#!#APIReference.html) is where you can find all the endpoints, requests, parameters and all kinds of necessary details.\n\nPlease note: as a guest reader, you can only read the basic version of API Reference. Please do login if you want to get information about Advanced API endpoints.\n\n\n## Initialization\n\n```cs\nusing RingCentral;\n\nrc = new RestClient(\"clientId\", \"clientSecret\");\n```\n\nBy default the clients talk to sandbox server. If you want production server:\n\n```cs\nrc = new RestClient(\"clientId\", \"clientSecret\", true);\n```\n\nOr you can specify the server url explicitly:\n\n```cs\nrc = new RestClient(\"clientId\", \"clientSecret\", \"https://platform.devtest.ringcentral.com\");\n```\n\n\n## Authorization\n\n```cs\nawait rc.Authorize(\"username\", \"extension\", \"password\");\n```\n\nIf you use direct number as username, leave extension empty.\n\n\n### Auto refresh\n\nBy default, there is a background timer calling `rc.Refresh()` periodically, so the authorization never expires.\n\nBut if you would like to call `Refresh` manually:\n\n```cs\nrc.AutoRefreshToken = false;\n```\n\n\n### Token Revoke\n\nWhen you no longer need a token, don't forget to revoke it: `rc.Revoke()`.\n\n\n## Map URI to code\n\nThis client library is built around URIs.\nPlease read this part carefully and make sure you get it before continuing.\n\nLet's go to the [RingCentral API Reference](https://developer.ringcentral.com/api-docs/latest/index.html#!#APIReference.html) to find\n[an example](https://developer.ringcentral.com/api-docs/latest/index.html#!#RefExtensionCallLogRecord.html).\n\nWe can see that the URI pattern is:\n\n```\n/restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log/{callRecordId}\n```\n\nAn real example of the URI could be:\n\n```none\n/restapi/v1.0/account/~/extension/130829004/call-log/ASsQ3xLOZfrLBwM\n```\n\nLet's map the URI above to code:\n\n```cs\nrc.Restapi(\"v1.0\").Account(\"~\").Extension(\"130829004\").CallLog(\"ASsQ3xLOZfrLBwM\");\n```\n\nIt's just a one-to-one mapping:\n\n![mapping](mapping.png)\n\n\n##### Default ID\n\nThe default ID for `Restapi` is `v1.0`, the default ID for `Account` and `Extension` is `~`.\n\nWe can omit arguments to use default value:\n\n```cs\nrc.Restapi().Account().Extension(\"130829004\").CallLog(\"ASsQ3xLOZfrLBwM\");\n```\n\nYou can also break it into multiple lines if you don't like long-chained method calls:\n\n```cs\nvar account = rc.Restapi().Account();\nvar extension = account.Extension(\"130829004\");\nvar callLog = extension.CallLog(\"ASsQ3xLOZfrLBwM\");\n```\n\n\n## Anonymous types vs Pre-defined types\n\nFor example, the following line is for sending fax:\n\n```cs\nvar response = await extension.Fax().Post(requestBody, attachments);\n```\n\nTo create the `requestBody` object, you can define it as following:\n\n```cs\nvar requestBody = new FaxPath.PostParameters\n{\n    to = new CallerInfo[] { new CallerInfo { phoneNumber = \"123456789\" } }\n}\n```\n\nOr, you can define it using anonymous types:\n\n```cs\nvar requestBody = new\n{\n    to = new object[] { new { phoneNumber = \"123456789\" } }\n}\n```\n\nBoth are OK. The anonymous types approach is shorter while you can take advantages of IDE intellisense with pre-defined types approach.\nYou can choose based on your preferences.\n\n\n## Talk to API Server\n\n```cs\nvar extension = rc.Restapi().Account().Extension();\n```\n\n\n### GET\n\n##### List all of the inbound call Logs\n\n```cs\nvar callLogs = await extension.CallLog().List(new { direction = \"Inbound\" });\n```\n\nOr if you prefer the query parameters as a typed model:\n\n```cs\nvar callLogs = await extension.CallLog().List(new CallLog.ListParameters { direction = \"Inbound\" });\n```\n\nAll the HTTP calls are by default async, so you should use the `await` keyword of C#.\n\n\n##### Get a call log by ID\n\n```cs\nvar callLog = await extension.CallLog(\"ASsQ3xLOZfrLBwM\").Get();\n```\n\nYou can inspect the attributes of the returned `callLog` object because it is a model instead of a string:\n\n```cs\nConsole.WriteLine(callLog.id);\nConsole.WriteLine(callLog.direction);\nConsole.WriteLine(callLog.startTime);\n```\n\n\n### POST\n\n##### Send an SMS\n\n```cs\nvar requestBody = new {\n    text = \"hello world\",\n    from = new { phoneNumber = phoneNumber },\n    to = new object[] { new { phoneNumber = phoneNumber } }\n};\nvar response = await extension.Sms().Post(requestBody);\n```\n\n\n### PUT\n\n##### Update message status\n\n```cs\nvar requestBody = new { readStatus = \"Read\" };\nvar response = await extension.MessageStore(messageId).Put(requestBody);\n```\n\n\n### DELETE\n\n##### Delete message by ID\n\n```cs\nvar response = await extension.MessageStore(messageId).Delete();\n```\n\n\n## What if I want plain HTTP without those fancy models?\n\n```cs\nvar endpoint = rc.Restapi().Dictionary().Timezone(\"6\").Endpoint(); // \"/restapi/v1.0/dictionary/timezone/6\"\nvar response = await rc.Get(endpoint); // make http request\nvar statusCode = response.StatusCode; // check status code\nvar str = await response.Content.ReadAsStringAsync(); // get response string\n```\n\n\n## Subscription\n\n[Sample code](./RingCentral.Test/SubscripotionTest.cs)\n\nThe subscription will renew itself automatically before it expires. In rare cases you might need to renew it manually:\n\n```cs\nawait subscription.Renew();\n```\n\n\n## Send Fax\n\n[Sample code](./RingCentral.Test/FaxTest.cs)\n\n\n## Send MMS\n\nMMS and SMS share the same API endpoint. You can deem MMS as SMS with attachments\n\n[Sample code](./RingCentral.Test/MMSTest.cs)\n\n\n## Binary data\n\n#### Create/Update profile image\n\n#### Get message content\n\n#### Download call recording\n\n[Sample code](./RingCentral.Test/BinaryTest.cs)\n\n\n## Exception handling\n\n```cs\ntry\n{\n    await ...\n}\ncatch (FlurlHttpException fhe)\n{\n    string errorMessage = fhe.GetResponseString();\n    Console.WriteLine(errorMessage);\n    if (fhe.Call.Response.StatusCode == System.Net.HttpStatusCode.NotFound)\n    {\n        Console.WriteLine(\"The resource doesn't exist\");\n    }\n}\n```\n\n\n## Events\n\n- `RestClient` class has EventHandler `TokenRefreshed`, so that every time token refreshed you can get a notification\n    - [Sample code](https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/EventsTest.cs)\n- `RestClient` class has EventHandler `AfterHttpCall`, so that after every HTTP call you can a notification\n    - [Sample code](https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/AfterCallTest.cs)\n\n\n## Sample code\n\nThe [unit test project](https://github.com/ringcentral/ringcentral-csharp-client/tree/master/RingCentral.Test) contains lots of useful code snippets.\nSuch as this [test class](https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/ContactTest.cs).\n\n\n## License\n\nMIT\n\n\n## Common issues\n\n### You must add a reference to assembly netstandard\n\nRef: https://github.com/dotnet/standard/issues/542\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-csharp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fringcentral%2Fringcentral-csharp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-csharp-client/lists"}