Skip to contentSkip to navigationSkip to topbar
Page toolsOn this pageProducts used
Looking for more inspiration?Visit the

21656: The ContentVariables Parameter is invalid


ERROR: 21656

error-21656 page anchor
MESSAGING, CONTENT
ERROR

Twilio returns this error when your ContentVariables value is invalid for a message request that uses ContentSid. Send ContentVariables as a JSON string of key value pairs that map template variable numbers to substitution values. If a value is omitted, Twilio uses the template's default placeholder value.

Possible causes

possible-causes page anchor
  • ContentVariables is not a valid JSON string.
  • A variable placeholder in the template is malformed, such as {{example}.
  • A variable placeholder is empty, such as {{}}.
  • The ContentVariables payload is improperly formatted when you send the message.
  • One or more variables resolve to null or an empty string at send time.
  • A variable value used in the body contains a newline, a tab, or more than four consecutive spaces.
  • Send ContentVariables as a JSON string, such as {"1":"coupon_code","2":"docs"}.
  • Check every template placeholder and use valid double curly brace syntax. Do not use incomplete or empty placeholders.
  • Make sure each variable has a non-empty value when you send the message. Do not pass null or an empty string.
  • Remove newlines, tabs, and long runs of spaces from variable values used in the body.
  • If you want Twilio to substitute a fallback value, define a default placeholder value in the template before you send the message.

Additional resources

additional-resources page anchor