07 June 2015

Using Telstra API to send SMS in ASP.NET

Telstra (https://dev.telstra.com/) is pushing their own API and as a part of the plan, it is giving away 1000 free SMS per month with the limit of 100 per day.

After a simple register and set up, wait about 1 hour for get "MyAPP" approved, it is ready to go.



It requests an access token with your own "key" and "secret" first which expires in 1 hour. Then we need to pass in this token with all the request we are going to make.
The documentation is simple, straight forward and all the sample code is hosted on github. I write a quick C# to test it out and it works well!

public string GetAccessToken()
{
    const string consumerKey = "{yourkey}";
    const string consumerSecret = "{secret}";
    string url =string.Format("https://api.telstra.com/v1/oauth/token?client_id={0}&client_secret={1}&grant_type=client_credentials&scope=SMS", consumerKey, consumerSecret);

    using (var webClient = new System.Net.WebClient())
    {
        var json = webClient.DownloadString(url);
        var obj = JObject.Parse(json);
        return obj.GetValue("access_token").ToString();
     }
}
public string SendSms(string token, string recipientNumber, string message)
{
     try
     {
        using (var webClient = new System.Net.WebClient())
        {
            webClient.Headers.Clear();
            webClient.Headers.Add(HttpRequestHeader.ContentType, @"application/json");
            webClient.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + token);

            string data = "{\"to\":\"" + recipientNumber + "\", \"body\":\"" + message + "\"}";
            var response = webClient.UploadData("https://api.telstra.com/v1/sms/messages", "POST", Encoding.Default.GetBytes(data));
            var responseString = Encoding.Default.GetString(response);
            var obj = JObject.Parse(responseString);
            return obj.GetValue("messageId").ToString();
                    // Now parse with JSON.Net
        }
     }
     catch (Exception e)
     {
        Console.WriteLine(e.Message);
     }
        return string.Empty;
 }

