Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transactional email API #32

Open
peternxyz opened this issue Oct 15, 2015 · 5 comments
Open

Transactional email API #32

peternxyz opened this issue Oct 15, 2015 · 5 comments

Comments

@peternxyz
Copy link

Hi there,

Was just wondering if you had any examples on using the Transactional API?

I had a look at the code and it seems like a lot of classes/methods were made internal. Not sure if deliberate or otherwise.

@badmotorfinger
Copy link

Have you had any luck @peternxyz ? It's extremely frustrating when API's are not documented in full.

@peternxyz
Copy link
Author

Yeah. The examples are actually generated when you set up a transactional email inside Campaign Monitor.

@badmotorfinger
Copy link

The sample API call? Yeah that's true but it doesn't demonstrate how to use the .NET library. There are 100's of classes in the library. With some trial and error I could get it going, sure, but documenting it would save people lots of time.

After all, we want to use and promote their service. It only makes sense to keep developers happy.

@samritchie
Copy link

See #40 - it’s taken me too long to work out how to send transactional email via the API. The Transactional API is quite inconsistent with the rest of the API.

@joshnoe
Copy link

joshnoe commented Oct 24, 2017

Here's a sample that sends multiple emails:

public void SendEmails(string emailTemplateId, IEnumerable<UserDTO> users)
{
    var transactional = Authenticate.ByClientApiKey(_apiKey);
    // This is the unique identifier for this smart email
    var smartEmailId = new Guid(emailTemplateId);

    // build up the email
    foreach (var user in users)
    {
        var builder = transactional.MessageBuilder();
                
        builder.To(user.EmailAddress)
            .Data(new Dictionary<string, object>
            {
                { "firstName", user.FirstName },
                { "lastName", user.LastName }
            });

        // Send the email
        builder.Send(smartEmailId);
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants