hey, try changin the keys to chat_id and photo. i had issues until i used multipart/formdata for the binary upload. simplest change but made a world of differnce in how the image is processed via the api. give it a go!
Based on my experience working with the Telegram API in Perl, it’s crucial to use the correct parameter names as defined in the Telegram documentation. I discovered that the keys are case-sensitive and should be formatted as chat_id, caption, and photo when sending images. Another key detail is managing the binary data; you might need to use multipart form data for file uploads rather than including raw binary data in a JSON payload. After refactoring my implementation to reflect these changes, sending images via Telegram became significantly more reliable.
After working on a similar implementation, I discovered that the crucial difference between sending text messages and images via Telegram lies in how the file data is uploaded. Rather than encoding the binary image data directly into your JSON payload, I found it necessary to use multipart/form-data. Moreover, I adjusted my parameter names to reflect Telegram’s API documentation, changing them to chat_id, photo, and caption. This approach resolved many issues I encountered and improved the reliability of image uploads. The proper selection of HTTP client methods and multiparts makes a significant difference when handling image files in a Perl implementation.