Looking how to send message with image preview via Talk API

Hello,

I am tying to create a script that would send messages to existing conversation. Message would consist of a text and a link to the previously shared image. The goal is to have these messages well-looking with image displayed as clickable preview. I tried a number of approaches, but none of them worked good enough: sharing a file via ocs/v2.php/apps/files_sharing/api/v1/sharesendpoint won’t allow to add text (was unable to make talkMetaData→caption work). Sharing a file and adding a link to it to the message works but I could not find a way to nicely format it (simple link even with automatic preview looks quite ugly). Sharing rich object (endpoint: /chat/{token}/share) won’t allow to add comments as well.

Any comments, corrections or ideas are highly appreciated, thanks in advance.

1 Like