This is a Plugin for Strapi headless CMS to download image links (or images in Pro version) from Instagram.
- Download last 20 image URLs from Instagram in every 10 minutes (on API call)
- Can download images from Carousel Albums
- Instagram Basic Authentication Implemented with long lived token
- Every config parameter is editable on Strapi Configuration Screen
- Image links stored in DB and provided throught standard API
- You can disable images by Strapi 'Draft' function
I developed a Pro payed version with the following features. If you interested just drop me an email to dev at webvibe dot io
.
- Download images into Media Library in a separate 'Instagram' folder.
- Download all images from your profile (not just the last 20)
- Download process runs in background with a pre specified intervall. Don't need to push "Download button"
If you have any other request just let me know!
npm i @webvibe-io/strapi-plugin-instagram
Important! Instagram authentication will not work on localhost
due API need to redirect into a public domain!
If you don't have a public domain (in a developer environment for example) you will need to create one. I prefer ngrok for this but you can use any other solution.
After you have a public domain please follow this steps:
- You can find configuration screen in Strapi at
Settings
menu. Open it and leave it. You will need it to fill App Id and Secret. - Create an App at Meta Developer tools platform
- In the "App settings" you will find "Basic Display" menu. Open it and look for "Instagram App ID" and "Instagram App Secret".
- Copy App Id and Secret fields from Meta Platform to Strapi configuration screen.
- Save the changes on configuration screen.
- Copy the three callback URL from configration to Basic Authentication screen and save changes
- If everything configured you can push
Authenticate
button and authenticate the plugin with Instagram. - After a seccessfull configuration the plugin have the necessary tokens what you can check on the configuration screen.
- Now you can use
Download Images
button to download Instagrams - Check Strapi's public role configuration for Instagram API access! Allow access to
find
for download instagram images! - You can check
Content manager
for downloadedInstagram Images
If your configuration done you can reach Instagram images with standard API request like
http://localhost:1337/api/instagram/images
This is a standard Strapi REST API so you can use any feature like filter.
Response
{"results":[],"pagination":{"page":1,"pageSize":25,"pageCount":0,"total":0}}
Download new images When making an API call, the plugin checks for new images every 10 minutes and downloads new URLs.
Refresh token When receiving images via API, the plugin checks if the token is older than 10 days. If it is older, then automatically update the Long Lived token.
If you have any error in the authentication process or the plugin don't have short or long lived token you should check Last Instagram Api response
and developer tool's console for error messages.
- With wrong callback URLs Instagram can't forward the token to Strapi. Please check the URLs and check that your public domain is working properly!
- If you don't change enything on the configuration screen you can't push
Save
button. Please cahange App Id or Secret to save changes! - You can't download images when there is no token. Please check your tokens on the configuration screen!
In order for the database to save emoji's properly you should make sure the encoding of both the table & connection is set to utf8mb4
. For the connection this can be done by adding the following line to your database configuration (in /config/database.js
) in the connection configuration:
charset: env('DATABASE_CHARSET', 'utf8mb4'),
If you think you found a problem or bug feel free to open an Issue at Github
- Strapi Instagram Plugin stores authentication tokens in Strapi's database. I think this has low risk.
- With public access to REST API endpoints you may have a risk somebody have access your Instagram pictures and comments. You can avoid this if you use some kind of firewall to protect you URLs and allow only your frontend to reach API.