Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this pageProducts used
Looking for more inspiration?Visit the
Error
Application error

30139: URL not valid for link shortening

Twilio Messaging DocumentationMessaging

Description

description page anchor

This error occurs when you send a message with link shortening enabled and one or more URLs in the message body are not valid. To shorten a URL, Twilio requires a valid URL with properly encoded special characters.

Possible causes

possible-causes page anchor
  • A URL in the message body contains special characters that were not percent-encoded.
  • A URL includes a raw % character that is not followed by two hexadecimal digits.
  • A path or query string contains non-ASCII or reserved characters such as ñ or = without encoding.
  • A URL is missing a valid scheme or host.
  • Percent-encode special characters in each URL before you send the message.
  • Confirm that every URL includes a valid scheme and host, such as https://example.com.
  • Encode non-ASCII characters in the path. For example, change https://example.com/hola/mañana to https://example.com/hola/ma%C3%B1ana.
  • Encode reserved query characters when they are part of a parameter value. For example, change https://example.com/callback?token=abc123== to https://example.com/callback?token=abc123%3D%3D.
  • Encode a literal % as %25. For example, change https://example.com/path%test to https://example.com/path%25test.
  • Test the final message body with link shortening enabled before you send at scale.

Additional resources

additional-resources page anchor