30139: URL not valid for link shortening
MESSAGING
ERROR
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.
- 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ñanatohttps://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==tohttps://example.com/callback?token=abc123%3D%3D. - Encode a literal
%as%25. For example, changehttps://example.com/path%testtohttps://example.com/path%25test. - Test the final message body with link shortening enabled before you send at scale.