Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 12, 2025

The tollfree verification API was returning "Missing required parameter" errors for array parameters (UseCaseCategories and OptInImageUrls) even when they were properly included in the request. This issue occurred specifically when using sub-accounts.

The root cause was that array parameters were being serialized as repeated form parameters (param=A&param=B&param=C) instead of comma-separated strings (param=A,B,C) which is the format expected by the Twilio API.

Changes Made

  • Modified TollfreeVerificationList#create to serialize array parameters as comma-separated strings
  • Modified TollfreeVerificationContext#update to use the same serialization approach
  • Added comprehensive test coverage for array parameter handling

Before (causing API errors):

use_case_categories: ['ACCOUNT_NOTIFICATIONS', 'EVENTS']
# Serialized as: UseCaseCategories=ACCOUNT_NOTIFICATIONS&UseCaseCategories=EVENTS

After (working correctly):

use_case_categories: ['ACCOUNT_NOTIFICATIONS', 'EVENTS'] 
# Serialized as: UseCaseCategories=ACCOUNT_NOTIFICATIONS,EVENTS

The fix handles all edge cases correctly:

  • Arrays are joined with commas
  • Non-array values pass through unchanged
  • Empty arrays become empty strings
  • nil and :unset values are preserved

Fixes #674.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Unable to POST to tollfree_verifications.create - getting missing parameter even though it is included Fix array parameter serialization for tollfree verification requests Sep 12, 2025
Copilot finished work on behalf of tiwarishubham635 September 12, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to POST to tollfree_verifications.create - getting missing parameter even though it is included
2 participants