I know that there is no api function to send the photo. But maybe there are some methods to do this from JS?
Asked
Active
Viewed 9,796 times
2
-
Have you tried something yourself? – node_modules Mar 23 '16 at 08:23
-
@C0dekid, no, just look to the api documentation. you know the solution? – name Mar 23 '16 at 11:23
-
No, I don't think this can be done with javascript only. – node_modules Mar 23 '16 at 11:24
-
@C0dekid, I watched [link](http://stackoverflow.com/questions/18844706/how-to-post-pictures-to-instagram-using-api). But I do not want to use PHP – name Mar 23 '16 at 11:35
-
The instagram API requires `PHP Curl` if you want to do it with your website. So technically you have to use PHP if you want to use the API for your website. You can combine `PHP` and `Javascript` together with the `$.ajax()` function in `jQuery`. So javascript only can't be done, i'm sorry. – node_modules Mar 23 '16 at 11:37
-
@C0dekid, thanks for the help. – name Mar 23 '16 at 11:48
2 Answers
0
Now Instagram does allow Content Publishing from their API.
Example from docs:
API Example
Let's say you have a photo at https://www.example.com/images/bronz-fonz.jpg
that you want to publish with the hashtag "#BronzFonz" as its caption. You could use the POST /{ig-user-id}/media
endpoint to create the container like this:
Sample Request
POST graph.facebook.com/17841400008460056/media
?image_url=https//www.example.com/images/bronz-fonz.jpg
&caption=#BronzFonz
This would return a container ID (let's say 17889455560051444
), which you would then publish using the POST /{ig-user-id}/media_publish
endpoint, like this:
Sample Request
POST graph.facebook.com/17841405822304914/media_publish
?creation_id=17889455560051444
Wrapping those with JS shouldn't be a problem.

Josemy
- 810
- 1
- 12
- 29
-1
var userFeed = new Instafeed({
get: 'user',
target: "instafeed-container",
resolution: 'low_resolution',
accessToken: 'your generated token'
});
userFeed.run();
a img {
width: 25%;
}
<!DOCTYPE html>
<html>
<head>
<title>Instafeed on Your Website</title>
<script src="https://cdn.jsdelivr.net/gh/stevenschobert/instafeed.js@2.0.0rc1/src/instafeed.min.js"></script>
</head>
<body>
<h1 style="text-align: center">Instagram Feed</h1>
<div id="instafeed-container"></div>
</body>
</html>

Sven Eberth
- 3,057
- 12
- 24
- 29

user16479896
- 1
- 1
-
4Welcome to Stack Overflow! Code-only answers are not particularly helpful. Please add some descriptions of how this code solves the problem. – Sven Eberth Jul 19 '21 at 12:43