I’m encountering a 400 error with message Bad Request: STICKER_DOCUMENT_INVALID while trying to respond to an inline query using a sticker. Here’s how I’m structuring my response:
I’ve checked online resources, including official documentation, but found no relevant solutions. Has anyone else faced a similar issue? The sticker I am using was uploaded successfully with the method available for uploading sticker files.
From my experience, the error you’re encountering might be due to a mismatch between the expected and actual identifier types when generating or sending your response with stickers. Telegram’s API needs the sticker to be well-defined and properly formatted. It’s essential to ensure the fileIdentifier is indeed the correct and valid file ID provided by the bot’s file upload response. Additionally, make sure the sticker has been added to a pack and is not private or removed. Issues can also arise if the bot’s access permissions or token have changed, so double-check if they are intact and valid.
I’ve encountered a similar error, and it turned out to be related to token permissions at my end. Verifying if the bot has all the required privileges for sending stickers can often resolve this issue. Another thing to check is the usage of the correct file_id. Sometimes, file IDs might change, especially if the sticker was uploaded again or in a different chat. Confirm that you’re referencing the latest file ID and that no other configuration changes on Telegram’s server-side might affect sticker usage for inline queries.
I also ran into this issue before, and what helped me was ensuring that the sticker is publicly accessible and not restricted. If the sticker isn’t part of a public collection or if there are access restrictions, it can throw this type of error. Another consideration might be lightening the payload’s size in your query response, as Telegram has payload size limits that, if exceeded, can cause errors. Sometimes making sure the sticker is optimized size-wise and adheres to Telegram’s sticker requirements can clear up unforeseen errors.