The MessageMedia Messages API provides a number of endpoints for building powerful two-way messaging applications.
Make sure you install the NuGet package into your solution:
PM> Install-Package MessageMedia.SDK.Messages
Alternatively, right-click on your solution and click "Manage NuGet Packages...", then click browse and search for MessageMedia.
Next, register on developers.messagemedia.com to get your API credentials.
Once you've installed the NuGet package, you need to configure your credentials.
// 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"":""YOUR_MOBILE_NUMBER""
}
]
}";
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();