1973 Ltd

Email dispatch from Eloqua using the REST API (Eloqua 9).

By on September 23rd In Development
Using the Eloqua API to CC emails to contacts

A problem we encountered a little while back was attempting to CC people on emails sent to a list of contacts.

We were looking to send a dynamic email with custom content (sales targets with some conditional paragraphs) to a list of contacts, with a copy of each email also going to a sales manager so that everyone had a copy of the targets contained in the email. Eloqua doesn’t allow an email to be CC’d, and with the emails containing data specific to each contact also needing to go to the sales manager, this presented us with a challenge.

After reading some of the information on Topliners, the Eloqua Community, and particularly some of the excellent contributions by Fred Sakr, we found our answer. The sends would all be created using PHP and a MySQL database, then created dynamically in Eloqua and sent out. Below is an example of how we did a single send with a CC, but this can easily be built out into a loop to cover a list of contacts. It is based on the request script written by Fred, found on GitHub.

Firstly, we establish connection to our Eloqua instance, using our normal login credentials.

We define and initialise three objects to hold our data.

Initialise two of the objects, then later we initiliase the deployment object for each individual send.

So now the email can be assembled in HTML using PHP based on our requirements for the current contact, and saved as a variable called $email_content. All images would be remotely linked but URL’s can go in normally, eg http://www.google.co.uk, they will be tracked using the setting ‘isTracked’ as below.

We then put it together in the objects.

To find the header id, go to Email Details, and open up the header as if to edit it. In the URL bar you’ll see something like %26EmailHeaderID%3D558&Title= near the end of the URL, the ID for mine is 558. The %3D before the number is just a URL encoded equals sign, so the ID is after it.

The footer can be found the same way, looking for %26EmailFooterID%3D40&Title= in the URL. In this case my footer ID is 40.

The find the folder ID, make the folder, then just hover over it and you should see the function that’s going to be triggered in your status bar, the folder id is the number in the brackets of ‘EmailCampaign_Edit(XXX)’.

NOTE : I will be updating this very shortly with how to acquire all the necessary ID’s in Eloqua 10, along with any other changes to the process.

So we now have an object containing everything we need to create the email in Eloqua.

To create the object, and print it out, you use.

It’s important to return a response at this point even if you don’t write it to screen because you need the newly created email’s ID. So after the response use the following to update your email object with the new ID :

The email is now created in Eloqua and the email object contains all thats needed to use in the deployment (the previous email settings like footer, header etc won’t affect the deployment now the email has been created so they can be left in).

To send it to someone, you need to have the users Eloqua contact ID (you can’t just send to an email, they need to be an existing subscribed contact).

We have a script here that looks up users contact ID’s based on their email, but for simplicity we’ll just assume that its an individual with the contact ID ‘CSEAG000012345678’. Before you can do the send the ID needs to be formatted slightly differently, so just remove the ‘CSEAG’, and leave the rest.

Now we can add some variables into our deployment object.

Send it.

Your email has now been sent out as a quicksend to the first contact, so to send to the second :

A little bit of tidying up.

And thats it, a quite unusual problem solved.

Comments  -  0 Comments

There are no comments yet.

Follow our blog!

Recent Posts

Categories

Our latest tweets

Archives

Authors