Created
November 8, 2023 00:17
-
-
Save katydorjee/49a49a0ea18e5a8d517cb10e36e7040a to your computer and use it in GitHub Desktop.
Upsert (add or update) Publication list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updatePublicationList(12345, "003X123456789", "Unsubscribed") | |
function updatePublicationList(listId, subscriberKey, status) { | |
/* | |
status = Unsubscribed or status = Active | |
*/ | |
var subArr = { | |
"SubscriberKey": subscriberKey, | |
"Lists": [] | |
}; | |
var listSub = { | |
"Status": status, | |
"ID": listId, | |
"Action": "Upsert" | |
}; | |
subArr.Lists.push(listSub); | |
var subObj = Subscriber.Init(subscriberKey); | |
var status = subObj.Upsert(subArr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment