getting 403 forbidden when calling /api/v2/wfm/schedules/import from our servicenow data action. token is valid for wfm:schedule:write but payload rejected. error msg: “invalid schedule format or missing agent mapping”. tried stripping nested objects but no luck. using gc version 2024-11. is there a strict schema for the agent_id array? logs show auth passes but validation fails immediately.
The 403 error here is likely a schema validation mismatch rather than an auth issue. In Zendesk, we often pushed agent IDs as simple strings, but Genesys Cloud WFM expects a specific nested structure for agents. Ensure your ServiceNow data action payload matches this exact format:
{
"schedule": {
"name": "Shift_A",
"scheduleElements": [
{
"agentId": "uuid-of-agent",
"segments": [
{
"startTime": "2024-01-01T09:00:00Z",
"endTime": "2024-01-01T17:00:00Z",
"type": "work"
}
]
}
]
}
}
Also, verify the agentId is a valid UUID, not a numeric ID. Zendesk ticket assignees were often numeric or email-based, causing immediate rejection in GC. The API logs show auth passes, so the token is fine. The “invalid schedule format” message points directly to the JSON structure. Check if your ServiceNow script is sending agent_id instead of agentId inside scheduleElements. Case sensitivity matters here. Also, ensure the startTime and endTime are ISO 8601 formatted with ‘Z’ suffix for UTC. If the payload has any extra fields not in the schema, GC will reject it. Try stripping all non-essential fields first. This strict validation is a key difference from Zendesk’s more flexible ticket field updates. Once the structure aligns, the import should succeed.
Make sure you are not hitting the raw API from ServiceNow. Direct API calls bypass provider safety checks and often fail schema validation. Use the Terraform genesyscloud_wfm_schedule resource for idempotent imports instead.