Giter VIP home page Giter VIP logo

textmagic-rest-csharp's Introduction

Textmagic:: Rest C# Wrapper

Welcome to your new textmagic-rest-csharp wrapper! This library provides you with an easy solution to send SMS and receive replies by integrating TextMagic SMS Gateway to your C# / .NET application.

In this directory, you'll find the files you need to be able to create the library binaries and to use them in your application. To experiment with that code, several examples are provided.

What is TextMagic?

TextMagic's application programming interface (API) provides the communication link between your application and TextMagic’s SMS Gateway, allowing you to send and receive text messages and to check the delivery status of text messages you’ve already sent.

https://www.textmagic.com/docs/api/

All these commands can be executed only if you provide a valid username and API password in your requests.

Installation

Add the library to your project references or install it as NuGet package.

Usage

  1. Register on TextMagic: https://www.textmagic.com/

  2. Download TextMagic C# Wrapper class library package and reference it in your project.

In Visual Studio, you should go to Project - Add Reference window and locate dll by clicking Browse button.

In SharpDevelop, go to Project - Add Reference - .NET Assembly Browser and choose dll by clicking Browse button.

That's it! Now you can use TextMagic services as described below.

  1. Have a look at the TextMagic SMS API Documentation and use the sandbox to experiment with the different API functions and get more technical details.

  2. Write Code like:

using System;
using System.Collections.Generic;
using TextmagicRest;
using TextmagicRest.Model;

namespace textmagicsample
{
    class Program
    {
        public static void Main(string[] args)
        {
            sendMessage();

            Console.WriteLine("Check your phone ;-)");
            Console.WriteLine("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
                
        public static void sendMessage() 
        {
            var client = new Client("replace-with-username", "replace-with-user-api-key");
            var link = client.SendMessage("Hello from TextMagic API C# Wrapper demo application", "replace-with-phoneNumber-WithInternationalPrefix");

            if (link.Success) 
            {
                Console.WriteLine("Message session {0} successfully sent", link.Id);
            } else 
            {
                Console.WriteLine("Message was not sent due to following exception: " + link.ClientException.Message);
            }
        }      
    }
}

Note: replace "replace-with-username", "replace-with-user-api-key", "replace-with-phoneNumber-WithInternationalPrefix" with the credentials you got during your registration on TextMagic and a valid phone number.

  1. Have fun... :)
  2. More ready to use examples are included in the solution.

Requirements

.NET 4.0 or higher

RestSharp (>= 105.1.0)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/textmagic/textmagic-rest-csharp.

License

The library is available as open source under the terms of the MIT License.

textmagic-rest-csharp's People

Contributors

dmitry-textmagic avatar foufure avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.