Share text and media to Instagram as an Instagram Reel or directly to the user's Feed using the Median JavaScript Bridge.
Overview
You can share text and media directly to Instagram as an Instagram Reel or directly to the user's Feed.
Implementation Guide
Checking for availability
Before sharing content, check whether Instagram is installed on the user’s device. Use the following JavaScript Bridge method:
↔️Median JavaScript Bridge
Run the following Median JavaScript Bridge command to share the screen content
const { isInstalled } = await median.socialShare.instagram.isInstalled();
Sharing media
This plugin only supports media sharing as a Blob
object. You can save a remote image as a Blob
using the following code snippet.
fetch("url-to-image")
.then(function(response) {
return response.blob();
})
.then(function(blob) {
// here the image is a blob
});
Other plugins from Median (such as the Web Screenshot Plugin) also export images as Blobs which can then be used with this plugin.
Sharing to feed
Use the following JavaScript command to share an image directly to the Instagram Feed:
↔️Median JavaScript Bridge
Run the following Median JavaScript Bridge command to share the screen content
median.socialShare.instagram.shareToFeed(blob);
Info
for iOS, Instagram no longer supports direct sharing to feed and will rather present the OS share dialog
Sharing to story or reels
Enhance your content by sharing images directly to Instagram Stories or Reels. This method supports optional sticker attachments and captions.
↔️Median JavaScript Bridge
Run the following Median JavaScript Bridge command to share the screen content
median.socialShare.snapchat.share(blob, { attachment: stickerBlob, captionText: 'Caption for Snapchat' });
Updated 3 months ago