[SalesForce] REST API for firing a Triggered send

I am trying to use the REST Call to fire a triggered send. My Package is a Server to Server and I am using the V2 for authentication and i get a bearer generated.

When I actually do the POST Call for the Triggered Send Definition I get the following message:

{ "message": "Insufficient privileges to complete this action.", "errorcode": 20002, "documentation": "" }

I am using this documentation as reference:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/messageDefinitionSends.htm

I do a POST CALL to the following endpoint:

https://mc4MYENDPOINT.rest.marketingcloudapis.com/messaging/v1/messageDefinitionSends/key:Trigger Send – Cristina TEST/send

{
"From": {
"Address": "code@exacttarget.com",
"Name": "Code@"
},
"To": {
"Address": "myexample@gmail.com",
"SubscriberKey": "Cristina34646466464664644",
"ContactAttributes": {
"SubscriberAttributes": {
"First Name": "West",
"Booking": "its a test really"

}
}
},
"Options": {
"RequestType": "SYNC"
}
}

If i do either SYNC or ASYNC fails with the same message. I have tried different scope in the auth call but they all fail.

I tried:

"scope": "data_extensions_write"
"scope":"email_write",
"scope": "email_send",

In all of these instances it fail with that same message.

What do i need to change in the auth call to make this work?!

Giulietta

Best Answer

A couple possible issues:

1) Does the Installed Package whose credentials you are using to retrieve your auth token have permission to emails? Read, write, send, all?

As a note, I have seen in the past that updating permissions on Installed Packages does not actually propagate the permissions -- I believe this has been fixed, but it may be worth trying to create a new Installed Package and use its credentials to see if there is any change.

2) Is your MID enable for child BUs, and if so is the BU for which you are retrieving the OAuth token the same as the BU in which the Triggered Send resides?

Make certain you are specifying the proper MID in your OAuth call. An example is found in the last portion, Refresh Access Token, containing the JSON payload and properties required, here:

https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/access-token-app.htm

Related Topic