This Python script allows you to publish an image on Instagram using the Instagram Graph API.
- You need an access token from Instagram to authenticate your requests.
- Obtain your Instagram user ID.
- Provide the URL of the image you want to post.
- Make sure you have installed the necessary Python packages:
json
andrequests
. - Open the script and replace the following placeholders with your actual information:
ACCESS-TOKEN
: Replace with your Instagram access token.INSTAGRAM-ID
: Replace with your Instagram user ID.IMAGE-URL
: Replace with the URL of the image you want to post.
- Run the script.
# Replace the placeholders with your actual information
access_token = "YOUR-ACCESS-TOKEN"
ig_user_id = "YOUR-INSTAGRAM-ID"
image_url = "URL-OF-YOUR-IMAGE"
# Call the function
publish_image()
- Make sure you have the necessary permissions to post on Instagram using the Graph API.
- This script uses version 18.0 of the Facebook Graph API. Ensure compatibility with future versions if necessary..