Skip to content

[Error] Bad Request: can't parse entities #190

Open
@euphoria360

Description

@euphoria360

🪲 Describe the bug
I am using Apprise API Docker on my home server to send messages to my Telegram Group.
A script on another system sends messages to it using curl post command.
Everything was working fine until around April 17th when messages stopped coming.
Today I started looking at the script and saw that Apprise complains about characters in the message.
the message is:

*Home-S [Sonarr]:* Test
Testing if Sonnar can Send us any Massage.
If you got this, then Hurrayyyyy!!!

It is being sent to Apprise via this command:
printf "$message\n" | curl -X POST -F "body=$(</dev/stdin)" "$appriseurl"

And this is the error:

2024-05-07 12:04:36,241 [INFO] apprise: Loaded 1 entries from memory://
2024-05-07 12:04:37,340 [WARNING] apprise: Failed to send Telegram notification to -1001234567890: Bad Request: can't parse entities: Character '-' is reserved and must be escaped with the preceding '\', error=400.

I tried to send a simple message via curl and again same happened:

curl -X POST -F "body=home-s" "http://192.168.48.6:8008/notify/tg-nasbot"

2024-05-07 12:15:01,689 [INFO] apprise: Loaded 1 entries from memory://
2024-05-07 12:15:02,728 [WARNING] apprise: Failed to send Telegram notification to -1001847463926: Bad Request: can't parse entities: Character '-' is reserved and must be escaped with the preceding '\', error=400.

If I remove '-', other characters like []: will get complains too. this was not the case before.
what should I do?

💻 Your System Details:

  • OS: Apprise API Docker container

Update:
I finally fixed it by piping my message through sed and escaping all special characters. So far it works:
printf "$message\n" | sed "s|[-.\!()%&#?/@+':]|\\\&|g" | curl -X POST -F "body=$(</dev/stdin)" "$appriseurl"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions