Skip to content

MessagesSendMultiMedia returns rpc error code 400: MEDIA_INVALID when sending multiple media in a single post #1527

Open
@asadbekGo

Description

I am trying to send multiple media files (e.g., images) in a single post using MessagesSendMultiMedia, but I keep getting the error:
rpc error code 400: MEDIA_INVALID

_, err = v1.tgBot.Client.API().MessagesSendMultiMedia(context.Background(), &tg.MessagesSendMultiMediaRequest{
Peer: &tg.InputPeerChat{ChatID: groupId},
MultiMedia: []tg.InputSingleMedia{
{
Media: &tg.InputMediaUploadedPhoto{File: inputFile},
RandomID: rand.Int63(),
Message: post.Text,
},
{
Media: &tg.InputMediaUploadedPhoto{File: inputFile},
RandomID: rand.Int63(),
},
},
})

What I Tried:

  1. Verified that inputFile is correctly uploaded and contains valid ID, Parts, and MD5Checksum.
  2. Ensured &inputFile is correctly assigned (also tried inputFile without pointer).
  3. Tried InputMediaUploadedDocument instead of InputMediaUploadedPhoto (same error).
  4. Attempted adding Flags: 1, but GroupedID is not available in InputSingleMedia.
    Questions:
  5. How can I send multiple media files in a single post instead of separate messages?
  6. Is there a way to properly group media items using MessagesSendMultiMedia?
  7. Does InputSingleMedia support GroupedID, or is there another approach?
    Would appreciate any insights or suggestions. Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions