Skip to content

Instantly share code, notes, and snippets.

@IbrahimTareq
Created May 12, 2018 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IbrahimTareq/5d7dcf7c1dd4e04d9c9523b68aecb16c to your computer and use it in GitHub Desktop.
Save IbrahimTareq/5d7dcf7c1dd4e04d9c9523b68aecb16c to your computer and use it in GitHub Desktop.
MessageMedia Messages C#
using System;
using MessageMedia.Messages;
using MessageMedia.Messages.Controllers;
using MessageMedia.Messages.Models;
namespace TestCSharpSDK
{
class Program
{
static void Main(string[] args)
{
// Configure your credentials (Note, these can be pulled from the environment variables as well)
String basicAuthUserName = "YOUR_API_KEY";
String basicAuthPassword = "YOUR_API_SECRET";
bool useHmacAuthentication = false; //Change this to true if you are using HMAC keys
// Instantiate the client
MessageMediaMessagesClient client = new MessageMediaMessagesClient(basicAuthUserName, basicAuthPassword, useHmacAuthentication);
IMessagesController messages = client.Messages;
// Perform API call
string bodyValue = @"{
""messages"":[
{
""content"":""Greetings from MessageMedia!"",
""destination_number"":""+61491570156""
}
]
}";
var body = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageMedia.Messages.Models.SendMessagesRequest>(bodyValue);
MessageMedia.Messages.Models.SendMessagesResponse result = messages.CreateSendMessages(body);
Console.WriteLine(result.Messages);
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment