1

I'm new to Salesforce and I've been trying to use the messageDefinitionSends endpoint to send a single email message. I started by creating an email message, a data extension and a triggered send. I saved, published and started the triggered send.

Then, using Postman, I requested an access token via https://myorgsubdomain.auth.marketingcloudapis.com/v2/token and got the following:

{
    "access_token": "sometoken",
    "token_type": "Bearer",
    "expires_in": 1079,
    "scope": "email_read email_send email_write ...", (and others, removed for simplicity)
    "soap_instance_url": "https://myorgsubdomain.soap.marketingcloudapis.com/",
    "rest_instance_url": "https://myorgsubdomain.rest.marketingcloudapis.com/"
}

Then, I copied the token and used in the following request

POST /messaging/v1/messageDefinitionSends/key:123456/send HTTP/1.1
Host: myorgsubdomain.rest.marketingcloudapis.com
Content-Type: application/json
Authorization: Bearer sometoken

{
    "To": {
        "Address": "me@my.org",
        "SubscriberKey": "me@my.org"
    },
    "Options": {
        "RequestType": "ASYNC"
    }
}

where 123456 is the external key for the triggered send I created previously. The recipient SubscriberKey equals the destination email address for this specific case (I confirmed via the SOAP API). When I POST the request I receive an empty response body with the HTTP response 404. I've also tried using the endpoint https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/key:123456/send but I either receive a 404 or 401 response.

I'm struggling with this issue for a while now and I have no idea what might be wrong. Any suggestions?

Thanks.

  • I would verify the key/id of your Triggered Send Definition. The only time I receive a 404 is when this is incorrect. – Gortonington Aug 9 at 12:50
  • @Gortonington I've checked the external key of the Triggered Send Definition countless times. I've even tried changing it a few times (I paused, edited, published and restarted the Definition) and the result is still the same. It matches the one I see in the column "External Key". – pbucho Aug 9 at 13:29
  • Is the token you are using associated with the same BU as your TSD? Sorry for the dumb questions, I just feel that without some platform issue (require SFMC support), that something small is likely to be the culprit of your error. – Gortonington Aug 9 at 13:57
  • I believe so. I only have access to the Marketing Cloud interface, and the people who provided me with the client ID and secret said it was for my BU. I confirmed that the subdomain for the authentication matched the one they sent me, and the authentication request has always been successful. I've tried a SOAP request using the same token to get a SubscriberKey and it returned a valid response. – pbucho Aug 9 at 14:48
  • have you tried a retrieve or execute to the Triggered Send Object in SOAP to verify if it is the endpoint or not? – Gortonington Aug 9 at 19:08
0

As per EazyE's comment, I needed to add the parameter account_id to the token request, using as value the MID of my Business Unit. Then, I used the token in the messageDefinitionSends/send method and the response returned was Queued and I checked that the TSD had a message in queue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.