Posts tagged with instagram

I'm making a request here:

https://graph.facebook.com/v20.0/<ig-hashtag-id>/top_media?user_id=<ig-user-id>&fields=id,caption,media_type,media_url,permalink 

example response:

{     "data": [         {             "id": "17887284382178689",             "caption": "Visual literature of Kalinga's interpretation of nature through geometric patterns. Propylene ink on wood.",             "media_type": "IMAGE",             "media_url": "https://scontent-mnl1-2.cdninstagram.com/v/t51.2885-15/25008622_432606043809405_4524106124818907136_n.jpg?_nc_cat=110&ccb=1-7&_nc_sid=18de74&_nc_ohc=BsfOfjgpxugQ7kNvgGvos4J&_nc_ht=scontent-mnl1-2.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AYDeM3F_FCkCYs9CO2eALcn-1Zc8cXRjDszE9bUIKvWYMA&oe=66E0275E",             "permalink": "https://www.instagram.com/p/Bc6461zHsE7/"         },         {             "id": "17866280464216878",             "caption": "\"Traversing Tabuk City to the sleepy town of Tinglayan is one of the roughest road I'v ever been to. Composed of narrow roads and limited pathways, this road is not for the faint hearted. You need to trust the driver maneuvering the vehicle and hopefully he brings you safely to your destination. .\n\nThe long hours of travel, there are no phone signals, the only thing you need to focus on is the view around you.\" 📸 jpxdavid",             "media_type": "IMAGE",             "media_url": "https://scontent-mnl1-2.cdninstagram.com/v/t51.2885-15/27894116_147572912599336_2290924483260710912_n.jpg?_nc_cat=109&ccb=1-7&_nc_sid=18de74&_nc_ohc=XIrmLk4n-EMQ7kNvgHJqdp5&_nc_ht=scontent-mnl1-2.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AYAAY49IH_uTMezzet35bt6n289oRKLOoAdNT1HijQMBJA&oe=66E0271A",             "permalink": "https://www.instagram.com/p/BfkudLeFQiL/"         }    ] } 

but I want to the location of the photo back. how can I do this? by location I mean the little string that appears above the photo in the feed

I am currently using the Instagram API to publish stories and I would like to know if it's possible to add clickable links directly within the stories via API.

Is there any official or unofficial way to achieve this programmatically through the Instagram API?

I appreciate any insights or examples that could point me in the right direction

Thank you very much !

Summary

I have been trying to publish reels on Instagram using the Instagram API. However, none of my attempts have worked so far.

My setup

  • I'm using an un-audited app on developers.facebook.com
  • I want to publish on an instagram page I own (business account)
  • This page was added to the app as an instagram tester

Documentation used

I have been following this page of the documentation on developers.facebook.com

My process

Step 1: OAuth

This part I did directly from the developer dashboard. The token I got has the following permissions:

  • business_basic
  • business_manage_messages
  • business_content_publish
  • business_manage_comments

Step 2: Create media container

For this part I'm doing just like the documentation says.

def create_instagram_media_container(ig_id: str, video_url: str, access_token: str):     url = f"https://graph.instagram.com/v20.0/{ig_id}/media"     headers = {         "Content-Type": "application/json",     }     data = {         "media_type": "REELS",         "video_url": video_url     }     response = requests.post(url, headers=headers, json=data)     if response.status_code == 200:         return response.json()     else:         response.raise_for_status() 

I am able to get a container ID with this step.

Note: After reading materials online, I have tried a few variations, including adding "Authorization": f"OAuth {access_token}" to the header and "upload_type": "resumable" to the data, but this didn't fixed it.

Step 3: Publish container

Once again, I am following the documentation.

def upload_instagram_video(ig_id: str, ig_container_id: str, access_token: str):     url = f"https://graph.instagram.com/v20.0/{ig_id}/media_publish"     headers = {         "Content-Type": "application/json"     }     data = {         "creation_id": ig_container_id,     }     response = requests.post(url, headers=headers, json=data)     if response.status_code == 200:         return response.json()     else:         response.raise_for_status() 

At this stage however, I get an error.

At first I had the following description:

b'{"error":{"message":"Unsupported post request. Object with ID \'[...]\' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\\/\\/developers.facebook.com\\/docs\\/graph-api","type":"GraphMethodException","code":100,"error_subcode":33,"fbtrace_id":"AKe1_Gl1c5kNSTrKHPYuyHG"}}'

But now I just get a 400 error stating "Sorry, this content isn't available right now".

Note: After reading materials online, I have also tried adding "Authorization": f"OAuth {access_token}" to the header here, but this didn't fixed it.

My thoughts

I have a few ideas as to where the confusion could be comming from, but I didn't really manage to make anything out of them.

  • Endpoints: I am querying the graph.instagram.com endpoint, but there is also a graph.facebook.com. This seemed a bit more complete, as the documentation mentions extra fields like caption, but I didn't manage to make it work either. I think I should still go with the Instagram one as the documentation states that "Unlike the Instagram API with Facebook Login, this API doesn't require a Facebook Page linked to the Instagram professional account." which seems simpler.
  • Token: Reading online, I could see some mentions of a difference between a page token and a user token. I didn't really understand the distinction. I generated my token directly from the "Instagram" tab of the developer website, and there is no such distinction there. From the migration guide I'd guess that it's not applicable in that case since I'm using the Instagram API setup with Instagram Login.

After trying for several days in a row, I am now completely lost. Your help would be greatly appreciated. Thank you!

We developed our own platform to schedule Instagram Posts via the Instagram Graph API.

It's working fine but we can't find a way to add linebreaks to the Reel Description.

We tried to use \n as well as some html tags like <p> but nothing works. It's like after publication, Instagram automatically deletes the spaces and reduces them to one space.

I know it's possible because some scheduling SAAS like Later can schedule Reels with linebreaks in the description.

I'm trying to find someone who solved the problem already. What should I try next? How to format the json?

Thanks, T.

I am trying to figure out how to approve an Instagram app which use instagram_basic and instagram_manage_messages.

I have created an app that offers to my customers a system to order and choose a Pick & Collect solution in my shops.

The app is working well in development mode but I keep getting rejection by Facebook Review team and I can't figure out why.

For instagram_basic, I have added this video: https://youtu.be/3kTJw-xegsY

And for instagram_manage_messages, this one: https://youtu.be/jvzUNG4q9qU

Any help would be greatly appreciated!