We've had a process in place for a while that (should) add new Outbound Call recipients to a ContactList, initiate the Campaign dialing, and clear the list out at the end of the day. I've been made aware of a few instances where the calls to clear() the ContactList have not been successful, and the previous Contacts' details remain, and the new ones are appended. This results in folks being called multiple days in a row, when we may have successfully made contact already and we don't need to annoy them (and we'd prefer not to).
Looking at today's campaigns, I found one that has completed, and I generated a request to reset that list to double-check that the process can work, but I'm getting the message "Contact list cannot be cleared of it's(sic) contacts while it is still on a running campaign."
Would a PUT request to v2.outbound.campaigns with a campaignStatus of 'off' be the way to go about stopping the campaign, followed by request(s) to verify the 'stopped' status?
(as an aside, when I tried turning campaigns off from the Admin interface they ended up hung, and I had to submit a ticket to have them manually shut off.)
A well-formed application should always use real-time notifications to be informed of events as they happen. While it is possible to poll, it's against best practices, it's less efficient, and will add unnecessary delay to your application.
Unfortunately, I don't know of any way yet to create a listener in Salesforce Apex, though perhaps it is brand new and/or coming soon (Salesforce Connect); poll, update if necessary, repeat poll looks to be the only way to go.
Researching to see whether Connect might be a way forward..
And... based on PureCloud and the OData protocol thread from a few years back (which doesn't appear to have any recent updates), using Salesforce Connect is not currently an option.
Checking the campaignStatus of our current campaigns, I am seeing values of either 'on' or 'complete', though all of them currently are at 100% in terms of #s dialed. For a campaign that was 'on', I sent a PUT request to set campaignStatus = 'off'. The campaign is now in a state of 'stopping'.
Is there any way to estimate how long it takes to get to 'off', based on the size of the contactList, for example? I ran into a problem from the Admin page of using the UI controls to turn two campaigns 'off' and they remained locked in the 'stopping' state for several days, requiring a ticket to have it corrected.
There's not a specific amount of time a campaign will take to stop (which is why notifications are preferred over polling). If you're seeing campaigns getting stuck in the stopping state, please continue to work with PureCloud Care to investigate those occurrences; that is abnormal behavior.
All things being equal, requesting 'off' from a campaignStatus of 'on' should be a legitimate request, though? I shouldn't need to wait for 'complete'..?
requesting 'off' from a campaignStatus of 'on' should be a legitimate request,
Yes, that's a legitimate request
I shouldn't need to wait for 'complete'..?
No, you must wait for the campaign to be in a stopped state before modifying the call list. If you don't, you run the risk of having race conditions and aberrant behavior because the campaign can continue to modify the call list until it's fully stopped.
Understood; this time I was only asking about when it was legitimate to set the campaignStatus to 'off'.
This is where we've been getting hung up, when the campaign runs for an unexpectedly long time, the request to reset the contactList fails, and we end up appending new contactList entries instead of replacing them.
There does appear to be an issue w/ stopping the campaign from my end, though - both through the UI and programmatically, we're getting hung up on 'stopping' -- we will be submitting a ticket through the standard channel.