Update a campaign

Updated

Changes the pacing, schedule, or dialing limits of a campaign.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.
PATCH
https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id}

Before the campaign starts dialing, you can change pacing, schedule, lifecycle, and transport.call_policy. After it starts, you can change only pacing, and other fields fail with CampaignNotEditable. After the campaign is completed, canceled, or failed, you can't change it. You can never change agent_id, transport.type, transport.from, or contacts.

Path Parameters

appidstring
Required

The App ID of your project.

campaign_idstring
Required

The ID of the campaign, returned in campaign_id when you create the campaign.

Header Parameters

If-Matchstring
Required

The ETag value from the most recent response for this resource. If the resource has changed since then, the request fails with 412 and reason PreconditionFailed. Retrieve the resource, apply your change again, and retry with the new ETag.

Request Body

The fields to change. Before the campaign starts dialing, you can change pacing, schedule, lifecycle, and transport.call_policy. After it starts, you can change only pacing.

pacingobject

Changes to the pacing. Pass any of the pacing fields of Create a campaign. Fields you omit keep their saved values.

scheduleImmediate | Scheduled

When the campaign dials. Pass the fields of one schedule mode only.

lifecycleobject

The lifecycle settings for each session the campaign starts. They replace the saved settings, and fields you omit use their defaults.

transportobject

The transport settings that can change. You can't change type or from.

Response Body

The campaign was updated. The response body contains the full campaign.

Response Headers

Agora-Request-Idstring

A unique ID for the request. Include it when you contact Agora support.

ETagstring

The current version of the resource. Pass this value in the If-Match header of your next update or delete request for this resource.

campaign_idstring

The ID of the campaign, a UUID.

namestring

The name of the campaign.

statusstring

The status of the campaign:

  • scheduled: The campaign is waiting for its start time.
  • running: The campaign is dialing, or can dial during its schedule.
  • paused: You paused the campaign.
  • completed: The campaign has finished.
  • canceled: You canceled the campaign.
  • failed: The campaign failed. The details are in failure.
agent_idstring

The ID of the agent that makes the calls.

transportobject
lifecycleobject

When each session the campaign starts ends on its own.

scheduleImmediate | Scheduled

When the campaign dials. Pass the fields of one schedule mode only.

countsobject

The number of contacts in each state. Retrieve the campaign to get current counts.

create_tsinteger

The time the campaign was created, as a Unix timestamp in seconds.

start_tsinteger | null

The time the campaign started dialing, as a Unix timestamp in seconds. null before it starts.

complete_tsinteger | null

The time the campaign finished, as a Unix timestamp in seconds. null until it finishes.

failureobject | null

Details of the failure when status is failed. Otherwise null.

Authorization

This endpoint requires authentication.

Request examples

Example Request
curl -X PATCH 'https://preview.ai.agora.io/conversational-ai/v1/projects/string/campaigns/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "pacing": {    "max_concurrent": 20  }}'

Response example

Example Response
{  "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904",  "name": "string",  "status": "scheduled",  "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",  "transport": {    "type": "telephony",    "from": [      "string"    ],    "call_policy": {      "max_ring_duration_ms": 1,      "max_call_duration_seconds": 1,      "max_silence_duration_ms": 30000,      "end_call": {        "on_user_request": false,        "on_voicemail": false,        "on_ai_assistant": false      }    }  },  "lifecycle": {    "idle_timeout_ms": 30000,    "max_duration_ms": 300000,    "graceful_stop": {      "enabled": false,      "timeout_ms": 30000    }  },  "schedule": {    "mode": "immediate",    "timezone": "string",    "days": [      {        "weekday": "mon",        "ranges": [          {            "start": "string",            "end": "string"          }        ]      }    ]  },  "counts": {    "contacts": 0,    "pending": 0,    "calling": 0,    "completed": 0,    "failed": 0,    "canceled": 0  },  "create_ts": 0,  "start_ts": 0,  "complete_ts": 0,  "failure": {    "code": "string",    "provider": "string",    "message": "string",    "ts": 0  }}