Created
May 12, 2018 00:57
-
-
Save IbrahimTareq/5d7dcf7c1dd4e04d9c9523b68aecb16c to your computer and use it in GitHub Desktop.
MessageMedia Messages C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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