messaging-apis
messaging-apis copied to clipboard
[Telegram] sendMediaGroup - 400 Bad Request for documents array or mix
When I try to send multiple documents I got the error:
0|npm start | AxiosError: Telegram API - 400 Bad Request: wrong file identifier/HTTP URL specified
0|npm start | at TelegramClient.<anonymous> (/.../node_modules/messaging-api-telegram/dist/TelegramClient.js:67:27)
0|npm start | at Generator.throw (<anonymous>)
0|npm start | at rejected (/.../node_modules/messaging-api-telegram/dist/TelegramClient.js:6:65)
0|npm start | at runMicrotasks (<anonymous>)
0|npm start | at processTicksAndRejections (internal/process/task_queues.js:95:5)
0|npm start | Error Message -
0|npm start | Telegram API - 400 Bad Request: wrong file identifier/HTTP URL specified
0|npm start | Request -
0|npm start | POST /sendMediaGroup
0|npm start | Request Data -
0|npm start | {
0|npm start | "chat_id": "@groupid",
0|npm start | "media": [
0|npm start | {
0|npm start | "type": "document",
0|npm start | "media": "https://64.media.tumblr.com/e5382624feb56e3b32740a22b3305ee8/ca057c4fa92f6baa-d7/s500x750/7797a8155b711abc2732c432ec5a8c37b1860b84.gif"
0|npm start | },
0|npm start | {
0|npm start | "type": "document",
0|npm start | "media": "https://64.media.tumblr.com/0f40868b31818022a7c70929ce45fb44/ca057c4fa92f6baa-5b/s500x750/2837ebfa5540ac6351a122bba26a89f648328cb2.gif"
0|npm start | },
0|npm start | {
0|npm start | "type": "document",
0|npm start | "media": "https://64.media.tumblr.com/a9e19e401667c4407fdab006d6f56354/ca057c4fa92f6baa-42/s500x750/716719270053218835f34ad4e4deb89cdc935d6b.gif"
0|npm start | },
0|npm start | {
0|npm start | "type": "document",
0|npm start | "media": "https://64.media.tumblr.com/19c75eb828ed442b9aae91289956209a/ca057c4fa92f6baa-85/s500x750/b0e8779ed8a2a598d54f02356bf0889901ff914d.gif"
0|npm start | }
0|npm start | ]
0|npm start | }
0|npm start | Response -
0|npm start | 400 Bad Request
0|npm start | Response Data -
0|npm start | {
0|npm start | "ok": false,
0|npm start | "error_code": 400,
0|npm start | "description": "Bad Request: wrong file identifier/HTTP URL specified"
0|npm start | }
However in the original documentation its written that sending InputMediaDocument should be possible:
It seems like the error Telegram API - 400 Bad Request: wrong file identifier/HTTP URL specified
occur when you send a file which name is not starting with letter.
Try to make your file names starting with letter instead of number, send the request again, see if this error persist?
ref: https://stackoverflow.com/questions/47005393/telegram-bot-bad-request-wrong-file-identifier-http-url-specified
Strange because posting individual document has no problem:
await tg.sendDocument('@sprclstr', "https://64.media.tumblr.com/a9e19e401667c4407fdab006d6f56354/ca057c4fa92f6baa-42/s500x750/716719270053218835f34ad4e4deb89cdc935d6b.gif")
@wtflink any other thought?
This issue seems familiar to your case, did you check your file size? https://github.com/telegraf/telegraf/issues/1481
The file size is not big, as I wrote above the gif content can be posted one by one.