I'm trying to fire an api event (https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/postEvent.htm) with fuelsdk-node rest (https://github.com/salesforce-marketingcloud/FuelSDK-Node-REST)
This is the code:
var apiTrigger = function(apiKey, email, firstName, lastName) {
var options = {
auth: {
// options you want passed when Fuel Auth is initialized
clientId: 'xxxx',
clientSecret: 'xxxx'
},
origin: 'https://www.exacttargetapis.com',
method: 'POST',
uri: '/interaction/v1/events',
headers: {
"ContactKey":email,
'EventDefinitionKey':apiKey,
"EstablishContactKey": true,
"Data":
{
"first_name":firstName,
"last_name":lastName,
"email":email
}
}
};
var RestClient = new FuelRest(options);
RestClient
.post(options)
.then(function(response) {
console.log(response.body);
})
.catch(function(err) {});
}
I get this error in the response:
{ message: 'Runtime Error. Retry this action. Contact Global Support if the issue persists', errorcode: 30000, documentation: '' }
Has anyone been able to do this with the this node package? If you have a raw code version (with oauth authentication) that would be great.
Just looking to fire an api event to trigger a journey with the payload included using node.js.