I’m working on a custom integration that needs to trigger outbound calls via the CXone Personal Connection API. I have the access token and the account ID correct, as I can successfully query the user details endpoint without issues. However, when I attempt to initiate the call using the POST endpoint, I get a 400 Bad Request error.
Here is the code I am using in C# with the RestSharp library:
var client = new RestClient("https://platform.mycontactcenter.ai/api/v2/outbound/calls");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", $"Bearer {accessToken}");
request.AddHeader("content-type", "application/json");
var body = new {
campaignId = "5f4e3d2c-1b2a-3c4d-5e6f-7a8b9c0d1e2f",
userId = "6a7b8c9d-0e1f-2a3b-4c5d-6e7f8a9b0c1d",
toNumber = "+15551234567",
fromNumber = "+15559876543"
};
request.AddJsonBody(body);
var response = client.Execute(request);
Console.WriteLine(response.Content);
The response payload looks like this:
{
"message": "Invalid request body",
"errors": [
{
"property": "campaignId",
"message": "Campaign not found or user is not assigned"
}
]
}
I have double-checked the campaign ID in the CXone UI and confirmed the user is part of the campaign’s agent group. The user ID is also correct. I’m wondering if there is a specific format required for the JSON body or if I need to include additional headers that are not documented clearly. I’ve also tried using the personalConnectionId instead of campaignId but that results in a 404.
Any insights on what might be missing here?