Matterbridge: Add support to upload files to xmpp from bridges with private urls like slack/mattermost/telegram (xmpp)

Created on 7 Nov 2017  路  24Comments  路  Source: 42wim/matterbridge

I'm using matterbridge within xmpp and telegram and I noticed that when someone sends a file in telegram I can't receive it in xmpp.

Once that #278 is solved for telegram, could it be possible to add support for upload files to xmpp using this xep:
https://xmpp.org/extensions/xep-0363.html

Basically consists in upload the file to the xmpp server and share de url link.
Some xmpp clients supports this xep (Conversations, gajim (via plugin), dino, movim...)

Thanks in advance.

cantfix enhancement library issue

All 24 comments

Unfortunately the library I use (https://github.com/mattn/go-xmpp) doesn't support this.
Not much I can do for now.

@srgcdev I've just added support for sending files to your own "mediaserver". This is supported for the irc, xmpp and gitter bridges (who don't support native uploading).

An example of how to setup your own with caddy can be found on https://github.com/42wim/matterbridge/wiki/Mediaserver-setup-%5Badvanced%5D

@42wim Thanks! But having on my own server apache I think its a bit more difficult to configure caddy. I opened an enhancement issue to go-xmpp (https://github.com/mattn/go-xmpp/issues/94) library to support native http upload for xmpp. I hope they implement it someday.

Oh, could be possible to use caddy for media server upload and apache for media server download, something like this:

[general]
MediaServerUpload="http://localhost:2015
MediaServerDownload="https://yourserver.com/"

Hello. tell me. I configured the caddy according to your wiki. Added line in the config matterbridge. For example: investments of the telegram now appear in the folder according to the settings, but no change in xmpp. that is, they do not appear in any way in the conference. How to configure this feature

@42wim I also use this project for SpaceVim's comunity; here is the channels:

  • gitter: SpaceVim/SpaceVim
  • matrix: #spacevim:matrix.org
  • telegram: t.me/SpaceVim
  • irc: #spacevim(freenode.net)

now all work well except telegram, when user send message in telegram, we can not get message in irc gitter and matrix.

@Madji it should show the link. You also added MediaServerDownload to the config ?

Could you please run with -debug and then upload an image with telegram and paste me all of the debug logs on pastebin.com (be sure to remove any secrets / identifiers).

@wsdjeg this is probably an issue with the telegram configuration.

Check out https://core.telegram.org/bots#privacy-mode and https://github.com/yagop/node-telegram-bot-api/issues/174#issuecomment-244632667

Also run with -debug and see if you get any messages from telegram in the logs.

Thanks,fixed.

Yes, of course I added in the config MediaServerDownload.
Strange, but I have updated the version to matterbridge-v1.4.1-14. and images began to appear. But to be honest to take a single domain for the transmission of pictures is too much.
https://pasteit.cf/view/08af71ac
Concerned about the TLS error in the log. Please tell me how to get rid of them?

@42wim I want to use tools like this https://img.vim-cn.com/

is it possible to implement this feature? when user in tg/matrix/slack upload a file, just send them to https://img.vim-cn.com/ , and then post the url to other channels. then no need to upload file to the bridges (who don't support native uploading)

@madji it's probably something at telegram, does it still happen ?

@wsdjeg please open a new issue with this feature request. It seems http://img.vim-cn.com/ only supports images ? and not videos/files ?

@42wim ok, I will open new issue about it.

How should it work with XMPP-Telegram? I've configured Caddy, I can see that the image gets uploaded to Caddy by matterbridge, but matterbridge does not send the link to the image to XMPP. Does it use some XEP to push image to XMPP?

@42wim, I'm running Matterbridge v1.6.3 and it does not send the link for uploaded file to the XMPP room.

DEBU[2018-01-27T17:49:12+03:00] Receiving from telegram: &tgbotapi.Message{MessageID:220, From:(*tgbotapi.User)(0xc4204e0d20), Date:1517064552, Chat:(*tgbotapi.Chat)(0xc4208d5e60), ForwardFrom:(*tgbotapi.User)(nil), ForwardFromChat:(*tgbotapi.Chat)(nil), ForwardFromMessageID:0, ForwardDate:0, ReplyToMessage:(*tgbotapi.Message)(nil), EditDate:0, Text:"", Entities:(*[]tgbotapi.MessageEntity)(nil), Audio:(*tgbotapi.Audio)(nil), Document:(*tgbotapi.Document)(nil), Game:(*tgbotapi.Game)(nil), Photo:(*[]tgbotapi.PhotoSize)(0xc4203fa0c0), Sticker:(*tgbotapi.Sticker)(nil), Video:(*tgbotapi.Video)(nil), VideoNote:(*tgbotapi.VideoNote)(nil), Voice:(*tgbotapi.Voice)(nil), Caption:"", Contact:(*tgbotapi.Contact)(nil), Location:(*tgbotapi.Location)(nil), Venue:(*tgbotapi.Venue)(nil), NewChatMembers:(*[]tgbotapi.User)(nil), LeftChatMember:(*tgbotapi.User)(nil), NewChatTitle:"", NewChatPhoto:(*[]tgbotapi.PhotoSize)(nil), DeleteChatPhoto:false, GroupChatCreated:false, SuperGroupChatCreated:false, ChannelChatCreated:false, MigrateToChatID:0, MigrateFromChatID:0, PinnedMessage:(*tgbotapi.Message)(nil), Invoice:(*tgbotapi.Invoice)(nil), SuccessfulPayment:(*tgbotapi.SuccessfulPayment)(nil)}  module=telegram
DEBU[2018-01-27T17:49:12+03:00] trying to download "file_9.jpg" fileid "" with size 31954  module=telegram
DEBU[2018-01-27T17:49:12+03:00] download OK "file_9.jpg" 31954 96             module=telegram
DEBU[2018-01-27T17:49:12+03:00] Sending message from someuser on telegram.bridged to gateway  module=telegram
DEBU[2018-01-27T17:49:12+03:00] Message is config.Message{Text:"", Channel:"-123456789", Username:"someuser", UserID:"87654321", Avatar:"", Account:"telegram.bridged", Event:"", Protocol:"", Gateway:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"220", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_9.jpg", Data:(*[]uint8)(0xc42016c980), Comment:"", URL:""}}}}  module=telegram
DEBU[2018-01-27T17:49:12+03:00] mediaserver download URL = https://somedomain.com/f7a354f2c4b9b3d71858116dd079a97a773c9bc2/file_9.jpg

And that's all. You can't see this link anywhere except in the logs.

@valdikss I also need the debug messages from module=xmpp

@42wim, how can I activate them? No message is sent to XMPP after mediaserver download URL. No XML payload is shown in the log, nothing on the server XML log also.

But for normal messages the xmpp bridge works ?
Typing in telegram gives output in xmpp ?

I tried to downgrade down to 1.4.1, and to use current git version, but it doesn't work.
Yes, text messaging works fine.

Ok, retry the current master, I've added a possible fix.
Or wait until the binaries are build (they will show up in a couple of minutes at https://bintray.com/42wim/nightly/Matterbridge/_latestVersion)

(binaries are available now)

Works now, thanks a lot!

@ValdikSS good to hear, thanks for testing and reporting back.

Going to close this as this needs to be fixed by the xmpp library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jojosoft picture jojosoft  路  8Comments

patcon picture patcon  路  3Comments

benrob0329 picture benrob0329  路  3Comments

bluddy picture bluddy  路  4Comments

weeman1337 picture weeman1337  路  6Comments