Original Message:
Sent: 08-11-2023 10:59
From: Jan Heinonen
Subject: Campaign Start/Stop from Restful API
Hi Devanand,
I've only done this through a custom application but it should work just as well from a data action.
You shouldn't need any TranslationMap for this, but your Output Contract would need to match the result you're expecting.
Unless you have several campaigns you need to control the simple solution would be to just have a data action with the PUT data static except campaignStatus and version.
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 08-10-2023 16:05
From: Devanand Gawande
Subject: Campaign Start/Stop from Restful API
Hello Jan,
I have similar problem, could you please help me with the TranslationMap syntax to collect all the API response in one output variable. so that I can pass the details in a variable for my next data action(most probably to start and stop the campaign remotely(using PUT API request).
For example If the existing response is showing the campaign status is "off" and If I am going to set it "on" as a API input.
In this case, system will consider which input, the one which is inside the body of the JSON data or the one which we are passing as a external Input using Input_Contract variable.
Thanks a lot.
------------------------------
Devanand Gawande
Capgemini Brasil S.A.
Original Message:
Sent: 02-13-2023 07:52
From: Jan Heinonen
Subject: Campaign Start/Stop from Restful API
Well, this was an interesting one. Seems you need to send in the whole configuration with the status change.
I pulled the configuration with GET /api/v2/outbound/campaigns/{campaignId}
Removed the selfUri entries and used PUT to change the campaignStatus.
With this I could change status between on and off (using the correct version value)
{ "id": "07f00b5b-2ecf-4c11-861a-9c356922d298", "name": "Lab Dialer", "version": 2, "contactList": { "id": "36ad6a5c-54ca-4738-bbc7-cb77eced36c6", "name": "Lab Lista" }, "queue": { "id": "5eca9a9d-51f4-4d52-8b20-514ce42588c0", "name": "Lab" }, "dialingMode": "preview", "script": { "id": "476c2b71-7429-11e4-9a5b-3f91746bffa3", "name": "Default Outbound Script" }, "campaignStatus": "off", "phoneColumns": [ { "columnName": "tele", "type": "Cell" } ], "abandonRate": 5, "dncLists": [], "callerName": "Dialer", "callerAddress": "+46", "outboundLineCount": 0, "ruleSets": [], "skipPreviewDisabled": false, "previewTimeOutSeconds": 0, "singleNumberPreview": false, "alwaysRunning": false, "noAnswerTimeout": 30, "priority": 5, "contactListFilters": [], "division": { "id": "05633e2c-20ec-4242-ae98-cc3304b80256", "name": "Lab" }, "dynamicContactQueueingSettings": { "sort": false }}
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 02-13-2023 06:22
From: Rakesh Jha
Subject: Campaign Start/Stop from Restful API
Seems name required
------------------------------
Rakesh Jha
Servion Global Solutions
Original Message:
Sent: 02-13-2023 06:21
From: Rakesh Jha
Subject: Campaign Start/Stop from Restful API
PUT /api/v2/outbound/campaigns/bd3997be-2c60-4aad-984f-68a3e2f9274d HTTP/1.1
{"version":88,"campaignStatus":"off"}
Response-
{ "message": "Name is required.", "code": "name.required", "status": 400, "contextId": "78a43d7e-80f5-486b-9433-59d1ddf76875", "details": [], "errors": [] }
------------------------------
Rakesh Jha
Servion Global Solutions
Original Message:
Sent: 02-13-2023 06:04
From: Jan Heinonen
Subject: Campaign Start/Stop from Restful API
try without "name":"Campaign"
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 02-13-2023 05:49
From: Rakesh Jha
Subject: Campaign Start/Stop from Restful API
Hi Jan,
Thanks for response. Tried below -
PUT /api/v2/outbound/campaigns/bd3997be-2c60-4aad-984f-68a3e2f9274d HTTP/1.1 {"version":88,"name":"Campaign","campaignStatus":"off"}
But getting same error-
{ "message": "An attempt was made to update a Campaign in an invalid way. Details: A campaign cannot be updated while running", "code": "invalid.update.campaign.active", "status": 400, "messageWithParams": "An attempt was made to update a {entity} in an invalid way. Details: {INVALID_UPDATE_CAMPAIGN_ACTIVE}", "messageParams": { "INVALID_UPDATE_CAMPAIGN_ACTIVE": "A campaign cannot be updated while running", "entity": "Campaign" }, "contextId": "45755593-55b1-4cf1-8243-9eaef121c45f", "details": [], "errors": [] }
------------------------------
Rakesh Jha
Servion Global Solutions
Original Message:
Sent: 02-13-2023 05:39
From: Jan Heinonen
Subject: Campaign Start/Stop from Restful API
Try sending only campaignStatus and version, it seems to require the current version when doing updates so you'll need to fetch that first.
/api/v2/outbound/campaigns/{campaignId}
{
"campaignStatus": "off",
"version": 0
}
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 02-13-2023 04:07
From: Rakesh Jha
Subject: Campaign Start/Stop from Restful API
Thanks Blake. I tried to use
/api/v2/outbound/campaigns/{campaignId}
{
"campaignStatus": "off",
"name": "Campaign",
"dialingMode": "progressive"
}
But getting below error-
{ "message": "An attempt was made to update a Campaign in an invalid way. Details: A campaign cannot be updated while running", "code": "invalid.update.campaign.active", "status": 400, "messageWithParams": "An attempt was made to update a {entity} in an invalid way. Details: {INVALID_UPDATE_CAMPAIGN_ACTIVE}", "messageParams": { "INVALID_UPDATE_CAMPAIGN_ACTIVE": "A campaign cannot be updated while running", "entity": "Campaign" }, "contextId": "6b2eb42f-ccdc-4f1a-8512-da50ab0a0af6", "details": [], "errors": [] }
------------------------------
Rakesh Jha
Servion Global Solutions
Original Message:
Sent: 02-08-2023 15:44
From: Blake Anderson
Subject: Campaign Start/Stop from Restful API
Jan is correct, you can start and stop campaigns with: PUT /api/v2/outbound/campaigns/{campaignId}.... the field to update is campaignStatus.
campaignStatus
(string) The current status of the Campaign. A Campaign may be turned 'on' or 'off'. Required for updates.Valid values: on, stopping, off, complete, invalid, forced_off, forced_stopping.
------------------------------
Blake Anderson | Sr. Telecom Engineer
BEST BUY CO., INC.
Original Message:
Sent: 02-08-2023 15:38
From: Jan Heinonen
Subject: Campaign Start/Stop from Restful API
I haven't tried it my self but PUT /api/v2/outbound/campaigns/{campaignId} should allow you to change the status of the campaign.
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 02-08-2023 00:03
From: Rakesh Jha
Subject: Campaign Start/Stop from Restful API
Hello,
We are looking to use restful API to start and stop campaign. Did try to see developer portal but didn't see any specific API available for running/stopping the campaign.
Please let me know if it's possible to perform campaign start/stop from RestAPI.
#Outbound
------------------------------
Rakesh Jha
Servion Global Solutions
------------------------------