This can be accomplished this way...or you can make the fields on your Data Extension "Nullable" if you do not want to pass them as values on your call.
"To": {
"Address": "test@test.com",
"SubscriberKey": "test@test.com",
"ContactAttributes": {
"SubscriberAttributes": {
"DEFieldName1": "VALUEHERE",
"DEFieldName2": "VALUEHERE",
"DEFieldName3": "VALUEHERE"
}
Details can be found here as well:
https://code.exacttarget.com/apis-sdks/rest-api/v1/messaging/messageDefinitionSends.html
I'll assume you're looking at the same account to which you're making this REST call. I've gotten that mixed up before -- using Postman Environments, etc.
If new rows are getting added to the Data Extension, but your email is not getting sent, it's usually an email scripting issue. You can rule that out by swapping out the email in your triggered send definition and publishing the changes. My go-to email for that kind of testing is this:
<html>
<head>
<style>
body, a, input {font-family:sans-serif;}
</style>
</head>
<body style="font-family:sans-serif">
%%[/* Modify to view AMPScript <div style="display:none"> */
var @firstName
set @firstName = AttributeValue("firstName")
/*</div>*/
]%%
Hi, %%=v(@firstName)=%%.<br><br>
<a href="%%profile_center_url%%">Profile/Preference Center</a>
<br><a href="%%subscription_center_url%%">Subscription Center</a>
<br><a href="%%unsub_center_url%%">One-Click Unsubscribe</a>
<p>This email was sent by:
<b>%%Member_Busname%%</b>
<br>%%Member_Addr%%
<br>%%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%%</p>
<custom name="opencounter" type="tracking">
</body>
</html>
Just for a test, I thought I'd submit one myself. I was able to successfully fire off an email with this configuration:
POST /messaging/v1/messageDefinitionSends/key:Trigger_Test/send HTTP/1.1
Host: www.exacttargetapis.com
Authorization: Bearer ZZZZZZZZZZZZZZZZZZZZZ
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: e301c2d2-dffb-5f10-0e4a-0e6033d8294a
{
"To": {
"Address": "adam.spriggs@salesforcemvps.com",
"SubscriberKey": "adam.spriggs@salesforcemvps.com",
"ContactAttributes": {
"SubscriberAttributes": {
"FirstName": "Adam"
}
}
}
}
Response:
{
"requestId": "fd11bca1-7bcb-45d1-9136-cbdd9782ad86",
"responses": [
{
"recipientSendId": "fd11bca1-7bcb-45d1-9136-cbdd9782ad86",
"hasErrors": false,
"messages": [
"Queued"
]
}
]
}
Best Answer
You can achieve this when creating a triggered send definition under Email Studio -> Interactions -> Triggered Emails. There you need to select the All Subscribers list under "Subscriber Management".
Then you can trigger the send using the API and the key of the created triggered send:
You need to supply the data you like to process in the body of the request sent to the api under To.ContactAttributes.SubscriberAttributes:
Then you can use the data in the triggered email using the following AMPscript-code: