Embeding plotly figures in javascript

Hi all,

In short, I have a flask application where I create some plots using Bokeh. I return them as json by doing the following:

return jsonify(json_item(figure, "my_figure"))

I am then able to embed this figure object to javascript by doing:

Bokeh.embed.embed_item(figure.data, "my_figure");

Now, I am trying to achieve the same but using plotly to create my figures. Any guidance on how this can be achieved?