Flowboost Community Edition and Marketo APIs | Community
Skip to main content
Chris_Francis
Level 3
June 24, 2022
Solved

Flowboost Community Edition and Marketo APIs

  • June 24, 2022
  • 2 replies
  • 5360 views

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);
Best answer by SanfordWhiteman

According to the Flowboost websites, the communitity edition can connect to Marketo REST APIs. 

Yep, it certainly can. I'm working on such a project w/a Community key as we speak.

 

FlowBoost determines whether you're connecting to Marketo instance by seeing if the domain exists and either is a CNAME for a Marketo property or ends with .mktorest.com. So the outcome depends on the part of your code that's obfuscated, the

###-###-###.mktorest.com

2 replies

Chris_Francis
Level 3
June 24, 2022

@sanfordwhiteman Tagging you since you are the expert in this field 🙂

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
June 24, 2022

According to the Flowboost websites, the communitity edition can connect to Marketo REST APIs. 

Yep, it certainly can. I'm working on such a project w/a Community key as we speak.

 

FlowBoost determines whether you're connecting to Marketo instance by seeing if the domain exists and either is a CNAME for a Marketo property or ends with .mktorest.com. So the outcome depends on the part of your code that's obfuscated, the

###-###-###.mktorest.com
Chris_Francis
Level 3
June 25, 2022

well the entire url https://975-FPO-828.mktorest.com which is our marketo instance and should meet all of the criteria listed and yet I still get the error posted

SanfordWhiteman
Level 10
June 25, 2022

Are you using v20+, preferably the latest v21?

 

https://api.teknkl.com/flowboost/v21/run?authoringEnv=pro

 

Older versions restricted Marketo REST connections to Standard keys only. I think we changed that in v20 so Community keys work, too.