Giter Site home page Giter Site logo

csharp-rest-api's Introduction

MessageBird's REST API for C#

This repository contains the open source C# client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com.

Build status NuGet version (MessageBird)

Requirements

  • Sign up for a free MessageBird account
  • Create a new access_key in the developers sections
  • MessageBird API client for C# requires .NET Framework >= 4 or .NET Standard >= 2.0
  • It has a dependency on JSON.NET >= 4.5.6

Installation

JSON.NET

The MessageBird project depends on JSON.NET, which can be installed using the NuGet package manager. For more information on how to achieve this, see 'Managing NuGet packages using the dialog'.

Usage

We have put some self-explanatory examples in the Examples project, but here is a quick breakdown on how it works. First, you need to set up a MessageBird.Client. Be sure to replace YOUR_ACCESS_KEY with something real.

using System;
using MessageBird;
using MessageBird.Objects;

class Example
{
  static void Main(string[] args)
  {
    Client client = Client.CreateDefault("YOUR_ACCESS_KEY");
  }
}

That's easy enough. Now we can query the server for information. Lets use getting your balance overview as an example:

// Get your balance
Balance balance = client.Balance();

Error handling

In case of an error the client throws an ErrorException. The ErrorException objects contains either:

  • an array of Error objects that encapsulates the errors in the response (see errors for more info),
  • a best effort description when no error information from the endpoint is available.

See the provided examples on how to access error information from the ErrorException.

Conversations WhatsApp Sandbox

To use the whatsapp sandbox you need to add Client.Features.EnableWhatsAppSandboxConversations to the list of features you want enabled. Don't forget to replace YOUR_ACCESS_KEY with your actual access key.

using System;
using MessageBird;
using MessageBird.Objects;

class Example
{
  static void Main(string[] args)
  {
    Client client = Client.CreateDefault("YOUR_ACCESS_KEY",features: new Client.Features[] { Client.Features.EnableWhatsAppSandboxConversations });
  }
}

Documentation

Complete documentation, instructions, and examples are available at: https://developers.messagebird.com

License

The MessageBird REST Client for C# is licensed under The ISC License. Copyright (c) 2014, Remco Vermeulen

csharp-rest-api's People

Contributors

epels avatar marcelcorso avatar jornengelbart avatar samwierema avatar ali-benzarrouk-mb avatar bviolier avatar jg10 avatar mariuspot avatar dysosmus avatar soheildiyanat avatar hanssens avatar deluxz avatar codefrenzy avatar danielsequeira avatar franotero avatar bitcoinbrisbane avatar lgomezma avatar mbroertjes avatar sotoz avatar vanwinssen 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.