Flowboost Community Edition and Marketo APIs
According to the Flowboost websites, the communitity edition can connect to Marketo REST APIs. I get the following response when attempting to do so:
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"RangeError: You may only access Marketo-hosted assets with FlowBoost Community Edition.","trace":["Runtime.UnhandledPromiseRejection: RangeError: You may only access Marketo-hosted assets with FlowBoost Community Edition."," at process.on (/var/runtime/index.js:37:15)"," at process.emit (events.js:198:13)"," at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)"," at process._tickCallback (internal/process/next_tick.js:69:34)"]}
Here is the code I am passing in and I have ran this in on a node.js app and it works fine there. Any help would be appreciated.
const apiData = {
clientId: "#######################",
clientSecret: "#######################"
};
const evtData = JSON.parse({{lead.generic2}});
const request = {
"input": [{
"activityDate": (new Date().toISOString()),
"activityTypeId": 100045,
"attributes": [{
"name": "Event Date",
"value": evtData.date
}, {
"name": "Mobile Phone",
"value": {{lead.Mobile Phone}}
}, {
"name": "Send Live Notifications",
"value": {{lead.generic1:false}}
}, {
"name": "Send Recording Notifications",
"value": true
}],
"leadId": {{Lead.Id}},
"primaryAttributeValue": evtData.title
}]
};
function getAccessToken(cb) {
var url = `https://###-###-###.mktorest.com/identity/oauth/token?client_id=${apiData.clientId}&client_secret=${apiData.clientSecret}&grant_type=client_credentials`;
FBHttp.fetch(url)
.then(r => r.json())
.then(json => { if (typeof cb === "function") cb(json.access_token) });
}
function addCustomActivity(accessToken) {
var url = `https://###-###-###.mktorest.com/rest/v1/activities/external.json`;
FBHttp.fetch(url, {
"method": "POST",
"headers": {
"Authorization": `Bearer ${accessToken}`,
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": JSON.stringify(request)
})
.then(r => r.json())
.then(json => response = JSON.stringify(json, null, 5));
}
var response = null;
getAccessToken(addCustomActivity);