Rebecca_Jiang | 2024-02-23 03:38:57 UTC | #1
We want to able to programmatically turn off and clear out contact lists for our outbound campaigns so a new ones can be loaded in its place.
I am able to use PUT /api/v2/outbound/campaigns/{campaignId} to turn a campaign off. However, we sometimes get stuck interactions that require the campaign to be forced off. (Not sure why we have stuck interactions in the first place, agent and customer have definitely disconnected and we have time-boxed afterhours work.) This is currently done in Campaign Management in the UI, so I'm wondering are there APIs we could be using the force off campaigns?
Thanks.
minmin68 | 2024-02-23 06:00:04 UTC | #2
You can use below API with the attribute
campaignStatus : "forced_off"
PUT https://apps.mypurecloud.jp/platform/api/v2/outbound/campaigns/{id}
Rebecca_Jiang | 2024-02-23 22:33:57 UTC | #3
I get the following error message when trying to use to update campaignStatus to forced_off.
An attempt was made to update a Campaign in an invalid way. Details: Invalid transition from <ON> to <FORCED_OFF>.
I had tried turning updating campaignStatus to off first. Tring to update campaignStatus from stopping to forced_off also resulted in similar error message.
minmin68 | 2024-02-24 08:00:02 UTC | #4
You need to try to stop the campaign by
campaignStatus: "off"
before force stop.
You can also check the status of the campaign by https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-outbound-messagingcampaigns--messagingCampaignId--diagnostics
Rebecca_Jiang | 2024-02-25 20:11:55 UTC | #5
Yes, I have tried updating campaignStatus to off first. With a stuck interaction in progress, this changes the campaign status to stopping. Updating to a forcedoff status at this point produces a similar error message: An attempt was made to update a Campaign in an invalid way. Details: Invalid transition from <STOPPING> to <FORCEDOFF>.
Nick_Tait | 2024-03-04 01:56:33 UTC | #6
I seem to recall that there are some attributes that need to be included in the PUT, which you might not expect. You've indicated that you can programmatically change the status to "off", so I'd suggest comparing that request body (which succeeds) with one where you're attempting to change the status to "forced_off" (which is failing)? The only things that I'd expect to differ between the two would be the version and the campaignStatus? If you're using the same version for both requests, that could be the problem?
When I've used this API I've preceded it with a GET, to retrieve the current campaign data, then changed the campaignStatus to a new value and then sent the whole structure back in the PUT. That will ensure that the version (and any other required attributes) are set correctly.
Hope this helps?
Nick.
Rebecca_Jiang | 2024-03-04 02:43:25 UTC | #7
We call GET /api/v2/outbound/campaigns/{campaignId} first, change campaignStatus to force_off in response body of this and use that for PUT /api/v2/outbound/campaigns/{campaignId}.
Based on the replies, it sounds like I should be able to do this and getting an error response "Details: Invalid transition from <ON>/<STOPPING> to <FORCED_OFF>." is a bug.
Has anyone else succeeded in forcing off an running campaign with an ongoing interaction?
Thanks.
system | 2024-04-03 02:40:42 UTC | #8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 24828