salesforce-marketingcloud / FuelSDK-Python

FuelSDK for python
Other
126 stars 193 forks source link

Properly created TriggeredSend erroring with 18002: The Triggered Send Object must contain the Triggered Send ID or the Customer Key #91

Closed hickeroar closed 6 years ago

hickeroar commented 6 years ago

I'm following the example here: https://github.com/salesforce-marketingcloud/FuelSDK-Python/blob/master/objsamples/sample_triggeredsend.py under the # Send an email with TriggeredSend heading.

I know I have a valid Customer Key, but it consistently returns this error. Snippet:

        client = FuelSDK.ET_Client(
            debug=settings.DEBUG,
            params={
                'clientid': settings.get('API_CLIENT_ID'),
                'clientsecret': settings.get('API_CLIENT_SECRET'),
            }
        )

        triggered_send = FuelSDK.ET_TriggeredSend()
        triggered_send.auth_stub = client
        triggered_send.props = {'CustomerKey': email_code}
        triggered_send.subscribers = [{'EmailAddress': email, 'SubscriberKey': subscriber_id}]
        triggered_send.attributes = variables
        result = triggered_send.send()

Here's a quick and dirty JSON representation of what I'm getting back:

{
    "results": [
        {
            "status_code": "Error",
            "status_message": "The Triggered Send Object must contain the Triggered Send ID or the Customer Key",
            "ordinal_id": 0,
            "error_core": 18002,
            "new_id": 0
        }
    ],
    "code": 200,
    "status": false,
    "message": "Error",
    "request_id": "<snip>"
}
hickeroar commented 6 years ago

Closing this. Right after I opened it, I realized I had a bug and my email_code variable was arriving nulled. Oops. Only took me 25 minutes to figure that out. :-P