Skip to content

Instantly share code, notes, and snippets.

@phm200
Created October 1, 2018 19:32
Show Gist options
  • Save phm200/b810c8f60334303f4fd1523affa755cd to your computer and use it in GitHub Desktop.
Save phm200/b810c8f60334303f4fd1523affa755cd to your computer and use it in GitHub Desktop.
Connect Contact Attributes API
app.post("/submit-updateAttributes", async (req, res) => {
const contactId = req.body.contactId;
const flagForFollowUpRaw = req.body.flagForFollowUp; // will equal "on" if checked, undefined if false
const flagForFollowUp = flagForFollowUpRaw && flagForFollowUpRaw === "on";
var updateContactAttributesParams = {
InstanceId: connectInstanceId,
InitialContactId: contactId,
Attributes: {
FlaggedForFollowUp: flagForFollowUp.toString()
}
};
var updateContactAttributesPromise = connectClient
.updateContactAttributes(updateContactAttributesParams)
.promise();
var updateContactAttributesResult = await updateContactAttributesPromise;
console.log("result", updateContactAttributesResult);
res.render("submittedUpdateAttributes", {
title: "Contact Attributes Updated"
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment