I'm getting dispatch rule creation error "could no...
# ask-ai
a
I'm getting dispatch rule creation error "could not read request: proto: (line 2:3): unknown field "dispatch_rule"" and the format I'm using is the same that is provided on the documentation
✅ 1
t
Thanks for reaching out, Hiren. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re blocked by that error. The protobuf error means the request contains a field name the API doesn’t expect. The CreateSIPDispatchRuleRequest expects the top-level field to be
rule
, not
dispatch_rule
. Could you paste the exact JSON/YAML payload you’re sending (redact any sensitive IDs)? If you prefer, try this example structure and let me know if the error persists:
Copy code
{
  "trunk_ids": [
    "trunk-id"
  ],
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "call"
    }
  }
}
If you share your payload, I’ll point out the exact change needed. , with interactive elements
a
Below is the exact json I'm using to create dispatch rule { "dispatch_rule": { "rule": { "dispatchRuleIndividual": { "roomPrefix": "spl-" } }, "name": "Support First Trunk Dispatch", "trunk_ids": ["ST_iSuevFgT6ZKc"], "roomConfig": { "agents": [{ "agentName": "support_plbot", "metadata": "" }] } } }
t
Thanks — that payload shows the issue. Your JSON nests the request under a top-level
dispatch_rule
key; the API expects the top-level fields directly and the rule object must be named
rule
. Move
name
,
trunk_ids
, and
roomConfig
up one level and remove
dispatch_rule
. Example correct payload:
Copy code
{
  "name": "Support First Trunk Dispatch",
  "trunk_ids": [
    "ST_iSuevFgT6ZKc"
  ],
  "roomConfig": {
    "agents": [
      {
        "agentName": "support_plbot",
        "metadata": ""
      }
    ]
  },
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "spl-"
    }
  }
}
Send that and the error should go away. If it doesn't, paste the exact request/response (with IDs redacted) and I’ll keep troubleshooting. , with interactive elements
a
well.. it worked.. but I was using exactly what was mentioned in the documentation.. thanks