I have seen this one (pretty old): API cancel contact campaign and also tried to use the XML-RPC API’s Campaignee table to do the same (I also saw in post here that this table was used for the older campaign implementation, so it returns no data).
My use case is removing a Contact from all active campaign sequences based on a tag application. I see where I could get pretty close using Keap REST API and Keap REST API, but I’m not finding where the campaign/sequence relationship to a single Contact may be found in the API.
I could also more-or-less attempt to brute force it by iterating through all of the campaigns & sequences and attempt to remove the contact from each of them but that’s definitely not ideal.
I’m hoping I’m just missing it or that it’s one of the optional_properties that’s not listed in the Contact model (Keap REST API). I’d appreciate if anyone could point me in the right direction.
We do have improvements to campaigns planned for future v2 work, but in the meantime you can use your same access token to retrieve the information from the legacy XMLRPC API via a DataService query of Campaignee
The XML-RPC API Campaign tables refer to the Follow-up Sequences (Marketing - Legacy - Follow-up sequences) and not the Campaigns listed in the Campaign Builder, which is confusingly named.
I have taken a look at the API Documentation and I believe that you should be able to do this.
So looping through all the Campaign and Sequences you will need to run the API function each time to make sure the Contact has gone. If you have a log of Campaigns and Sequences then that would equal one API call for each Sequence.
Looking at the Campaigns “sequences” response, there is the “active_contact_count” property. What you could do here is to filter out the Sequences that have Zero Active Contacts. That will help reduce the need of having to go through all the Campaign Sequences. There is other properties you can filter on as well if you need to reduce it further.
Regarding the Campaignee table, they’re not using the Legacy ones so, unfortunately, that one won’t do it for us. In the meantime, I’ll use the active_contact_count property to reduce my API calls as Pav suggested. Thanks again!