Twilio Newbie, persistent_action 413 error

Raghavendra Kamath - Aug 22 - - Dev Community

I am using a trial account of twilio and have setup a webhook to respond to an incoming message with code that looks like this

client.messages.create(
from_='whatsapp:+14155XXX886',
to=user_phone,
body="Please select your gender:",
persistent_action=[
{
"type": "quick_reply",
"text": "Male",
"payload": "male"
},
{
"type": "quick_reply",
"text": "Female",
"payload": "female"
},
{
"type": "quick_reply",
"text": "Other",
"payload": "other"
}
]

Now I am getting an error like

File "/home/django-app/.virtualenvs/django-server/lib/python3.10/site-packages/twilio/base/version.py", line 465, in create
return self._parse_create(method, uri, response)
File "/home/django-app/.virtualenvs/django-server/lib/python3.10/site-packages/twilio/base/version.py", line 436, in _parse_create
raise self.exception(method, uri, response, "Unable to create record")
twilio.base.exceptions.TwilioRestException: HTTP 413 error: Unable to create record: Invalid record: [flowSteps[0].state.apiParameters.persistentActions size must be between 0 and 5]

size is 3 , then why am I getting this error?

.