[SalesForce] SFMC Rest API and Triggered Send

I hope I'm not over-complicating this, but it seems like a lot of work to send an email out of SFMC.

My goal is to be able to send emails from SFMC based on certain SF field changes. E.g. Lead status changes from X to Y, lead gets a personalized email.

So far I've set up a data extension and template, then a triggered email that references the data extension and email template. Now I can hit this endpoint:

https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/bd3d918e-c22e-e411-ad6f-38eaa791d321/send

with this json:

{
    "To": {
        "subscriberKey": "x@x.com",
        "address": "x@x.com",

    }
}

and I see this error:

[{"messageErrorStatus":"There are required data extension fields missing for the subscriber"}]}

Presumably, I need to reference the extension fields in the JSON, I"m just not sure of the syntax. Any help would be appreciated.

Best Answer

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