Cheogram Android has an option to send link previews. What does this option do?
It scans the body of the message for URLs (as per the autolink logic already in the app) and for any that are https it does a HEAD request. If content-type is `image/*` or `audio/*` or `video/*` or `application/pdf` it treats this as an HTTP upload message where this URL is already uploaded. So that is, OOB and SIMS get set up and this URL is the URL source. If the URL is the whole body, then the fallback tag is set across the whole body as normal, otherwise a null fallback is set to allow the link to still display in its place in the text along with the attachment.
If the HEAD gets a content type of `text/html` or `application/xhtml+xml` then it scans the first 4000 bytes for OpenGraph tags and converts them into RDF/XML syntax as a direct child of the message stanza, like so:
<message to="whoever@example.com"> <body>I wanted to mention https://the.link.example.com/what-was-linked-to</body> <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:og="https://ogp.me/ns#" rdf:about="https://the.link.example.com/what-was-linked-to"> <og:title>Page Title</og:title> <og:description>Page Description</og:description> <og:url>Canonical URL</og:url> <og:image>https://link.to.example.com/image.png</og:image> <og:type>website</og:type> <og:site_name>Some Website</og:site_name> </rdf:Description> </message>