DMacauely
Member
I'm trying to get our Affiliate Marketing system (PushLap) to talk to the system we use for our online forms, billing, & invoicing (SuiteDash) and have run into a snag.
Here is the workflow that I'm trying to achieve:
Any ideas or better ways to tackle this one?
Here is the workflow that I'm trying to achieve:
- Step 1. Trigger: New Contact created in SuiteDash
- Step 2. Pabbly API requests data from PushLap for all referrals submitted by affiliate program participants
- Step 3. Pabbly compares emails returned from PushLap (that ere submitted by affiliate partners) with the email used to create the new user in SuiteDash
- Step 4. Pabbly then uses a router to determine
- If No match exists, - end workflow (do nothing)
- If Match exists use API (Put) to:
- Push the unique SuiteDash ID (Uid) gathered in Step 1 over to PushLap's external ID field (referredUserExternalId)
- Update referral status within PushLap system from inactive to active
- When the data comes back from via the API, it is in the form of a list of unique labels and their associated values such that the names & emails appear in the format below (see screen shots) with the response getting longer or shorter based on however many affiliate redords PushLap has at the time of the API Call in step 2
- Label: 0 Email, Value: [email protected]
- Label: 1 Email, Value: [email protected]
- Label: 3 Email, Value: [email protected]
- Label: X Email, Value: [email protected]
- I believe there is way to use a JavaScrip for step 3 (such as the code below) to accomplish my desired workflow but I don't think Pabbly allows me to assign the entire API response from step 2 as a variable within the code.
- In all of the Pabbly Code tutorials that I've watched so far (such as this one), they are working with variables that use a static label and and data that changes based on the parameters within the API call.
- In my situation though, I'm using the API to retrieve a list that will vary in lenth as referrals are added and where each person on that list will have a unique label and associated value for their email
- Without the ability to assign the entire API response from step 2 as my variable within my JavaScrip, I'm not sure how to do what I need to do...
- let referrals = {{PushLapAPI.response}}; // Inserted variable for the full referrals object
let newContactEmail = {{SuiteDashTrigger.email}}; // Inserted variable for the new contact's email
let matchFound = false;
let matchedLabel = null;
for (let key in referrals) {
if (
referrals.hasOwnProperty(key) &&
typeof referrals[key] === "string" &&
referrals[key].toLowerCase() === newContactEmail.toLowerCase()
) {
matchFound = true;
matchedLabel = key;
break;
}
}
output = {
matchFound: matchFound,
matchedLabel: matchedLabel
};
return output;
- let referrals = {{PushLapAPI.response}}; // Inserted variable for the full referrals object
- In my situation though, I'm using the API to retrieve a list that will vary in lenth as referrals are added and where each person on that list will have a unique label and associated value for their email
- In all of the Pabbly Code tutorials that I've watched so far (such as this one), they are working with variables that use a static label and and data that changes based on the parameters within the API call.
Any ideas or better ways to tackle this one?