What is URL Preview?
When a user sends a message containing a URL, Flock will attempt to show a preview of the page that the URL points to. For eg
While Flock does this automatically for public URLs, your app can register to generate URL previews for specific URL patterns. For eg
- A Google Drive Integration app may register to provide URL previews for any URLs beginning with http://docs.google.com
- A GitHub Integration app may register to provide URL previews for any URLs beginning with http://github.com
How do I handle URL previews from my app?
- Go through Creating an App to setup your app in the dev dashboard
- In the Advanced Info section, provide a list of domains that your app can generate previews for.
- Save these changes, then go through App Installation and install this app into your own Flock account.
Respond to the event with an Attachment object. Check Sending Attachments for more details also. Include the original URL in the
urlattribute. When a user clicks on the attachment, Flock will open the URL in the browser.
- Any authentication required to generate the URL Preview will have to be handled by you. For eg if your app is generating a URL Preview for a Google Docs URL you may need OAuth permissions from the user for his Google account. You can send a message to a user from your Bot with a link asking him to provide you with these permissions.