Hey everyone,
I’m trying to automate the creation of contact lists for our WFM adherence campaigns using the Python SDK. We have a script that pulls agent schedules and exports them to a CSV, then attempts to push that data into Genesys Cloud Outbound. The logic seems sound, but the API keeps rejecting the payload.
Here is the Python code I’m using to construct the request:
from platformclientv2 import OutboundApiClient, ContactList, ContactListName
outbound_api = OutboundApiClient(configuration)
# This is the payload structure I'm sending
contact_list = ContactList(
name=ContactListName(name="WFM_Adherence_Test_List_001"),
contact_count=1,
created_by_id="user_12345",
modified_by_id="user_12345"
)
try:
result = outbound_api.post_outbound_contactlist(body=contact_list)
print("List created successfully")
except Exception as e:
print(f"Error: {e}")
The error I’m getting back is a 400 Bad Request with the message INVALID_VALUE. The detailed error body says:
{
"opId": "abc-123-def",
"message": "Invalid value for contactList",
"details": [
{
"field": "contactCount",
"message": "Value must be greater than 0"
}
]
}
This is confusing because I’m explicitly setting contact_count=1 in the model. I’ve also tried passing the raw JSON payload directly via requests.post to /api/v2/outbound/contactlists, but I get the same INVALID_VALUE error on the contactCount field. I’ve double-checked the API docs and it looks like contactCount is an integer field. Is there a specific format required for this field? Or is the SDK model mapping it incorrectly? I’ve been staring at this for two hours and can’t figure out why a value of 1 is invalid. Any ideas on what I’m missing here?