Campaign API

This OpenAPI specification outlines three endpoints for managing campaign data. Here’s a summary of each endpoint’s function and details:

  1. /campaign2s - GET

    • Purpose: Lists campaign objects, providing a summary of campaign details.
    • Parameters:
    • datasource (Referenced from parameters).
    • name: (Optional) Filters campaigns by name.
    • page: Sets the page index for paginated results.
    • pageSize: Sets the number of results per page.
    • Response:
    • 200: Returns a JSON object containing:
    • total: Total number of campaigns found.
    • payload: An array of campaign objects, each including _id, name, currentTask (object with task status), and contactCount (total contacts in the campaign).

  2. /campaign2s/{id} - GET

    • Purpose: Retrieves detailed information on a specific campaign by id.
    • Parameters:
    • datasource (Referenced from parameters).
    • id: (Required) Unique identifier of the campaign.
    • Response:
    • 200: Returns a JSON object containing:
    • payload: A single campaign object with:
    • _id: Campaign ID.
    • name: Campaign name.
    • desc: Campaign description.
    • currentTask: Call status.

  3. /campaign2s/{id}/contacts - POST

    • Purpose: Allows modifications to campaign contacts, such as adding, updating, deleting, or shuffling.
    • Parameters:
    • datasource (Referenced from parameters).
    • id: (Required) Campaign ID.
    • Request Body:
    • Contains options for contact modifications:
    • append: Array of contacts to add.
    • update: Object of contacts to update, using IDs as keys.
    • remove: Array of contact IDs or phone numbers to delete.
    • shuffle: Boolean to shuffle contacts, based on append presence.
    • Response:
    • 200: Returns a JSON object containing:
    • payload: The campaign details with properties _id, name, desc, and currentTask.