77 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. you might not even be around a TV. our other option for watching Television on a regular cable or satellite box is to do so online hotstickybun

    ReplyDelete
  3. Everyone carries their mobile wherever they go and involuntarily read any new incoming message. So your ad message will be immediately viewed and so SMS marketing is particularly useful for time-sensitive marketing campaigns.
    http://www.padisoft.org

    ReplyDelete
  4. In today's competitive business arena, you need to have a regular interaction with the customers to avoid losing potential customers padisoft.org

    ReplyDelete
  5. The fact that SMS also provides an enormous opportunity for companies to interact with their customers, is not really well known.padisoft.org

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. What could fill somebody's heart with joy other than perusing such perfectly created blog, for example, this.
    best reverse phone number lookup review

    ReplyDelete
  8. When it comes to typical tech enterprising, a business is either an SME or a startup, categorically.best tablets under 302

    ReplyDelete
  9. I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. vpnveteran

    ReplyDelete
  10. Awesome bit of composing, I extremely loved the manner in which you featured some extremely critical and huge focuses like SMS Sending Using ASP.NET. I value your work.Bulk SMS API

    ReplyDelete
  11. Impressive web site, Distinguished feedback that I can tackle. I am moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards maggiori informazioni

    ReplyDelete
  12. This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. gbwhatsapp ios

    ReplyDelete
  13. There are a lot of blogs and articles out there on this topic, but you have acquired another side of the subject. This is reliable content thank you for sharing it. die besten vpn

    ReplyDelete
  14. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks
    Tangki Panel

    ReplyDelete
  15. I needed to create you one very little observation to finally thank you so much the moment again over the wonderful guidelines you have contributed in this case. It’s really tremendously open-handed of people like you to make unreservedly just what many individuals would’ve sold as an electronic book to help with making some bucks on their own, even more so considering the fact that you might well have done it in the event you wanted. The secrets as well acted to be the fantastic way to recognize that many people have the identical dreams the same as my personal own to figure out way more with reference to this problem. I believe there are many more fun instances in the future for individuals that examine your blog post.
    Jual Septic Tank

    ReplyDelete
  16. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work the best vpn

    ReplyDelete
  17. Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, https://internetprivatsphare.at/orf-streamen-im-ausland/

    ReplyDelete
  18. You guardians do an astounding web diary, and have some unfathomable substance. Continue doing extraordinary. click here

    ReplyDelete
  19. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!
    Mason Soiza

    ReplyDelete
  20. Extremely intriguing online journal. A lot of web journals I see nowadays don't generally give anything that I'm keen on, however I'm most definitely inspired by this one. Recently felt that I would post and let you know. Arinda IT Services

    ReplyDelete
  21. Awesome review, I am a major devotee to remarking on web journals to educate the web journal scholars realize that they've added something beneficial to the internet!..  https://vpnveteran.com/

    ReplyDelete
  22. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. Skype Offline Installer

    ReplyDelete
  23. When you are searching for a gps locator for children, you should search for a couple of highlights. sms bomber iphone

    ReplyDelete
  24. SMS marketing allows the user to send bulk messages easily and quickly to various groups of people.smm reseller panel

    ReplyDelete
  25. Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. https://www.lesmeilleursvpn.com

    ReplyDelete
  26. Incredible Article it its truly instructive and inventive update us as often as possible with new upgrades. its was truly important. much obliged.  besuche die Website

    ReplyDelete
  27. That appears to be excellent however i am still not too sure that I like it. At any rate will look far more into it and decide personally! https://internetprivatsphare.ch

    ReplyDelete
  28. I have used a lot of juicers in the past and I created this blog to help juice lovers make the right decision in choosing the type of juicer that best fit their needs. There are several good masticating juicers to choose from.  lemigliorivpn.com

    ReplyDelete
  29. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing. Bulk SMS Nigeria

    ReplyDelete
  30. Over various years the SMS business and the scope of utilizations accessible to organizations has expanded exponentially. Subsequently, the quantity of SMS suppliers offering corporate evaluation SMS arrangements and stages has likewise expanded. Bulk SMS API

    ReplyDelete
  31. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. RARBG

    ReplyDelete
  32. Thank you for taking the time to publish this information very useful! buy instagram likes instant

    ReplyDelete
  33. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. business texting services

    ReplyDelete
  34. Yahoo mail is an web based email service. Yahoo mail service can be accessed through different devices including computer, tablets, smart phones, and more. Users with a valid Yahoo account can sign into Yahoo com to access the features of Yahoo mail. A smile web browser can be used to sign into Yahoo.com. Users can also download Yahoo app to their mobile phone and login to their account. yahoo mail sign in

    ReplyDelete
  35. buy smart carts online. organic smart cart. are the high potency distillate free from any solvents. If this product was accurate with its claim.

    ReplyDelete
  36. Stonersdankshop established in 2016 in United States has been the best vape shop exporting vape products online to most vape shops in USA and to vape .. buy exotic carts online

    ReplyDelete
  37. Enrich your experience of online shopping by navigating our Skin Care products including Hair removal products, Facial cleansing brush, Epilators and much ...

    IPL HAIR REMOVER,
    FACIAL BRURSH,
    HAIR TRIMMER,
    MICRODEBRASION,
    BLACKHEAD REMOVER,
    WATERPROOF PORTABLE,

    ReplyDelete
  38. ערות ליווי בחיפה ברמה גבוהה ביותר בישראל. נערות ליווי בצפון לביתך או מלון תוך 30 דקות אצלך. 24/7 מגוון בנות לעיסוי פרטי ברמה הגבוהה. נערות ליווי בחיפה

    ReplyDelete
  39. Royal photo Booths Australia At Royal Booths,we want to make a good impression with you, hence we go above & beyond when it comes to forming that initial relationship with our customers.

    ReplyDelete
  40. At V P Associates Chartered Certified Accountants and Tax Advisor Accountant services, East Grinstead, West Sussex, we more than just respond to your need. Tax Advice

    ReplyDelete
  41. Our store offers many styles of advanced tpe sex dolls, soft skin made of tpe material, realistic tpe sex dolls to achieve your desire for sex.Buy real realistic tpe ... realistic sex doll

    ReplyDelete
  42. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! send and receive fax android

    ReplyDelete
  43. I simply observed this weblog and feature excessive hopes for it to continue. hold taking region the precise con, its hard to discover great ones. i've appendage to my favorites. thank you. Email Marketing Software

    ReplyDelete
  44. 7 Coolest Offices in California

    When you first heard the word office? What is the first thing that comes into your mind?

    You must be wondering that offices only mean white walls, dark doors, and white cubicles.

    These were the days of the Grey that now has been gone.

    Nowadays, many companies invest their money in the interior of the offices because it’s truly said, “You should love the space where you work”.

    ReplyDelete
  45. 5 effective ways in which you can promote your business

    Every other business owner wants to showcase that their business is the best and they can deliver the best products and services and all they want is to put their services in front of the potential customers. However, there are many traditional ways in which one can promote business but all these traditional ways of promoting can indeed be strenuous and costly......

    ReplyDelete
  46. People with good knowledge and understanding of patterns, statistics, mathematics, programming etc. have tremendous scope in pursuing data science as a profession. Join data science course syllabus

    ReplyDelete
  47. Whatever decisions you make, realize that they all will be reflected in your veterinary tech compensation. www.hotmail.com

    ReplyDelete
  48. Heisman likewise drove Tech to the most elevated scoring football match-up ever played with a 222 - 0 win over an absolutely outmanned Cumberland State in 1916 (really awful it wasn't Georgia!). tech email list

    ReplyDelete
  49. it's really cool blog. Linking is very useful thing.you have really helped Click here

    ReplyDelete
  50. superslop

    Superslot หรือ ภาษาไทย บ้านๆ เรียกว่า ซุปเปอร์สล็อต เราคือผู้ให้บริการสล็อตออนไลน์มีตัวเกมสล็อตให้เลือกเล่นจำนวนมากบนมือถืออันดับ 1 ทั้งฟรี

    ReplyDelete
  51. This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thank you so much. Keep up the good works. receive SMS free

    ReplyDelete
  52. This blog is really great. The information here will surely be of some help to me. Thanks!. receive SMS free

    ReplyDelete
  53. dog health
    Are you a cat or dog owner looking to maximize nourishment for your furry family members? As a pet parent, you naturally strive to provide your pets with the best lifestyle options available.

    ReplyDelete
  54. gogo anime

    GogoAnime - Watch anime online in high quality for free. Watch anime subbed, anime dubbed online free. Update daily, fast streaming, no ads, no registration ...

    ReplyDelete
  55. I have been surfing online for more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. Personally, sagame
    ufa

    ufabet

    ReplyDelete
  56. Thank you for oder my Gigs. Please share the details guide in the project

    shaw internet plans

    ReplyDelete
  57. If you desire to grow your knowledge just keep visiting this web page and be updated with the latest posted here
    36v lithium ion battery

    ReplyDelete
  58. Hey superb blog! Does running a blog such as this take a
    massive amount work? I’ve absolutely no understanding of programming
    but I had been hoping to start my own blog soon. Anyways,
    if you have any suggestions or techniques for new blog owners please share.
    I know this is off topic but I just had to ask.

    Appreciate it!
    https://www.coydoll.com/

    ReplyDelete
  59. インドのビザ Thisare a private website offering our users online application services which include assistance with their application for Electronic Travel Authorization for travel to India. 

    ReplyDelete
  60. Ho bisogno del contenuto di questo articolo, Crea molto amato, personalmente vorrei ulteriori informazioni utilizzando questo, una grande quantità di pensiero è particolarmente interessante., Benedici chiunque sia adatto per la produzione. mSpy

    ReplyDelete
  61. TAXPRO is a chief expert administration firm enhancing the matter of its customers for over 30 decades. We do this by giving a wide array of administrations in the monetary space which ranges from Entry Level Strategy, Taxation consultancy administrations, GST, Audit and Assurance, Accounting, Corporate Compliance, Payroll Services, ESI/PF Consultancy, and part more. We are a group of expense experts that incorporates Chartered Accountants, Advocates, Company Secretaries, Financial counselors offering marketing an accounting firm to the makers, Traders, Dealers, and specialist organizations of the business. Our administrations are looked for different business, lawful, and tax assessment confusions.

    ReplyDelete
  62. An interesting dialogue is price comment. I feel that it is best to write more on this matter, it may not be a taboo topic however usually individuals are not enough to talk on such topics. To the next. Cheers. SMS Marketing - massen sms versenden

    ReplyDelete
  63. These you will then see the most important thing, the application provides you a website a powerful important internet page: craigslist email address extractor

    ReplyDelete
  64. I would like to say that this blog really convinced me to do it! Thanks, very good post. Auto Reply Text Message

    ReplyDelete
  65. You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! Quick Response Text Messages Samples

    ReplyDelete
  66. movierulz sites APK Download for Android Mobile, Free Download MovieRulz App Telugu, Tamil, English, Kannada for your Android TV, Android.

    ReplyDelete
  67. Find the best essays on is my friend's profile page. AI Tech Assessment Tool

    ReplyDelete
  68. สล็อต xo เครดิตฟรี


    เกมส์สล็อตออนไลน์เหล่านี้เป็นเกมส์ที่ยอดนิยม และมีผู้เล่นมากที่สุดตั้งแต่ แอพ Slotxo ได้เปิดให้บริการมานั่นเอง จากตัวอย่างจะแสดงให้เห็นได้ว่าเกมส์สล็อตออนไลน์ จาก SLOTXO นั้นมีธีมของเกมส์ที่แตกต่างหลากหลายกันออกไป ไม่ว่าจะเป็นแนว

    ReplyDelete
  69. joker สล็อต

    For a new website, there are many promotions to choose from. HUBJOKER888 is a website that has been launched with an automatic system, whether it is making transactions, applying for membership, depositing, withdrawing, making transactions.

    ReplyDelete
  70. สำหรับท่านที่ต้องการเล่น pgslot ไม่ว่าจะเล่นผ่าน บราวเซอร์ Chrome , Firefox , Safari อื่นๆ เป็นต้น สามารถ ติดตั้งโปรแกรมบรคอมพิวเตอร์บนระบบปฏิบัติการ IOS หรือ Windows และสามารถเล่นได้สะดวกทุกที่บนมือถือที่เป็นสมาร์ทโฟน บน Iphone , Ipad และ Android ซึ่งท่านสามารถคลิกดูรายละเอียดการติดตั้งได้ที่ปุ่มด้านล่างได้ทันที หากต้องการสอบถามข้อมูลเพิ่มเติม สามารถติดต่อทีมงาน Hubpgslot ได้ตลอด 24 ช.ม.

    pg slot auto
    ทางเข้า pg slot
    pg slot โปรโมชั่น
    pg slot ทดลองเล่นฟรี
    pg slot ฝากถอนไม่มีขั้นต่ํา
    pgslot168
    pg slot game
    pg slot demo
    pgslot เครดิตฟรี
    ดาวโหลด pgslot
    pgslot auto
    pgslot 77
    queenslot pgslot
    pgslot download
    slotkub pgslot
    pgslot 100
    slotxd pgslot
    superslot pgslot
    pgslot 311
    สล็อต pgslot
    pgslotฟรีเครดิต
    pgslot สมัคร
    โปร pgslot

    ReplyDelete
  71. สำหรับท่านที่ต้องการเล่น pgslot ไม่ว่าจะเล่นผ่าน บราวเซอร์ Chrome , Firefox , Safari อื่นๆ เป็นต้น สามารถ ติดตั้งโปรแกรมบรคอมพิวเตอร์บนระบบปฏิบัติการ IOS หรือ Windows และสามารถเล่นได้สะดวกทุกที่บนมือถือที่เป็นสมาร์ทโฟน บน Iphone , Ipad และ Android ซึ่งท่านสามารถคลิกดูรายละเอียดการติดตั้งได้ที่ปุ่มด้านล่างได้ทันที หากต้องการสอบถามข้อมูลเพิ่มเติม สามารถติดต่อทีมงาน Hubpgslot ได้ตลอด 24 ช.ม.

    pg slot auto
    ทางเข้า pg slot
    pg slot โปรโมชั่น
    pg slot ทดลองเล่นฟรี
    pg slot ฝากถอนไม่มีขั้นต่ํา
    pgslot168
    pg slot game
    pg slot demo
    pgslot เครดิตฟรี
    ดาวโหลด pgslot
    pgslot auto
    pgslot 77
    queenslot pgslot
    pgslot download
    slotkub pgslot
    pgslot 100
    slotxd pgslot
    superslot pgslot
    pgslot 311
    สล็อต pgslot
    pgslotฟรีเครดิต
    pgslot สมัคร
    โปร pgslot

    ReplyDelete
  72. We offer all the major sports such as English Premier League, Spanish La Liga, Italian Serie A, UEFA Champions League, French Ligue 1, German Bundesliga 1.


    ป๊อกเด้ง
    sexybaccarat
    เกมฟรีสปิน
    tim369
    โป๊กเกอร์

    ReplyDelete
  73. Citycarpart

    We are a team of enthusiastic developers and entrepreneurs who decided to convert their common experience into this web store. We hope you’ll like it as much as we do and have a great shopping experience here. Our prime goal is to create a shop in which you can easily find whatever product you need.

    ReplyDelete
  74. สล็อตออนไลน์ เป็นเกมคาสิโนออนไลน์ ที่กำลังเป็นที่นิยมและแพร่หลายอยู่ในปัจจุบันนี้ นัก​เดิมพันต่างให้ความสนใจ เพราะสามารถเล่นบนคอมพิวเตอร์ หรือจะเล่นใน Tablet

    SAGAMING 1688
    คาสิโนออนไลน์ ทดลองเล่นฟรี
    pg slot ฝากถอนไม่มีขั้นต่ำ
    pg slot demo
    lotto online
    ไพ่ดอกจิก
    สล็อตjoker ฝากถอนไม่มีขั้นต่ำ
    pg slot โปรโมชั่น

    ReplyDelete
  75. STARVEGASVIP.COM. @SVVIP มีโปรโมชั่นดีที่สุด พร้อมรางวัลพิเศษแจกทุกเดือน สล็อตออนไลน์ผ่านแอปพลิเคชั่น มีตู้เกมส์สล็อตสุดฮอตให้เลือกเล่นมากกว่า 100 เกมส์

    สล็อตออนไลน์ starvegas
    star vegas slot
    สมัคร star vegas
    starvegus
    starvegas
    starvegas game
    เกมสล็อต
    สล็อต
    สล็อตออนไลน์

    ReplyDelete
  76. Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends
    discord sms verification

    ReplyDelete

WFFM Web form for marketer fail to submit in Sitecore

I have setup a standard form using WFFM in Sitecore 8.2. It always fail when submit. Error as below, Error: Exception: System.Data.DataE...