{"id":28507666,"url":"https://github.com/mediaburst/clockwork-dotnet","last_synced_at":"2025-07-24T00:36:44.636Z","repository":{"id":3130185,"uuid":"4158232","full_name":"mediaburst/clockwork-dotnet","owner":"mediaburst","description":".NET wrapper for the Clockwork SMS API from Mediaburst.","archived":false,"fork":false,"pushed_at":"2017-10-26T10:17:40.000Z","size":82,"stargazers_count":8,"open_issues_count":2,"forks_count":6,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-07-02T06:43:16.728Z","etag":null,"topics":["c-sharp","clockwork","sms","sms-api","sms-messages","smsportal"],"latest_commit_sha":null,"homepage":"http://www.clockworksms.com/","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/mediaburst.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-27T12:51:59.000Z","updated_at":"2025-06-23T15:16:52.000Z","dependencies_parsed_at":"2022-09-10T22:02:24.697Z","dependency_job_id":null,"html_url":"https://github.com/mediaburst/clockwork-dotnet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mediaburst/clockwork-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mediaburst","download_url":"https://codeload.github.com/mediaburst/clockwork-dotnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266774792,"owners_count":23982247,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["c-sharp","clockwork","sms","sms-api","sms-messages","smsportal"],"created_at":"2025-06-08T21:06:03.347Z","updated_at":"2025-07-24T00:36:44.620Z","avatar_url":"https://github.com/mediaburst.png","language":"C#","readme":"Clockwork SMS API Wrapper for .NET\n==================================\nThis wrapper lets you interact with Clockwork without the hassle of having to create any XML or make HTTP calls.\n\nWe support .NET 2 and above, including Windows Phone and Windows 8/8.1 universal apps.\n\nThe examples below are for C#, you can find a sample VB.NET app in the Sample VB folder.\n\nWhat's Clockwork?\n-----------------\nClockwork is the SMS API from [Mediaburst][4].  It was previously called the Mediaburst SMS API, but we've re-branded it Clockwork\n\nThe terms Clockwork and \"mediaburst SMS API\" refer to exactly the same thing.\n\nInstallation\n------------\nWe've packaged Clockwork as a [NuGet package][1], simply search for Clockwork in the NuGet package manager.\n\nAlternatively, you can download this source and build it yourself. You will however need Visual Studio 2015 as we use a few C#6 features only found in in the new Roslyn compiler.\n\n\nPrerequisites\n-------------\n* Microsoft .NET Framework 2 or higher\n* A [Clockwork][2] account\n\n\nUsage\n-----\nFor convenience you probably want to import the Clockwork namespace in to your code file\n\n```csharp\nusing Clockwork;\n```\n\n### Sending a message\n\n```csharp\t\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\nSMSResult result = api.Send( new SMS { To = \"441234567890\", Message = \"Hello World\" } );   \n```\n\n### Sending multiple messages\n\nWe recomment you use batch sizes of 500 messages or fewer. By limiting the batch size it prevents any timeouts when sending.\n\n```csharp\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\nList\u003cSMS\u003e smsList = new List\u003cSMS\u003e();\nsmsList.Add(new SMS { To = \"441234567891\", Message = \"Hello Bill\" });\nsmsList.Add(new SMS { To = \"441234567892\", Message = \"Hello Ben\" });\nList\u003cSMSResult\u003e results = api.Send(smsList);\n```\n\n### Handling the response\n\nThe responses come back in SMSResult objects, these contain the unique Clockwork Message ID, whether the message worked, and the original SMS so you can update your database.\n\n```csharp\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\nSMSResult result = api.Send( new SMS { To = \"441234567890\", Message = \"Hello World\" } );   \n\nif(result.Success) \n{\n\tConsole.WriteLine(\"SMS Sent to {0}, Clockwork ID: {1}\", result.SMS.To, result.ID);\n}\nelse\n{\n\tConsole.WriteLine(\"SMS to {0} failed, Clockwork Error: {1} {2}\", result.SMS.To, result.ErrorCode, result.ErrorMessage);\n}\n```\n\nIf you send multiple SMS messages in a single send, you'll get back a List of SMSResult objects, one per SMS object.\n\nThe SMSResult object will look something like this:\n\n\tSMSResult {  \n\t\tSMS          = SMS {\n\t\t\t\t\t\t\t\tTo      = \"441234567890\",\n\t\t\t\t\t\t\t\tMessage = \"Hello World\"\n\t\t\t\t\t\t},\n\t\tID           = \"clockwork_message_id\",\n\t\tSuccess      = true,\n\t\tErrorCode    = 0,\n\t\tErrorMessage = null\t\t\n\t}; \n\n\nIf a message fails, Success will be false, and the reason for failure will be set in ErrorCode and ErrorMessage.  \n\nFor example, if you send to invalid phone number \"abc\":\n\n\tSMSResult { \n\t\tSMS          = SMS {\n\t\t\t\t\t\t\t\tTo      = \"abc\",\n\t\t\t\t\t\t\t\tMessage = \"Hello World\"\n\t\t\t\t\t\t}, \n\t\tID           = null,\n\t\tSuccess      = false,\n\t\tErrorCode    = 10,\n\t\tErrorMessage = \"Invalid 'To' Parameter\"\n\t}; \n\n### Checking your credit\n\nCheck how much SMS credit you currently have available, the value will be returned as Balance object\n\n```csharp\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\nClockwork.Balance balance = api.GetBalance();\nstring bal = balance.CurrencySymbol + balance.Amount.ToString(\"#,0.00\");\n```\n\nThe Balance object contains the following parameters:\n\n* Amount - Cash balance available on your account or the amount spent so far this month if AccountType is Invoice\n* CurrencySymbol - Symbol for displaying the balance\n* CurrencyCode - ISO 4217 currency code the balance was calculated in\n* AccountType - AccountType enum - Either PayAsYouGo or Invoice\n\t\t\n    \n### Handling Errors\n\nThe Clockwork wrapper will throw exceptions if the entire call failed.\n\nExceptions of the following types are expected:\n\n* APIException (Clockwork.APIException)\n* WebException (System.Net.WebException)\n* ArgumentException (System.ArgumentException)\n\nFor example sending the wrong API Key will throw an APIException whereas, trying to send without an internet connection would throw a WebException.\n\nA basic structure for Exception handling would look like this:\n\n```csharp\ntry\n{\n\tClockwork.API api = new API(not_your_key);\n\tSMSResult result = api.Send( new SMS { To = \"441234567890\", Message = \"Hello World\" } );   \n\t// Process the result here\n}\ncatch (APIException ex)\n{\n\t// You'll get an API exception for errors such as wrong API Key\n}\ncatch (WebException ex)\n{\n\t// Web exceptions mean you couldn't reach the Clockwork server\n}\ncatch (ArgumentException ex)\n{\n\t// Argument exceptions are thrown for missing parameters, such as forgetting to set the API Key\n}\ncatch (Exception ex)\n{\n\t// Something else went wrong, the error message should help here\n}\n```\n\nAdvanced Usage\n--------------\nThis class has a few additional features that some users may find useful, if these are not set your account defaults will be used.\n\n### Optional Parameters\n\n*   From [string]\n\n    The from address displayed on a phone when they receive a message\n\n*   Long [nullable boolean]  \n\n    Enable long SMS. A standard text can contain 160 characters, a long SMS supports up to 459.\n\n*   Truncate [nullable boolean]  \n\n    Truncate the message payload if it is too long, if this is set to false, the message will fail if it is too long.\n\n*   InvalidCharacterAction [enum]\n\n    What to do if the message contains an invalid character. Possible values are\n    * AccountDefault - Use the setting from your Clockwork account\n    * None\t\t\t - Fail the message\n    * Remove\t\t - Remove the invalid characters then send\n    * Replace\t\t - Replace some common invalid characters such as replacing curved quotes with straight quotes\n\n### Setting Options\n\n#### Global options\nOptions set on the API object will apply to all SMS messages unless specifically overridden.\n\nIn this example both message will be sent from Clockwork\n\n```csharp\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\napi.From = \"Clockwork\";\nList\u003cSMS\u003e smsList = new List\u003cSMS\u003e();\nsmsList.Add(new SMS { To = \"441234567891\", Message = \"Hello Bill\" });\nsmsList.Add(new SMS { To = \"441234567892\", Message = \"Hello Ben\" });\nList\u003cSMSResult\u003e results = api.Send(smsList); \n```\n\n#### Per-message Options\nSet option values individually on each message\n\nIn this example, one message will be from Clockwork and the other from 84433\n\n```csharp\nClockwork.API api = new API(key); //Be careful not to post API Keys to public repositories\nList\u003cSMS\u003e smsList = new List\u003cSMS\u003e();\nsmsList.Add(new SMS { To = \"441234567891\", Message = \"Hello Bill\", From=\"Clockwork\" });\nsmsList.Add(new SMS { To = \"441234567892\", Message = \"Hello Ben\", From=\"84433\" });\nList\u003cSMSResult\u003e results = api.Send(smsList);\n```\n\n### Proxy Server Support\nIf you need to override the system proxy settings you can optionally pass a System.Net.WebProxy object to the SMS class.  \nSee [WebProxy on MSDN][3] for full details.\n\n```csharp\n// Create the Clockwork API object as normal\nClockwork.API api = new API(key);\n\n// Set your proxy settings\napi.Proxy = new System.Net.WebProxy(proxyHost, proxyPort);\n\n// Send the message\nSMSResult result = api.Send( new SMS { To = \"441234567890\", Message = \"Hello World\" } );  \n```\t\t \n\nLicense\n-------\nThis project is licensed under the MIT open-source license.\n\nA copy of this license can be found in License.txt.\n\nContributing\n------------\nIf you have any feedback on this wrapper drop us an email to hello@clockworksms.com.\n\nThe project is hosted on GitHub at https://github.com/mediaburst/clockwork-dotnet.\nIf you would like to contribute a bug fix or improvement please fork the project \nand submit a pull request.\n\n[1]: https://nuget.org/packages/Clockwork/\n[2]: https://www.clockworksms.com/\n[3]: http://msdn.microsoft.com/en-us/library/system.net.webproxy.aspx\n[4]: https://www.mediaburst.co.uk/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediaburst%2Fclockwork-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediaburst%2Fclockwork-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediaburst%2Fclockwork-dotnet/lists"}