Reputation: 27011
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,
Upvotes: 3
Views: 4088
Reputation: 777
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:
CustomHTML1
field)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.
Upvotes: 6
Reputation:
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)
Upvotes: 0
Reputation: 88044
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.
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
Upvotes: 0
Reputation: 4225
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
Upvotes: 0