3

I have created a simple Email Template in ExactTarget which has an ID e.g. 19712732.

I'd like to use this email template to send emails using the WebService API (C# code) of Exact Target: https://webservice.exacttarget.com/Service.asmx?

The wiki documentation is here: http://wiki.memberlandingpages.com/

How would that be possible? I went through the docs but couldn't find anything relevant yet.

Also, I'd like to be able to set some contents of the Email Template using the API. For example, perhaps I can add a key/property like {CustomHtml1} then set the value of this key/property in my C# code?

Thanks,

The Light
  • 26,341
  • 62
  • 176
  • 258

4 Answers4

6

Chris is right, you will want to utilize a combination of Data Extensions and Triggered Sends.

On a high level, this is what you will want to do:

  1. Create a Data Extension from the Triggered Send template within the ExactTarget UI. Add any additional fields in this Data Extension that you will use in your template (for example, the CustomHTML1 field)
  2. Set up a Triggered Send Definition within the UI as well. Choose the appropriate Email that you will be sending and select the Data Extension from step 1. Note: ExactTarget uses the term "Email" the same way that most people use "Email Template". An Email can contain Personalization Strings (Merge Fields).
  3. Be sure to start your Triggered Send Definition.
  4. Using the API, you can now send an email using your Triggered Send Definition.

In order to pass in the custom data (e.g. CustomHTML1), you will want to add that name/value pair as a Subscriber attribute in the API call:

ETServiceClient.ETClient.Attribute attr = new ETServiceClient.ETClient.Attribute();
attr.Name = "CustomHTML1";
attr.Value = "Your custom merge field value";
subscriber.Attributes = new ETServiceClient.ETClient.Attribute[] { attr };

The above code should be added in to to the linked code sample as appropriate, it is there only to provide information specific to setting up the custom attribute.

As far as I know, there aren't any single references that spell out this process, however I have found it to be the most effective.

(Also of note, all of the API articles have recently been moved to code.exacttarget.com, so the wiki is going to be somewhat limited use in this situation)

Good luck!

EDIT: I wanted to also clarify that any steps above that call for configuration via the UI can also be done through the API. However, since they are one-time configuration elements, it is typically easier to just log in once, set it up, and focus API development efforts on the actual email sends.

EDIT: For the sake of completeness, it should be noted that it is not necessary to use Data Extensions for this purpose. It is technically possible to have an attribute on the subscriber which serves the same purpose and, if there are situations where Data Extensions won't work, this may be the better option.

I would recommend the DE route if at all possible in this case because it physically separates send-specific data from the subscriber itself. That way, information that may only be relevant for the specific send is not "permanently" stored on the Subscriber.

zashu
  • 747
  • 1
  • 7
  • 22
  • I believe this is the right answer, but just want to point out you don't necessarily _have_ to use Data Extensions. I post this as a last resort alternative because we wanted to do something similar but for some reason couldn't make Data Extensions work for us. Possibly because the documentation and support on it was very limited at the time, but there may have been some technical obstacle. It is ugly, but we created custom subscriber attributes for fields such as "CustomHtml1". Then you can set it as shown above and easily pull it into your e-mail template. – xr280xr Jun 15 '12 at 15:03
  • 1
    @xr280xr: Definitely true - it certainly is possible to do triggered sends directly to a subscriber list, setting the Custom HTML as an attribute, and merging it directly in the email. I've found that, technically, the field doesn't even have to be specified as an attribute for it to work. I like to go with DEs because in my experience (and with ExactTarget, everyone's is definitely a little different ;) ) there were fewer complications. – zashu Jun 15 '12 at 18:42
0

I found Razor engine quit convenient to do such things, please look at http://kazimanzurrashid.com/posts/use-razor-for-email-template-outside-asp-dot-net-mvc

alexsuslin
  • 4,130
  • 1
  • 20
  • 30
0

I think what you are looking for is called Data Extensions.

The following link seems to show how to do this; but having never used them before I'm not 100% on that.

http://docs.code.exacttarget.com/020_Web_Service_Guide/Technical_Articles/Creating_an_Email_Send_Definition_with_Dynamic_Content_Using_the_Web_Service_API

Also review this: http://docs.code.exacttarget.com/020_Web_Service_Guide/Simple_Development_Scenarios/Send_an_Email_to_a_Data_Extension_using_an_Email_Send_Definition

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • Can't you access http://wiki.memberlandingpages.com/? I haven't found anything helpful so far. – The Light Feb 21 '12 at 15:13
  • thanks but data extension objects are different. They are just like tables stored on ExactTarget containing some data which can be passed to an email template whereas I'd need to pass my own contents to it. – The Light Feb 21 '12 at 15:43
0

I am pretty sure you must have looked at this. However since it does not suggest anything regarding templates, I would also try to look at this (at the end "Create an Email Based on a Template") and this and use reflector Fiddler (sorry got mixed up ! what can I say !) to see what web-service calls are they firing.

My guess is that there is a email and templates are not really related. It is the client's (in default case, the web client's) responsibility to create the body of the email by looking at the template (which in turn might have some other web service call to get)

  • That's the silly naming from Exact Target from what I have understood. They call an "Email Template" an Email when working with the API code! (in practice Email Template + Bound Data ==> Email) – The Light Feb 21 '12 at 16:51
  • Agreed, but that convention is for the business users who in their view don't really understand or be made to understand the concept of templates. =| –  Feb 21 '12 at 17:01