'How to get a link preview in Nodejs?

I have made an app in slack where I want to fetch details of a document from an API and then display the preview of the same file in slack. I'm using Nodejs for the app but how do I get a document or link preview in slack while using Nodejs.

Thanks in advance!



Solution 1:[1]


For unfurling links/media when posting using chat.postMessage,
you can make use of below mentioned 'optional argurments'

unfurl_links Pass true to enable unfurling of primarily text-based content.
https://api.slack.com/methods/chat.postMessage#arg_unfurl_links

unfurl_media Pass false to disable unfurling of media content.
https://api.slack.com/methods/chat.postMessage#arg_unfurl_media

https://api.slack.com/methods/chat.postMessage

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Suyash Gaur