Posts tagged with instagram-api

I hope your day is going well. When I make a request using this endpoint:

  url = "https://graph.instagram.com/access_token"   params = {       "grant_type": "ig_exchange_token",       "client_secret": client_secret,       "access_token": short_lived_access_token   } 

I encounter the following error:

{'error': {'message': 'Unsupported request - method type: post', 'type': 'IGApiException', 'code': 100, 'fbtrace_id': 'Ape_-PbPFO_idh_eqtMB3jz'}} 

I'm unsure of the problem. I have added a verified business, but I have not submitted my app for app review. Should I do that first?

Additionally, it's not just this endpoint; I encounter issues with every endpoint I attempt to request, although I can obtain the short-lived access token without any issues.

I tried to exchange short lived token for the long lived once, and I was expecting to recieve the long lived token

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 !

I recently started a project, and the owner asked me to implement login with Instagram and fetch photos from Instagram However, I cannot see anything related to Instagram Basic Display in Facebook App Dashboard.

In my old app projects in Facebook, I see there is a Add a Product section which includes different products that facebook offers. I also see App Mode in them where I cannot see that toggle switch in the problematic app.

Any suggestion is appreciated.

I published the app to see whether it will change, without some of my use cases, however, nothing changed.

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!

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!