Omnix

PhoneNumberManagerRpc

The PhoneNumberManagerRpc endpoint group exposes RPC methods for listing, creating, updating, and deleting phone numbers, plus a helper for resolving form reference values. The public contract shown here is limited to the methods declared in src/server/rpc/PhoneNumberManagerRpc.js; any deeper behavior comes from the telephony service it delegates to and is not documented here unless explicitly visible in the source.

Endpoints

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

This method lists phone numbers. It accepts optional filtering, sorting, and pagination parameters and forwards them to the telephony service.

  • Description: Lists phone numbers through TelephonyManager.

  • Request Body:

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

    Name Type Required Description
    filter Object No Optional filter object. The schema allows any object shape and passes additional keys through.
    sort Object No Optional sort object. The schema allows any object shape and passes additional keys through.
    page Number No Page number. Defaults to 1 when omitted.
    pageSize Number No Number of items per page. Defaults to 25 when omitted.
  • Response:

    {
      "success": true,
      "data": "Telephony service list response"
    }

    The exact response shape is determined by TelephonyConnectorService.listPhoneNumbers(...), which is not inspected here.

  • Example (cURL):

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

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

This method creates a phone number record by forwarding the request payload to the telephony service.

  • Description: Creates a phone number through TelephonyManager.

  • Request Body:

    {
      "method": "PhoneNumberManagerRpc.create",
      "params": {
        "phoneNumber": "+15551234567",
        "provider": "example-provider"
      }
    }
  • Parameters:

    Name Type Required Description
    phoneNumber String Yes Phone number value to create.
    provider String Yes Provider identifier to associate with the phone number.

    The schema also uses .passthrough(), so additional properties are accepted and forwarded.

  • Response:

    {
      "success": true,
      "data": "Telephony service create response"
    }

    The exact response shape is determined by TelephonyConnectorService.createPhoneNumber(...), which is not inspected here.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "PhoneNumberManagerRpc.create",
        "params": {
          "phoneNumber": "+15551234567",
          "provider": "example-provider"
        }
      }'

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

This method updates an existing phone number by forwarding the request payload to the telephony service.

  • Description: Updates a phone number through TelephonyManager.

  • Request Body:

    {
      "method": "PhoneNumberManagerRpc.update",
      "params": {
        "_id": "phone-number-id"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Identifier of the phone number record to update.

    The schema also uses .passthrough(), so additional properties are accepted and forwarded.

  • Response:

    {
      "success": true,
      "data": "Telephony service update response"
    }

    The exact response shape is determined by TelephonyConnectorService.updatePhoneNumber(...), which is not inspected here.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "PhoneNumberManagerRpc.update",
        "params": {
          "_id": "phone-number-id"
        }
      }'

POST /api/rpc (Method: PhoneNumberManagerRpc.getFieldValues)

This method returns reference values for phone number form fields. The source only implements the workflows collection branch; all other collections return an empty array and generate a warning.

  • Description: Gets reference field values for phone number forms.

  • Request Body:

    {
      "method": "PhoneNumberManagerRpc.getFieldValues",
      "params": {
        "fieldName": "workflowId",
        "reference": {
          "collection": "workflows",
          "valueField": "_id",
          "displayField": "name",
          "filter": {},
          "sort": {}
        }
      }
    }
  • Parameters:

    Name Type Required Description
    fieldName String Yes Name of the field requesting reference values.
    reference Object Yes Reference definition used to resolve the options.
    reference.collection String Yes Collection name to resolve. Only workflows is handled in the current source.
    reference.valueField String Yes Field to use as the returned option value.
    reference.displayField String Yes Field to use as the returned option label.
    reference.filter Record<String, any> No Optional filter object passed to the workflow lookup.
    reference.sort Record<String, any> No Optional sort object declared by the schema.
  • Response:

    {
      "success": true,
      "data": [
        {
          "value": "workflow-value",
          "label": "Workflow Name"
        }
      ]
    }

    When reference.collection is workflows, the method calls WorkflowRpc.getData with pageSize: 1000 and the provided filter, then maps each result to { value, label } using reference.valueField and reference.displayField. If that lookup fails, the method logs an error and returns an empty array. For any other collection, it logs a warning and returns an empty array.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "PhoneNumberManagerRpc.getFieldValues",
        "params": {
          "fieldName": "workflowId",
          "reference": {
            "collection": "workflows",
            "valueField": "_id",
            "displayField": "name"
          }
        }
      }'

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

This method deletes a phone number by identifier and forwards the call to the telephony service.

  • Description: Deletes a phone number through TelephonyManager.

  • Request Body:

    {
      "method": "PhoneNumberManagerRpc.delete",
      "params": {
        "_id": "phone-number-id"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Identifier of the phone number record to delete.
  • Response:

    {
      "success": true,
      "data": "Telephony service delete response"
    }

    The exact response shape is determined by TelephonyConnectorService.deletePhoneNumber(...), which is not inspected here.

  • Example (cURL):

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

POST /api/rpc (Method: PhoneNumberManagerRpc.deleteByNumber)

This method deletes a phone number using its E.164 number and forwards the request to the telephony service.

  • Description: Deletes a phone number by E.164 number through TelephonyManager.

  • Request Body:

    {
      "method": "PhoneNumberManagerRpc.deleteByNumber",
      "params": {
        "phoneNumber": "+15551234567"
      }
    }
  • Parameters:

    Name Type Required Description
    phoneNumber String Yes Phone number to delete.
  • Response:

    {
      "success": true,
      "data": "Telephony service delete-by-number response"
    }

    The exact response shape is determined by TelephonyConnectorService.deletePhoneNumberByNumber(...), which is not inspected here.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "PhoneNumberManagerRpc.deleteByNumber",
        "params": {
          "phoneNumber": "+15551234567"
        }
      }'

Request Flow

graph TD A[Client POST /api/rpc] --> B[PhoneNumberManagerRpc method] B --> C{Method} C -->|getData/create/update/delete/deleteByNumber| D[TelephonyConnectorService] C -->|getFieldValues| E{reference.collection === workflows?} E -->|Yes| F[WorkflowRpc.getData] F --> G[Map results to value/label] E -->|No| H[Return empty array] D --> I[Return service response]

Notes

The source does not show any explicit authentication, role guard, or session guard on these methods. It also does not expose the underlying telephony service response schemas, so consumers should treat those response payloads as implementation-defined unless they inspect TelephonyConnectorService directly.