{"id":13697871,"url":"https://github.com/sectsect/wp-instagram-json","last_synced_at":"2026-01-14T01:13:26.873Z","repository":{"id":62541792,"uuid":"107350709","full_name":"sectsect/wp-instagram-json","owner":"sectsect","description":"📄 Generate JSON file with object data returned from Instagram API (for Sandbox Mode). Also upload the JSON file to AWS S3 (optional).","archived":false,"fork":false,"pushed_at":"2019-03-03T17:58:18.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T20:55:55.400Z","etag":null,"topics":["aws","aws-s3","instagram","instagram-api","json","s3","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sectsect.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-18T02:48:25.000Z","updated_at":"2022-06-22T07:14:35.000Z","dependencies_parsed_at":"2022-11-02T15:45:29.803Z","dependency_job_id":null,"html_url":"https://github.com/sectsect/wp-instagram-json","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sectsect/wp-instagram-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectsect%2Fwp-instagram-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectsect%2Fwp-instagram-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectsect%2Fwp-instagram-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectsect%2Fwp-instagram-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sectsect","download_url":"https://codeload.github.com/sectsect/wp-instagram-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectsect%2Fwp-instagram-json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-s3","instagram","instagram-api","json","s3","wordpress","wordpress-plugin"],"created_at":"2024-08-02T18:01:04.189Z","updated_at":"2026-01-14T01:13:26.867Z","avatar_url":"https://github.com/sectsect.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# \u003cimg src=\"https://github-sect.s3-ap-northeast-1.amazonaws.com/logo.svg\" width=\"28\" height=\"auto\"\u003e WP Instagram JSON\n[![Build Status](https://travis-ci.org/sectsect/wp-instagram-json.svg?branch=master)](https://travis-ci.org/sectsect/wp-instagram-json) [![PHP-Eye](https://php-eye.com/badge/sectsect/wp-instagram-json/tested.svg?style=flat)](https://php-eye.com/package/sectsect/wp-instagram-json) [![Latest Stable Version](https://poser.pugx.org/sectsect/wp-instagram-json/v/stable)](https://packagist.org/packages/sectsect/wp-instagram-json)  [![License](https://poser.pugx.org/sectsect/wp-instagram-json/license)](https://packagist.org/packages/sectsect/wp-instagram-json)\n\n### Generate JSON file with object data returned from Instagram API (for Sandbox Mode). Also upload the JSON file to AWS S3 (optional).\n\n## Why Sandbox Mode?\n\n### Understanding the Instagram API in three minutes\nIn order to work with the Instagram API, sooner or later, you must find your way through the nebulous API client registration and authorization process. Understanding the API access limitations can prevent a lot of wasted time, because they often result in unexpected data rather than straight-forward authentication errors that are easier to diagnose.\n\n### The infamous June 2016 API restrictions\nOn June 1 2016, console errors lit up all over the world when Instagram significantly restricted access to its API. The first thing to understand is that it was a deliberate business decision by Instagram, designed to prevent their API from being used for a variety of purposes. Understanding this fact will not fix the errors in the console, but it makes the restrictions more intuitive to work around if you understand their intent.\n\n### Sandbox mode vs \"live\" mode\nThe gatekeeper between developers and full API access is called sandbox mode. The documentation presents it as a temporary step in the development process, but the overwhelming majority of projects will never leave sandbox mode because Instagram only grants full access to their API for a handful of very specific use cases:\n- “My app allows people to login with Instagram and share their own content”\n- “My product helps brands and advertisers understand, manage their audience and media rights.”\n- “My product helps broadcasters and publishers discover content, get digital rights to media, and share media with proper attribution.”\n\nIf you cannot convince the Instagram lords that your app serves one of these specific purposes, it will be rejected if you submit it to “Go live”.  \nFor this reason, it may be more intuitive to think of it as “sideline mode”.\n\n### What can you do while in sandbox mode?\n- Apps in sandbox are restricted to 10 users\n- Data is restricted to the 10 users and the 20 most recent media from each of those users\n- Reduced API [rate limits](https://www.instagram.com/developer/limits/) `500/hour`\n\nvia @ https://www.instagram.com/developer/sandbox/\n\n\n#### So I have developed this Plugin to generate JSON files at scheduled times for the data returned from Instagram API under those conditions. And also I added a feature to upload that JSON file to AWS S3. This is also for performance optimization :tada:  \n\n\n## Requirements\n\n- PHP 5.5+\n- [Composer](https://getcomposer.org/)\n\n## Installation\n\n1. Clone this Repo into your `wp-content/plugins` directory.\n  ```sh\n  $ cd /path-to-your/wp-content/plugins/\n  $ git clone git@github.com:sectsect/wp-instagram-json.git\n  ```\n\n2. Install composer packages\n  ```sh\n  $ cd wp-instagram-json/functions/composer/\n  $ composer install\n  ```\n\n3. Activate the plugin through the 'Plugins' menu in WordPress.\u003cbr\u003e\n\n4. Go to `Instagram` on your wordpress admin panel.\n\n5. Set the following values and save it once.\n  - Cache Expire `(min)`\n  - Count `(Range: 1-20)`\n  - Account Name\n  - Access Token :warning: You need get Instagram API Access Token  in advance.\n\n6. If you wanna upload JSON files to AWS S3, also fill in the following items (optional).\n  - S3 Upload `(ON/OFF Toggle)`\n  - AWS credentials key\n  - AWS credentials secret\n  - Region\n  - Bucket name\n  - The Path on S3\n  - Custom URL (CDN)\n\n7. Furthermore, If you use AWS CloudFront Invalidation, fill in the following items (optional).\n  - CloudFront Invalidation `(ON/OFF Toggle)`\n  - Distribution ID\n\nThat's it:ok_hand:  \nA file will be generated at the time of the first web access into the following location.  \n```\n/wp-content/plugins/wp-instagram-json/json/instagram.json\n```\n\nNow, you can get the URL with javascript variable `wp_ig_json.json_url`.  \n:pushpin: If S3 Upload is enabled, this URL is automatically replaced to URL for S3.\n\n## Saved Object Structure\n```json\n{  \n  \"pagination\":[  \n\n  ],\n  \"data\":[  \n    {  \n      \"id\":\"\",\n      \"user\":{  \n        \"id\":\"\",\n        \"full_name\":\"\",\n        \"profile_picture\":\"\",\n        \"username\":\"\"\n      },\n      \"images\":{  \n        \"thumbnail\":{  \n          \"width\":150,\n          \"height\":150,\n          \"url\":\"\"\n        },\n        \"low_resolution\":{  \n          \"width\":320,\n          \"height\":320,\n          \"url\":\"\"\n        },\n        \"standard_resolution\":{  \n          \"width\":640,\n          \"height\":640,\n          \"url\":\"\"\n        }\n      },\n      \"created_time\":\"\",\n      \"caption\":{  \n        \"id\":\"\",\n        \"text\":\"\",\n        \"created_time\":\"\",\n        \"from\":{  \n          \"id\":\"\",\n          \"full_name\":\"\",\n          \"profile_picture\":\"\",\n          \"username\":\"\"\n        }\n      },\n      \"user_has_liked\":,\n      \"likes\":{  \n        \"count\":\n      },\n      \"tags\":[  \n\n      ],\n      \"filter\":\"\",\n      \"comments\":{  \n        \"count\":\n      },\n      \"type\":\"\",\n      \"link\":\"\",\n      \"location\":,\n      \"attribution\":,\n      \"users_in_photo\":[  \n\n      ],\n      \"carousel_media\":[  \n        {  \n          \"images\":{  \n            \"thumbnail\":{  \n              \"width\":150,\n              \"height\":150,\n              \"url\":\"\"\n            },\n            \"low_resolution\":{  \n              \"width\":320,\n              \"height\":320,\n              \"url\":\"\"\n            },\n            \"standard_resolution\":{  \n              \"width\":640,\n              \"height\":640,\n              \"url\":\"\"\n            }\n          },\n          \"users_in_photo\":[  \n\n          ],\n          \"type\":\"\"\n        },\n        {  \n          \"images\":{  \n            \"thumbnail\":{  \n              \"width\":150,\n              \"height\":150,\n              \"url\":\"\"\n            },\n            \"low_resolution\":{  \n              \"width\":320,\n              \"height\":320,\n              \"url\":\"\"\n            },\n            \"standard_resolution\":{  \n              \"width\":640,\n              \"height\":640,\n              \"url\":\"\"\n            }\n          },\n          \"users_in_photo\":[  \n\n          ],\n          \"type\":\"image\"\n        }\n      ]\n    },\n\t{\n\t  \"id\":\"\",\n\t  ...\n    }\n  ],\n  \"meta\":{  \n    \"code\":200\n  },\n  \"file_generate_datetime\":\"2019\\/12\\/31 00:00:00\"\n}\n```\n\n\n## NOTES for Developer\n\n- This plugin does not do anything on the Front-end. Just generate a JSON file.  \nYou can access the generated json file in any way you like and output it to the Front-end.  \nSee [Usage Example](#usage-example).\n\n- WordPress built-in cron has some problems with the specific environment.   \nIn order to avoid those risks, this Plugin uses periodic processing for WordPress [Transient](https://codex.wordpress.org/Transients_API) instead of `WP-Cron`.\n\n- This plugin internally uses [AWS SDK for PHP](https://github.com/aws/aws-sdk-php) v3.\n\n- AWS CloudFront Invalidation works only when `Delete cache` in manual.  \nIt does not work when the cache expires.\n\n## Usage Example\n\n:memo: If you host that file on AWS S3, you also need to configure `CORS`(Cross-Origin Resource Sharing) on S3.\n\n### Ajax with jQuery (ES6)\n\n```html\n\u003cdiv id=\"app\"\u003e\n  \u003cul id=\"instagram\"\u003e\u003c/ul\u003e\n\u003c/div\u003e\n```\n\n```javascript\njQuery(() =\u003e {\n  jQuery.ajax({\n    url: wp_ig_json.json_url,\n    type: \"GET\",\n    dataType: 'json',\n    beforeSend() {}\n  }).done(res =\u003e {\n    if (res \u0026\u0026 res.data) {\n      let list = '';\n      jQuery.each(res.data, (i, {id, link, images}) =\u003e {\n        list += `\u003cli data-id=\"${id}\"\u003e\n                  \u003ca href=\"${link}\" target=\"_blank\"\u003e\n                    \u003cimg src=\"${images.standard_resolution.url}\"\u003e\n                  \u003c/a\u003e\n                \u003c/li\u003e`;\n      });\n      jQuery('#instagram').html(list);\n    }\n  }).fail(() =\u003e {\n    alert(\"Load Error. Please Reload...\");\n  }).always(res =\u003e {\n    jQuery('#instagram').addClass('ready');\n  });\n});\n```\n\n### Ajax with Vue.js\n\n```html\n\u003cdiv id=\"app\" v-cloak\u003e\n  \u003cul id=\"instagram\" :class='{\"ready\": readyclass !== null}'\u003e\n    \u003cli v-for=\"photo in photos\" v-bind:data-id=\"photo.id\"\u003e\n      \u003ca v-bind:href=\"photo.link\" target=\"_blank\"\u003e\n        \u003cimg v-bind:src=\"photo.images.standard_resolution.url\" /\u003e\n      \u003c/a\u003e\n    \u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/div\u003e\n```\n\n```javascript\nimport Vue from 'vue';\nimport axios from 'axios';\n\nconst app = new Vue({\n  el: '#app',\n  props: {\n    'readyclass': null,\n  },\n  data: {\n    photos: [],\n    errors: [],\n  },\n  created() {\n    axios.get(wp_ig_json.json_url)\n      .then((response) =\u003e {\n        if (response.status === 200 \u0026\u0026 response.data.data.length \u003e 0) {\n          this.photos = response.data.data;\n        }\n      })\n      .catch((e) =\u003e {\n        this.errors.push(e);\n      });\n  },\n  updated() {},\n});\n```\n\n#### async / await version\n```javascript\nimport Vue from 'vue';\nimport axios from 'axios';\n\nconst app = new Vue({\n  el: '#app',\n  props: {\n    'readyclass': null,\n  },\n  data: {\n    photos: [],\n    errors: [],\n  },\n  async created() {\n    try {\n      const response = await axios.get(wp_ig_json.json_url);\n      if (response.status === 200 \u0026\u0026 response.data.data.length \u003e 0) {\n        this.photos = response.data.data;\n      } else {\n        console.log('Error!!');\n      }\n    } catch (e) {\n      this.errors.push(e);\n    }\n  },\n  updated() {},\n});\n```\n\n## AWS S3\n\n### IAM Role Policy\n\nMake a user on AWS, and attach the policy to the user.  \nThe following are the required minimum policies.\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:PutObject\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\nIf you use AWS CloudFront Invalidation\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:PutObject\",\n                \"cloudfront:CreateInvalidation\",\n                \"cloudfront:GetDistribution\",\n                \"cloudfront:GetInvalidation\",\n                \"cloudfront:GetStreamingDistribution\",\n                \"cloudfront:GetDistributionConfig\",\n                \"cloudfront:ListDistributions\",\n                \"cloudfront:ListInvalidations\",\n                \"cloudfront:ListStreamingDistributions\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\n## Change log  \n\nSee [CHANGELOG](https://github.com/sectsect/wp-instagram-json/blob/master/CHANGELOG.md) file.\n\n## Contributing\n\n1. Create an issue and describe your idea\n2. [Fork it](https://github.com/sectsect/wp-instagram-json/fork)\n3. Create your feature branch (`git checkout -b my-new-feature`)\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Publish the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n7. Profit! :white_check_mark:\n\n## License\n\nSee [LICENSE](https://github.com/sectsect/wp-instagram-json/blob/master/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectsect%2Fwp-instagram-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsectsect%2Fwp-instagram-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectsect%2Fwp-instagram-json/lists"}