Closed btoone closed 8 years ago
Hey @caspyin, this is what we use to record NPS Scores:
var acTagAdd, contact;
acTagAdd = new require("activecampaign")(ac_api_host, ac_api_key);
acTagAdd.version(1);
acTagAdd.debug = false;
contact = {
'id': contactJSON.acId,
'tags[0]': 'nps_score_' + contactJSON.score,
'tags[1]': 'nps_type_' + contactJSON.scoreType
};
acTagAdd.api("contact/tag/add", contact).then(function (result) {
if (result.success) {
console.log('Bingo!);
} else {
console.log('Failed to add tag to contact in AC');
}
}, function (result) {
console.log('Error with adding tag to contact in AC');
});
Using tags[0]
worked. Thank you very much @molinto
When I pass an array for
tags
the result is a little messed up. Am I using this correctly?