Skip to content

Media not part of the outbound webhook body #1026

Open
@jficz

Description

@jficz

When a message with an image attached is sent to a room, hookshot's webhook doesn't contain the media file, just mxs:// reference in the event json.

hookshot version: 5.4.2
matrix-synapse version: 1.124.0
(both from NixOS 24.11)

According to my research, this is probably because Synapse enforces Authenticated Media by default and I would prefer not to disable it.

What I found:

Hookshot debug log contains
[OutboundHookConnection] Failed to get media for $<random> in !<room-id>:<example.com> <ref *2> IncomingMessage {...
and
_header: 'GET /_matrix/media/v3/download/<example.com>/<media-id>?allow_remote=true HTTP/1.1\r\n'

which is the "old" media API URL. Authenticated Media API should instead use

GET /_matrix/client/v1/media/download/{serverName}/{mediaId}

The request is ultimately generated by matrix-bot-sdk method downloadContent which has the "old" API path hardcoded. The bot sdk last release apparently predates MSC3916.

Activity

jficz

jficz commented on Mar 5, 2025

@jficz
Author

There is a workaround if anyone needs it - if your home server is behind a reverse proxy, you can do something like

location ~ ^/_matrix/media/v3/download/(.*)$ {
        proxy_pass http://[::1]:8008/_matrix/client/v1/media/download/$1$is_args$args;
}

This will work so long as your clients which use the "old" endpoint also send authorization token with the requests which, fortunately, Hooshot does.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Media not part of the outbound webhook body · Issue #1026 · matrix-org/matrix-hookshot