Omnix

CampaignRpc

This endpoint group provides RPC methods for managing campaigns, including listing, creating, updating, deleting, scheduling, launching, cancelling, and resolving reference data for campaign-related forms.

Endpoints

POST /api/rpc (Method: CampaignRpc.getData)

  • Description: Returns campaign data using the provided filter, sort, and pagination options.

  • Request Body:

    {
      "method": "CampaignRpc.getData",
      "params": {
        "filter": {},
        "sort": {},
        "page": 1,
        "pageSize": 20
      }
    }
  • Parameters:

    Name Type Required Description
    filter Any No Optional query filter passed through to the campaign service.
    sort Any No Optional sort specification passed through to the campaign service.
    page Number No Optional page number for paginated results.
    pageSize Number No Optional page size for paginated results.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.getCampaigns(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.getData",
        "params": {
          "filter": {},
          "sort": {},
          "page": 1,
          "pageSize": 20
        }
      }'

POST /api/rpc (Method: CampaignRpc.create)

  • Description: Creates a new campaign.

  • Request Body:

    {
      "method": "CampaignRpc.create",
      "params": {
        "name": "Spring Campaign",
        "type": "message",
        "audienceId": "audience-id",
        "templateId": "template-id",
        "channelConfigId": "channel-config-id",
        "brandingKitId": "branding-kit-id",
        "trackInInbox": true,
        "voiceOptions": {
          "workflowId": "workflow-id",
          "concurrency": 10,
          "retries": 0,
          "retryInterval": 60
        },
        "scheduleType": "now",
        "scheduledAt": null
      }
    }
  • Parameters:

    Name Type Required Description
    name String Yes Campaign name. Must be a non-empty string.
    type String No Campaign type. Allowed values are message and voice. Defaults to message.
    audienceId String No Audience reference for message campaigns. May be omitted or null.
    templateId String No Template reference for message campaigns. May be omitted or null.
    channelConfigId String No Channel configuration reference for message campaigns. May be omitted or null.
    brandingKitId String No Branding kit reference. May be omitted or null.
    trackInInbox Boolean No Whether sent messages should create or update Unified Inbox conversations. Defaults to true.
    voiceOptions Object No Optional voice campaign settings. When provided, workflowId is required and concurrency, retries, and retryInterval have schema defaults.
    scheduleType String No Scheduling mode. Allowed values are now and later. Defaults to now.
    scheduledAt Date No Optional scheduled execution time.
    scheduleId String No Optional schedule task reference.
    stats Object No Not accepted by this method. The create schema omits stats.
    _id String No Not accepted by this method. The create schema omits _id.
    subscriptionId String No Not accepted by this method. The create schema omits subscriptionId.
    status String No Not accepted by this method. The create schema omits status.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.createCampaign(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.create",
        "params": {
          "name": "Spring Campaign",
          "type": "message"
        }
      }'

POST /api/rpc (Method: CampaignRpc.update)

  • Description: Updates an existing campaign by _id.

  • Request Body:

    {
      "method": "CampaignRpc.update",
      "params": {
        "_id": "campaign-id",
        "name": "Updated Campaign Name"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Campaign identifier.
    name String No Campaign name.
    type String No Campaign type. Allowed values are message and voice.
    audienceId String No Audience reference.
    templateId String No Template reference.
    channelConfigId String No Channel configuration reference.
    brandingKitId String No Branding kit reference.
    trackInInbox Boolean No Whether message delivery should create or update Unified Inbox conversations.
    voiceOptions Object No Optional voice campaign settings.
    status String No Campaign status. Allowed values are draft, scheduled, running, completed, failed, and cancelled.
    scheduleType String No Scheduling mode. Allowed values are now and later.
    scheduledAt Date No Scheduled execution time.
    scheduleId String No Schedule task identifier.
    stats Object No Campaign statistics object when accepted by the underlying partial schema.
    createdAt Date No Creation timestamp when accepted by the underlying partial schema.
    updatedAt Date No Update timestamp when accepted by the underlying partial schema.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.updateCampaign(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.update",
        "params": {
          "_id": "campaign-id",
          "name": "Updated Campaign Name"
        }
      }'

POST /api/rpc (Method: CampaignRpc.delete)

  • Description: Deletes a campaign by _id.

  • Request Body:

    {
      "method": "CampaignRpc.delete",
      "params": {
        "_id": "campaign-id"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Campaign identifier.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.deleteCampaign(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.delete",
        "params": {
          "_id": "campaign-id"
        }
      }'

POST /api/rpc (Method: CampaignRpc.launch)

  • Description: Launches a campaign. The decorator describes this method as intended for internal scheduler use.

  • Request Body:

    {
      "method": "CampaignRpc.launch",
      "params": {
        "campaignId": "campaign-id"
      }
    }
  • Parameters:

    Name Type Required Description
    campaignId String Yes Campaign identifier.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.launchCampaign(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.launch",
        "params": {
          "campaignId": "campaign-id"
        }
      }'

POST /api/rpc (Method: CampaignRpc.schedule)

  • Description: Schedules a campaign that is currently in draft or cancelled state.

  • Request Body:

    {
      "method": "CampaignRpc.schedule",
      "params": {
        "campaignId": "campaign-id"
      }
    }
  • Parameters:

    Name Type Required Description
    campaignId String Yes Campaign identifier.
  • Response:

    {
      "success": true,
      "data": {
        "..."
      }
    }

    The exact response shape is determined by CampaignService.scheduleCampaign(...).

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "CampaignRpc.schedule",
        "params": {
          "campaignId": "campaign-id"
        }
      }'

POST /api/rpc (Method: `