I’ve been trying for a while to add the ability to share an image to an instagram via a vue 3/capacitor app.
const shareToInstagramStories = async (image_url) => {
try {
const instagram_url =
`instagram-stories://share?` +
`backgroundImage=${encodeURIComponent(image_url)}&` +
`sourceApplication=<my_facebook_id_here>`;
await AppLauncher.canOpenUrl({ url: instagram_url });
await AppLauncher.openUrl({
url: instagram_url,
});
} catch (error) {
console.error("Failed to share on Instagram Stories:", error);
}
};
The above snippet kind of works…unfortunately when I run this function the Instagram app is launched on my phone but I get an error on Instagram “the app that you shared from doesn’t currently support sharing to stories capacitor app launcher”.
There’s a few paths I could go down.
- Something to do with the facebook ID (I’ve tripled check to make sure it’s correct) - I haven’t set up any particular permissions for this facebook ID…does anyone know if this is required? (Instagram Stories API: How to Publish a Story)
- I’m potentially not passing in the sourceApplication in properly - React Native has this really cool library (Share.shareSingle | React Native Share) which seems to have everything I need…but it’s React, anyone know if there’s an equivalent here?
Hoping someone can shed some light/suggestions/insight - even if they know if it’s possible!
Thanks heaps in adance.