twilio-13228TwiliomediumDial: Invalid Method Attribute
The method attribute on your <Dial> TwiML verb is invalid — must be GET or POST.
What this error means
Root causes
Method attribute set to unsupported HTTP verb (e.g., PUT, DELETE, PATCH, HEAD)
Common
Typo in method attribute value (e.g., 'Gst', 'post', 'POST ')
Common
Dynamic method value from variable or database that contains invalid string
Occasional
Case sensitivity issue where lowercase 'get' or 'post' is used instead of uppercase
Occasional
Method attribute inherited from template or configuration management system with incorrect default
Rare
How to fix it
- 1
Locate the <Dial> verb in your TwiML
Find the TwiML code where you're using the <Dial> verb that's causing the error. Search your application for '<Dial' elements and identify which one has the invalid method attribute.
- 2
Verify the method attribute value
Check the current value of the method attribute. Ensure it is exactly 'GET' or 'POST' (uppercase). Common mistakes include lowercase variants, extra whitespace, or typos.
<!-- INCORRECT --> <Dial method="put">...</Dial> <Dial method="post ">...</Dial> <Dial method="Gst">...</Dial> <!-- CORRECT --> <Dial method="GET">...</Dial> <Dial method="POST">...</Dial> - 3
Update to valid HTTP method
Replace the invalid method with either 'GET' or 'POST'. Choose GET if you're passing simple parameters, or POST if you're sending sensitive data or large payloads.
<Dial method="POST" action="https://yourserver.com/handle-dial-result"> <Number>+1234567890</Number> </Dial> - 4
Check for dynamic method assignment
If the method attribute is being set dynamically from a variable, configuration file, or database, inspect the source of that value. Add validation to ensure only 'GET' or 'POST' are allowed.
// Node.js/Express example const dialMethod = req.body.method?.toUpperCase(); if (!['GET', 'POST'].includes(dialMethod)) { throw new Error('Invalid dial method - must be GET or POST'); } const twiml = new twilio.twiml.VoiceResponse(); twiml.dial({method: dialMethod}, '+1234567890'); - 5
Test the updated TwiML
Make a test call to verify the updated TwiML works correctly. Use Twilio's TwiML Debugger or make a test request to confirm the <Dial> verb now executes without errors.
Prevention
Establish a validation layer in your TwiML generation code that enforces the HTTP method must be either 'GET' or 'POST' before the TwiML is sent to Twilio. Use type-safe TwiML libraries (like Twilio's SDK with TypeScript) that provide enums for valid method values rather than accepting raw strings. Document acceptable method values in your codebase and add unit tests that verify TwiML generation with invalid methods fails appropriately during development.
Debugging this right now?
Sherlock diagnoses twilio-13228 automatically. Just ask in Slack and get an instant root-cause analysis.
Add to Slack — Free