Omnix

ChannelManagerRpc

The ChannelManagerRpc endpoint group provides RPC methods for managing channel configurations, preparing provider setup flows, listing workflow references, and retrieving the public web chat widget configuration. It also exposes data retrieval with workflow-name enrichment for channel records.

Endpoints

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

  • Description: Retrieves channel configurations for the current subscription and enriches any linked workflow IDs with workflow names.
  • Request Body:
{
  "method": "ChannelManagerRpc.getData",
  "params": {
    "filter": {},
    "sort": {},
    "page": 1,
    "pageSize": 100
  }
}
  • Parameters:
Name Type Required Description
filter Object No Optional query filter object. Any properties are passed through.
sort Object No Optional sort object. If omitted, results default to descending createdAt.
page Number No Page number for pagination. Defaults to 1.
pageSize Number No Page size for pagination. Defaults to 100.
  • Response:
{
  "success": true,
  "data": {
    "data": [
      {
        "_id": "string",
        "inboundWorkflowId": "string",
        "inboundWorkflowIdDisplay": "string",
        "inboundSmsWorkflowId": "string",
        "inboundSmsWorkflowIdDisplay": "string",
        "inboundVoiceWorkflowId": "string",
        "inboundVoiceWorkflowIdDisplay": "string"
      }
    ],
    "totalCount": 0
  }
}

The response preserves the paginated shape returned by the underlying channel configuration listing and adds ...Display fields when linked workflow IDs are present. If a referenced workflow cannot be found, the corresponding display value is set to Invalid Workflow.

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.getData",
    "params": {
      "page": 1,
      "pageSize": 100
    }
  }'

POST /api/rpc (Method: ChannelManagerRpc.setupProvider)

  • Description: Handles interactive, multi-step setup for a channel provider.
  • Request Body:
{
  "method": "ChannelManagerRpc.setupProvider",
  "params": {
    "providerName": "whatsapp_business_api",
    "command": "wizard_start",
    "args": {}
  }
}
  • Parameters:
Name Type Required Description
providerName String Yes Provider name, such as whatsapp_business_api.
command String Yes Setup command to execute, such as wizard_start.
args Object No Optional command arguments passed through to the provider setup handler.
  • Response:
{
  "success": true,
  "data": {}
}

The method returns whatever the provider-specific setup handler returns. The exact payload depends on the registered provider and setup command.

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.setupProvider",
    "params": {
      "providerName": "whatsapp_business_api",
      "command": "wizard_start",
      "args": {}
    }
  }'

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

  • Description: Creates a new channel configuration.
  • Request Body:
{
  "method": "ChannelManagerRpc.create",
  "params": {
    "name": "Main Support Line",
    "channelType": "sms",
    "provider": "twilio"
  }
}
  • Parameters:
Name Type Required Description
name String No User-friendly channel name. Must be at least 1 character when provided.
channelType String No Channel type. Allowed values are voice, sms, whatsapp, email, web_chat, facebook_messenger, instagram, and telegram.
provider String No Provider implementation name, such as twilio, smtp, or whatsapp-web.
credentials Object No Provider-specific credentials object.
refreshToken String | null No OAuth refresh token.
accessToken String | null No OAuth access token.
tokenExpiry Date | String No OAuth access-token expiry value.
providerUserId String | null No OAuth provider user identifier.
settings Object No Channel-specific settings and identifiers.
inboundWorkflowId String | null No Workflow ID for inbound events.
inboundSmsWorkflowId String | null No Workflow ID for inbound SMS events.
inboundVoiceWorkflowId String | null No Workflow ID for inbound voice events.
isEnabled Boolean No Whether the channel is enabled. Defaults to true in the schema, but this method accepts a partial payload and the service may apply its own defaults.

The request schema is derived from OmniChannelConfigSchema with _id, createdAt, updatedAt, subscriptionId, and status removed, then made partial. That means the endpoint accepts a partial channel configuration object rather than requiring every field from the base schema.

  • Response:
{
  "success": true,
  "data": {}
}

The method returns the created channel configuration as produced by the underlying service. The exact persisted fields and any generated values depend on service-side logic.

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.create",
    "params": {
      "name": "Main Support Line",
      "channelType": "sms",
      "provider": "twilio"
    }
  }'

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

  • Description: Deletes a channel configuration.
  • Request Body:
{
  "method": "ChannelManagerRpc.delete",
  "params": {
    "_id": "string"
  }
}
  • Parameters:
Name Type Required Description
_id String Yes Channel configuration identifier.
  • Response:
{
  "success": true,
  "data": {}
}

The method returns whatever the underlying service returns for deletion.

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.delete",
    "params": {
      "_id": "507f1f77bcf86cd799439011"
    }
  }'

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

  • Description: Updates an existing channel configuration.
  • Request Body:
{
  "method": "ChannelManagerRpc.update",
  "params": {
    "_id": "string",
    "name": "Updated Name"
  }
}
  • Parameters:
Name Type Required Description
_id String Yes Channel configuration identifier.
name String No User-friendly channel name.
channelType String No Channel type.
provider String No Provider implementation name.
credentials Object No Provider-specific credentials object.
refreshToken String | null No OAuth refresh token.
accessToken String | null No OAuth access token.
tokenExpiry Date | String No OAuth access-token expiry value.
providerUserId String | null No OAuth provider user identifier.
settings Object No Channel-specific settings and identifiers.
inboundWorkflowId String | null No Workflow ID for inbound events.
inboundSmsWorkflowId String | null No Workflow ID for inbound SMS events.
inboundVoiceWorkflowId String | null No Workflow ID for inbound voice events.
isEnabled Boolean No Whether the channel is enabled.
status String No Operational status value.

The request schema is derived from OmniChannelConfigSchema.partial().extend({ _id: z.string() }), so the payload accepts any partial channel configuration fields plus the required _id.

  • Response:
{
  "success": true,
  "data": {}
}

The method returns whatever the underlying service returns after applying the update.

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.update",
    "params": {
      "_id": "507f1f77bcf86cd799439011",
      "name": "Updated Name"
    }
  }'

POST /api/rpc (Method: ChannelManagerRpc.initiateWhatsAppSetup)

  • Description: Initiates the setup process for a new WhatsApp channel, generating a temporary setup ID and verification token.
  • Request Body:
{
  "method": "ChannelManagerRpc.initiateWhatsAppSetup",
  "params": {}
}
  • Parameters:
Name Type Required Description

No parameters are required.

  • Response:
{
  "success": true,
  "data": {}
}

The method returns whatever the underlying service returns when starting the WhatsApp setup flow. The source confirms that this RPC delegates to ChannelManagerService.initiateWhatsAppSetup(context).

  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "ChannelManagerRpc.initi