ActiveCampaign / activecampaign-api-nodejs

Node.js wrapper for the ActiveCampaign API
MIT License
39 stars 36 forks source link

Editing a contact #37

Closed plarrea closed 6 years ago

plarrea commented 7 years ago

When editing a contact, lists are mandatory (field p[123]) is there an easy way to edit the contact and keeping its current lists?

Does the the param returned ''listslist" returns all the lits separated by a dash? ( listslist: '1-2' )

On p[123] description there's a warning I don't quite get. WARNING: if overwrite = 1 (which is the default) this call will silently UNSUBSCRIBE this contact from any lists not included in this parameter.

Does that mean I can maybe do something p[1] = listslist to achieve what I need to?

mthommes commented 7 years ago

Hello! I believe you need to use our contact_sync endpoint, which won't overwrite anything by default. Example below that changes only the contact's first name, and leaves all other details (like list subscriptions) alone:

ac.api("contact/sync", {
    email: "test@test.com",
    first_name: "Abc"
}).then(...

If you do want to edit the contact's lists, you can include the "p" parameter with the list ID:

"p[31]": 31

Multiple lists would look like:

"p[31]": 31,
"p[36]": 36

Let us know if that doesn't answer your question! 👍