Skip to content

How to detect file content/media type of incoming attachment #40

@SzymonPek

Description

@SzymonPek

Hi Team,
Is there a way how we can detect what is content type of file that is attached under url attribute in incoming message? Or the type of the file is always the same, VIDEO will be always mp4 format so it will be "video/mp4" and Infobip VOICE will be always "audio/ogg"?
Context:
When we receive incoming message with url we want to check what is the contentType so we can store in our our S3 bucket. To do it we need MIME Type of the file.
To download file we use Infobip Java Client downloadWhatsAppInboundMedia().execute() but this is returning File object without extension. We tried also usage of your example with WhatsAppWebhookInboundMessageResult approach but all we get there is Infobip specific types like VOICE or IMAGE, but no details around extension.

While we acknowledge the possibility of retrieving this information via classic HTTP Requests and parsing the headers, we strive to maintain consistency in our integration and continue leveraging the Infobip API Client without introducing unnecessary complexity.
Could you kindly advise if there's a method within the Infobip Java Clientthat allows us to obtain MIME Type or file extension directly from the received message?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions