Omnix

WhatsAppRpc

This RPC group exposes WhatsApp-specific operations for working with channel-connected Meta templates. Both methods validate that the selected channel is an active WhatsApp Business API provider before delegating to the underlying channel provider.

Endpoints

POST /api/rpc (Method: WhatsAppRpc.submitTemplateForApproval)

  • Description: Submits an internal Omnix template to Meta for approval.

  • Request Body:

    {
      "method": "WhatsAppRpc.submitTemplateForApproval",
      "params": {
        "channelConfigId": "string",
        "templateId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    channelConfigId String Yes Identifies the active channel configuration to use. The method requires the selected provider to be whatsapp_business_api.
    templateId String Yes Identifies the Omnix template to submit for approval.
  • Response:

    {
      "success": true,
      "data": {
        "result": "provider-specific response"
      }
    }

    The exact response shape depends on the active WhatsApp provider implementation returned by ChannelManagerService.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "WhatsAppRpc.submitTemplateForApproval",
        "params": {
          "channelConfigId": "your-channel-config-id",
          "templateId": "your-template-id"
        }
      }'
  • Errors: This method throws an error if the selected channel is missing, inactive, or is not a WhatsApp Business API provider. It also throws an error if the active provider does not implement submitTemplateForApproval().

POST /api/rpc (Method: WhatsAppRpc.importApprovedTemplates)

  • Description: Imports all approved templates from Meta into Omnix.

  • Request Body:

    {
      "method": "WhatsAppRpc.importApprovedTemplates",
      "params": {
        "channelConfigId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    channelConfigId String Yes Identifies the active channel configuration to use. The method requires the selected provider to be whatsapp_business_api.
  • Response:

    {
      "success": true,
      "data": {
        "result": "provider-specific response"
      }
    }

    The exact response shape depends on the active WhatsApp provider implementation returned by ChannelManagerService.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "WhatsAppRpc.importApprovedTemplates",
        "params": {
          "channelConfigId": "your-channel-config-id"
        }
      }'
  • Errors: This method throws an error if the selected channel is missing, inactive, or is not a WhatsApp Business API provider. It also throws an error if the active provider does not implement importApprovedTemplates().