{"id":3293,"date":"2024-05-29T08:54:34","date_gmt":"2024-05-29T08:54:34","guid":{"rendered":"https:\/\/www.infobip.com\/developers\/?p=3293"},"modified":"2024-06-05T16:17:02","modified_gmt":"2024-06-05T16:17:02","slug":"how-to-schedule-an-sms-message-using-c-and-infobip","status":"publish","type":"post","link":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip","title":{"rendered":"How to schedule an SMS message using C# and Infobip"},"content":{"rendered":"\n<p>As an outcome of this guide, you will schedule an SMS message for later delivery using the Infobip SMS API and the Infobip API C# SDK. The C# SDK targets <strong>.NET Standard 2.0<\/strong>, so you can use it with that version or any later version of .NET.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>\u2022 <a href=\"https:\/\/www.infobip.com\/signup\" target=\"_blank\" rel=\"noopener\">Infobip account<\/a><br>\u2022 Working <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/core\/get-started\">.NET environment<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Difficulty level<\/h2>\n\n\n\n<p>This guide assumes very basic knowledge of C# and basic familiarity with APIs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary of the steps<\/h2>\n\n\n\n<p>\u2022 Install the Infobip API C# SDK.<br>\u2022 Create an API Client instance using your Infobip credentials.<br>\u2022 Build your SMS payload.<br>\u2022 Use the the client&#8217;s <code>SendSmsMessage<\/code> attribute to send your SMS payload.<br>\u2022 Wrap your code in an async task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install the Infobip API C# SDK<\/h2>\n\n\n\n<p>You can use the Package Manager Console:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package Infobip.Api.SDK<\/code><\/pre>\n\n\n\n<p>You can also use the .NET Core CLI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet add package Infobip.Api.SDK<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create a Client instance<\/h2>\n\n\n\n<p>First, create an <code>ApiClientConfiguration<\/code> instance with your Infobip credentials, which are your API Key and Base URL. You can access these from your <a href=\"https:\/\/portal.infobip.com\/homepage\/\" target=\"_blank\" rel=\"noreferrer noopener\">Infobip account<\/a> or from the <a href=\"https:\/\/www.infobip.com\/docs\/api\" target=\"_blank\" rel=\"noreferrer noopener\">Infobip API landing page<\/a> once you are logged in.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var configuration = new ApiClientConfiguration(\n        \"&lt;Base_URL&gt;\",\n        \"&lt;API_Key&gt;\");<\/code><\/pre>\n\n\n\n<p>Next, use this configuration to create an <code>InfobipApiClient<\/code> instance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var client = new InfobipApiClient(configuration);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Build and send your payload<\/h2>\n\n\n\n<p>First, you must define the destination numbers to which you want to send an SMS message. You can define multiple destinations; in this guide we&#8217;ll only use one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    var destination = new SmsDestination(<br>            to : \"DESTINATION_NUMBER\"<br>    );<\/code><\/pre>\n\n\n\n<p>Next, build the SMS message you want to send. This constructor takes a list of destinations, a sender ID in the form of a string, and the text of the SMS message itself.<br><br>This is also where you specify the time at which you want the SMS to be sent, using the <code>sendAt<\/code> parameter. This is a <code>DateTimeOffset<\/code> object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    var message = new SmsMessage(\n            destinations : &#91;destination],\n            from : \"Infobip SMS\",\n            text : \"This is a text message!\"\n            sendAt : new DateTimeOffset(2024, 6, 1, 12, 0, new TimeSpan(1, 0, 0)\n    );<\/code><\/pre>\n\n\n\n<p>You can build multiple SMS messages and send them with the same function call, again in the form of a list. In this guide we only send one message.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    var request = new SendSmsMessageRequest(<br>            messages : &#91;message]<br>    );<\/code><\/pre>\n\n\n\n<p>Finally, send the request: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>await client.Sms.SendSmsMessage(request);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Wrap your code in an async <code>Task<\/code><\/h2>\n\n\n\n<p>Put all this code together into a Task which can be run in order to send your SMS message.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public async Task&lt;SendSmsMessageResponse&gt; SendSmsMessage()\n{\n    var configuration = new ApiClientConfiguration(\n        \"&lt;Base_URL&gt;\",\n        \"&lt;API_Key&gt;\");\n\n    var client = new InfobipApiClient(configuration);\n\n    var message = new SmsMessage(\n            Destinations = destinations;\n            From = from;\n            Text = text;\n    )\n\n    var request = new SendSmsMessageRequest{\n            Messages = messages;\n    };\n\n    return await client.Sms.SendSmsMessage(request);\n}<\/code><\/pre>\n\n\n\n<p>You can inspect the <code>SendSmsMessageResponse<\/code> return value to see information about the status of your message.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As an outcome of this guide, you will schedule [&hellip;]<\/p>\n","protected":false},"author":53,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[28,12,264],"tags":[43,76],"coauthors":[285],"class_list":["post-3293","post","type-post","status-publish","format-standard","hentry","category-blog-post","category-guide","category-sms","tag-api","tag-sdk"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to schedule an SMS message using C# and Infobip - Infobip Developers Hub<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to schedule an SMS message using C# and Infobip - Infobip Developers Hub\" \/>\n<meta property=\"og:description\" content=\"As an outcome of this guide, you will schedule [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\" \/>\n<meta property=\"og:site_name\" content=\"Infobip Developers Hub\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infobip\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-29T08:54:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-05T16:17:02+00:00\" \/>\n<meta name=\"author\" content=\"Eli Holderness\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:site\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eli Holderness\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\"},\"author\":{\"name\":\"Eli Holderness\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/2d3f818bd258646bc997a3ec04146bbd\"},\"headline\":\"How to schedule an SMS message using C# and Infobip\",\"datePublished\":\"2024-05-29T08:54:34+00:00\",\"dateModified\":\"2024-06-05T16:17:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\"},\"wordCount\":349,\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"keywords\":[\"API\",\"SDK\"],\"articleSection\":[\"Blog Post\",\"Guide\",\"SMS\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\",\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\",\"name\":\"How to schedule an SMS message using C# and Infobip - Infobip Developers Hub\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\"},\"datePublished\":\"2024-05-29T08:54:34+00:00\",\"dateModified\":\"2024-06-05T16:17:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.infobip.com\/developers\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to schedule an SMS message using C# and Infobip\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"name\":\"Infobip Developers Hub\",\"description\":\"Build meaningful customer relationships across any channel\",\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.infobip.com\/developers\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\",\"name\":\"Infobip Developers Hub\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"contentUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"width\":696,\"height\":696,\"caption\":\"Infobip Developers Hub\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infobip\/\",\"https:\/\/x.com\/InfobipDev\",\"https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ\",\"https:\/\/github.com\/infobip-community\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/2d3f818bd258646bc997a3ec04146bbd\",\"name\":\"Eli Holderness\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/e3fd4a8aa6b78952d057f724bcf1dff0\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2261319993db9030e1328c712ee20e4aaedf2c9cb8e4379ae8af57f2c877d5f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2261319993db9030e1328c712ee20e4aaedf2c9cb8e4379ae8af57f2c877d5f4?s=96&d=mm&r=g\",\"caption\":\"Eli Holderness\"},\"description\":\"Developer advocate, conference speaker &amp; professional nerd. Likes maths, knitting, and cats.\",\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/author\/eli\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to schedule an SMS message using C# and Infobip - Infobip Developers Hub","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip","og_locale":"en_US","og_type":"article","og_title":"How to schedule an SMS message using C# and Infobip - Infobip Developers Hub","og_description":"As an outcome of this guide, you will schedule [&hellip;]","og_url":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip","og_site_name":"Infobip Developers Hub","article_publisher":"https:\/\/www.facebook.com\/infobip\/","article_published_time":"2024-05-29T08:54:34+00:00","article_modified_time":"2024-06-05T16:17:02+00:00","author":"Eli Holderness","twitter_card":"summary_large_image","twitter_creator":"@InfobipDev","twitter_site":"@InfobipDev","twitter_misc":{"Written by":"Eli Holderness","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#article","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip"},"author":{"name":"Eli Holderness","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/2d3f818bd258646bc997a3ec04146bbd"},"headline":"How to schedule an SMS message using C# and Infobip","datePublished":"2024-05-29T08:54:34+00:00","dateModified":"2024-06-05T16:17:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip"},"wordCount":349,"publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"keywords":["API","SDK"],"articleSection":["Blog Post","Guide","SMS"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip","url":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip","name":"How to schedule an SMS message using C# and Infobip - Infobip Developers Hub","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/#website"},"datePublished":"2024-05-29T08:54:34+00:00","dateModified":"2024-06-05T16:17:02+00:00","breadcrumb":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-to-schedule-an-sms-message-using-c-and-infobip#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.infobip.com\/developers\/"},{"@type":"ListItem","position":2,"name":"How to schedule an SMS message using C# and Infobip"}]},{"@type":"WebSite","@id":"https:\/\/www.infobip.com\/developers\/#website","url":"https:\/\/www.infobip.com\/developers\/","name":"Infobip Developers Hub","description":"Build meaningful customer relationships across any channel","publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.infobip.com\/developers\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.infobip.com\/developers\/#organization","name":"Infobip Developers Hub","url":"https:\/\/www.infobip.com\/developers\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/","url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","contentUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","width":696,"height":696,"caption":"Infobip Developers Hub"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infobip\/","https:\/\/x.com\/InfobipDev","https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ","https:\/\/github.com\/infobip-community"]},{"@type":"Person","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/2d3f818bd258646bc997a3ec04146bbd","name":"Eli Holderness","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/e3fd4a8aa6b78952d057f724bcf1dff0","url":"https:\/\/secure.gravatar.com\/avatar\/2261319993db9030e1328c712ee20e4aaedf2c9cb8e4379ae8af57f2c877d5f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2261319993db9030e1328c712ee20e4aaedf2c9cb8e4379ae8af57f2c877d5f4?s=96&d=mm&r=g","caption":"Eli Holderness"},"description":"Developer advocate, conference speaker &amp; professional nerd. Likes maths, knitting, and cats.","url":"https:\/\/www.infobip.com\/developers\/blog\/author\/eli"}]}},"_links":{"self":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/comments?post=3293"}],"version-history":[{"count":5,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3293\/revisions"}],"predecessor-version":[{"id":3298,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3293\/revisions\/3298"}],"wp:attachment":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/media?parent=3293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/categories?post=3293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/tags?post=3293"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/coauthors?post=3293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}