Dynamic Campaign API: Add Records to a Dynamic Campaign

Updated: 07/03/2024

Objective

Add records to a dynamic campaign using the Dynamic Campaign API.

Applies To

  • Contact Center
  • Dynamic Campaign API

Procedure

Collect the Required Information

  1. Contact Center Cluster
    • You can extract the cluster information once you log in to Agent Workspace or Configuration Manager by looking at the URL in your browser.
    • Use the cluster URL without the b, for example, use https://vcc-eu9.8x8.com not https://vcc-eu9b.8x8.com.
  2. Tenant Name
  3. Data Request Token
    • This can be found in Configuration Manager for Contact Center > Integration > API Token.

  4. Campaign ID of the campaign to add records to.
    • This can be found in Configuration Manager for Contact Center > Campaigns > Campaign Properties.

  5. CRM Customer ID of records to be added to the campaign.
    • This can be found in Agent Workspace > Customers.

API Request

Replace sample text with your data.
POST https://vcc-cluster.8x8.com/api/tstats/campaigns/campaign-id/customers

Authorization

Basic Auth
Username: Tenant Name
Password: Data Request Token

Body to add a single record

[
    {
        "customer-id": "10000160"
    }
]

Body to add a multiple records

[
    {
        "customer-id": "10000160"
    },
    {
        "customer-id": "10000161"
    }
]

Body to add a single record with a schedule

[
    {
        "customer-id": "10000160",
        "schedule-date-time": "2016-08-29T09:00:00.000Z"
    }
]

Body to add a multiple records with a schedule

[
    {
        "customer-id": "10000160",
        "schedule-date-time": "2016-08-29T09:00:00.000Z"
    },
    {
        "customer-id": "10000161",
        "schedule-date-time": "2016-08-29T09:00:00.000Z"
    }
]

Example 

This example adds the customer record id 10000160 to thr dynamic campaign id 521 for a tenant on the eu9 cluster.
The Authorization headers base64 encoded tenantName:DataRequestToken has been redacted.

Request

curl --location --request POST 'https://vcc-eu9.8x8.com/api/tstats/campaigns/521/customers' \
--header 'Authorization: Basic *********************************' \
--header 'Content-Type: application/json' \
--data-raw '[
    {
        "customer-id": "10000160"
    }
]'

Response

Status: 207 Multi-Status (WebDAV) (RFC 4918)
 [
    {
        "customer-id": "10000160",
        "http-status": "200",
        "message": "Campaign customer added."
    }
]

Additional Information

Identifying the Contact Center CRM customer-id

The CRM "customer-id" used in the dynamic campaign API can be located at the top of the customer's record in Agent Workspace and is also known as the "account." In the CRM API (wapi) this id the <accountnum> field.