skip to Main Content

I am working on a web app in which some content is generated in the form of text (and will soon include images as well). I want to add a share button which will allow the user to add this content to their Instagram story.

So the flow of this is going to be:

  1. User does something on the website
  2. The website generates some content based on user input
  3. User clicks on “Share on Instagram” and posts it on his/her story

Is there a way to do this using Javascript or an API call like the Twitter share option directly from the HTML ?

I am using Python on the backend (Flask) and JS on the frontend

2

Answers


  1. OK, lets make this simple.

    The direct answer as found on the official Facebook developers page is no. You can’t trigger an API to create an instagram story, as for now only the "read-mode" is supported through API.

    But as most things in life you can hack your way around.

    You can create a button that says, "share on your instagram stories" and here’s what it is gonna do:

    1. Trigger a function on the back-end that creates a screenshot/image or a video of the content you want to share
    2. Send that content to the user so it’s the last content they have in the gallery

    UPDATE

    1. Trigger the open story camera in Instagram app with this link: instagram://story-camera. (the last content they have will be the content u sent and will be the first thing they see for posting a story)

    There is a better solution for the third point:

    1. Trigger the "share story" function through this link: instagram-stories://share. This link redirects you directly to the editing page. If you find a way to POST to this link in your header an image URI coded, it should open it. I’ve read different code examples and documentation (from instagram dev page) and you can share this content as background (image/video) or sticker. Spotify does something similar by posting the image as a sticker.

    It goes without saying that this will work when the website is opened in a phone and not in a desktop browser as in desktop you can’t post stories.

    Login or Signup to reply.
  2. The New York Times has done this.

    In iOS, it generates an Instagram Story, with the headline and lede of the respective news article.

    To do this, you’ll have press the "share" button on an iPhone and then "Instagram Stories."

    Auto generated Instagram Story, via The New York Times iOS app

    Twitter has also done this for quite a while.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search