An Infobip channel provider for the Transmitly library.
$ dotnet add package Transmitly.ChannelProvider.InfobipA Transmitly channel provider that enables sending Email and SMS communications with Infobip.
To use the Infobip channel provider, first install the NuGet package:
dotnet add package Transmitly.ChannelProvider.Infobip
Then add the channel provider using AddInfobipSupport():
using Transmitly;
...
var communicationClient = new CommunicationsClientBuilder()
.AddInfobipSupport(options =>
{
options.BasePath = "https://base.infobip.com";
options.ApiKey = "key";
options.ApiKeyPrefix = "App";
})
.AddPipeline("first-pipeline", pipeline =>
{
//AddEmail is a channel that is core to the Transmitly library.
//AsIdentityAddress() is also a convenience method that helps us create an identity address
//Identity addresses can be anything, email, phone, or even a device/app Id for push notifications!
pipeline.AddEmail("from@mydomain.com".AsIdentityAddress("Test Display Name"), email =>
{
//Transmitly is a bit different. All of our content is supported by templates out of the box.
//There are multiple types of templates to get you started. You can even create templates
//specific to certain cultures!
email.Subject.AddStringTemplate("Hey, Check out Transmit.ly!");
email.HtmlBody.AddStringTemplate("Hey, check out this cool new library for managing app communications. <a href=\"https://transmit.ly\">");
email.TextBody.AddStringTemplate("Hey, check out this cool new library. https://transmitly.ly");
});
//AddSms is a channel that is core to the Transmitly library.
pipeline.AddSms(sms =>
{
sms.Message.AddStringTemplate("Check out Transmit.ly!");
});
});
//Dispatch (send) the transsactional messages to our friend Joe (joe@mydomain.com & 888-555-1234) using our configured InfoBip account with our "first-pipeline" pipeline.
var result = await communicationsClient.DispatchAsync("first-pipeline", ["joe@mydomain.com".AsIdentityAddress("Joe"),"+18885551234".AsIdentityAddress()], new { });
Copyright © Code Impressions, LLC. This open-source project is sponsored and maintained by Code Impressions and is licensed under the Apache License, Version 2.0.