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:


User does something on the website
The website generates some content based on user input
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
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 arround. Let's then copy a funcional method.
You create a button that says, "share on your instagram stories" and here's what it is gonna do:

Trigger a function on the back-end that creates a screenshot/image or a video of the content you want to share
Send that content to the user so it's the last content they have in the gallery
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)

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.
PS: I'm sure there is a way to send that content directly to the editing in the stories, so you don't have to select the image you sent to the client, but I didn't figure that out yet. Hope this works for you, cheers.
Share content of a webpage to Instagram story