{"id":13624585,"url":"https://github.com/Elyx0/instagram-inbox-api","last_synced_at":"2025-04-16T00:32:50.548Z","repository":{"id":70500371,"uuid":"92923984","full_name":"Elyx0/instagram-inbox-api","owner":"Elyx0","description":"📬  Node.js web API for accessing Instagram private messages to couple with a frontend","archived":false,"fork":false,"pushed_at":"2017-06-02T18:48:07.000Z","size":12,"stargazers_count":24,"open_issues_count":4,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-01T22:01:19.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Elyx0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-05-31T08:35:56.000Z","updated_at":"2024-04-18T00:49:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe6b02d5-482a-4f93-beea-1c64b9f89eea","html_url":"https://github.com/Elyx0/instagram-inbox-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elyx0%2Finstagram-inbox-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elyx0%2Finstagram-inbox-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elyx0%2Finstagram-inbox-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elyx0%2Finstagram-inbox-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Elyx0","download_url":"https://codeload.github.com/Elyx0/instagram-inbox-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223691684,"owners_count":17186862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T21:01:43.980Z","updated_at":"2024-11-08T13:30:46.777Z","avatar_url":"https://github.com/Elyx0.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Instagram Inbox Reading Web API [![Build Status][travis-image]][travis-url]\n\nA web api for reading instagram private inbox leveraging [micro](https://github.com/zeit/micro).\n\n## Output sample\n\n\n#### 1)  Request a token and get feeds and last message\nMethod | Endpoint  | Query Parameters\n------------ | ------------- | -------------\nPOST | /register | `{\"user\":\"[username]\",\"pass\":\"[accountPass]\"}`\n\n#### Request\nEg: From your frontend or else.\n```javascript\nfetch('http://localhost:3000/register', {\n  method: 'post',\n  headers: {\n    'Accept': 'application/json, text/plain, */*',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({user:'TheUser',pass:'ThePassword'})\n}).then(res=\u003eres.json())\n  .then(res =\u003e console.log(res));\n```\n\n#### Response\n\n```json\n{\n  \"data\": {\n    \"token\": \"3140d49ed8e7e216784b4effwefwf2326c610b00223a5d8fd315e\",\n    \"feeds\": [\n      {\n        \"accounts\": [\n          {\n            \"username\": \"y4g4m1\",\n            \"picture\": \"http://scontent-yyz1-1.cdninstagram.com/t51.2885-19/11248742_933430356713730_1934006097_a.jpg\",\n            \"fullName\": \"Yohan McDonald\",\n            \"id\": 559838015,\n            \"isPrivate\": false,\n            \"hasAnonymousProfilePicture\": false,\n            \"isBusiness\": false\n          }\n        ],\n        \"items\": [\n          {\n            \"id\": \"27590990389933559206179341506445312\",\n            \"type\": \"text\",\n            \"text\": \"potato\",\n            \"accountId\": 51027825,\n            \"created\": 1495710586089\n          }\n        ],\n        \"id\": \"340282366841710300949128130393065336903\"\n      },\n      {\n        \"accounts\": [\n          {\n            \"username\": \"axelleokok\",\n            \"picture\": \"http://scontent-yyz1-1.cdninstagram.com/t51.2885-19/s150x150/13259602_580319558808270_355488729_a.jpg\",\n            \"fullName\": \"Axelle Air\",\n            \"id\": 43672695,\n            \"isPrivate\": false,\n            \"hasAnonymousProfilePicture\": false,\n            \"isBusiness\": false,\n            \"profilePicId\": \"1256028245353702101_43672695\"\n          }\n        ],\n        \"items\": [\n          {\n            \"id\": \"27521541584252433622799407499968512\",\n            \"type\": \"text\",\n            \"text\": \"Why not\",\n            \"accountId\": 43672695,\n            \"created\": 1491945758789\n          }\n        ],\n        \"id\": \"340282366841710300949128141477819325231\"\n      },\n    ],\n    \"user\": {\n      \"id\": \"51027825\",\n      \"name\": \"elyx0\"\n    }\n  }\n}\n```\n\n#### 2)  Use the token, username and get feeds\nMethod | Endpoint  | Query Parameters\n------------ | ------------- | -------------\nPOST | /read/:id | `{\"user\":\"[user.nameFromPreviousCall]\",\"token\":\"[tokenFromPreviousCall]\"}`\n\nYou will need the feed id of the conversation you want to retrieve for ex `data.feeds[0].id`\n (340282366841710300949128130393065336903) in my example\n\n #### Request\n Eg: From your frontend or else.\n ```javascript\n fetch('http://localhost:3000/read/340282366841710300949128130393065336903', {\n   method: 'post',\n   headers: {\n     'Accept': 'application/json, text/plain, */*',\n     'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({user:'TheUser',token:'theTokenFromStep1'})\n }).then(res=\u003eres.json())\n   .then(res =\u003e console.log(res));\n ```\n#### Response\n\n```json\n{\n  \"data\": [\n    {\n      \"id\": \"27590990389933559206179341506445312\",\n      \"type\": \"text\",\n      \"text\": \"potato\",\n      \"accountId\": 51027825,\n      \"created\": 1495710586089\n    },\n    {\n      \"id\": \"27590986342924623648393706191454208\",\n      \"type\": \"media\",\n      \"media\": [\n        {\n          \"width\": 1080,\n          \"height\": 1920,\n          \"url\": \"https://scontent-yyz1-1.cdninstagram.com/t51.2885-15/e15/fr/p1080x1080/18723392_158530731350650_2257534157666123776_n.jpg?ig_cache_key=Mjc1OTA5ODYzNDI5MjQ2MjM2NDgzOTM3MDYxOTE0NTQyMDg%3D.2\"\n        }\n      ],\n      \"accountId\": 559838015,\n      \"created\": 1495710366700\n    },\n    {\n      \"id\": \"27590986175440915712521837108789248\",\n      \"type\": \"text\",\n      \"text\": \"Hello\",\n      \"accountId\": 559838015,\n      \"created\": 1495710357621\n    }\n  ]\n}\n```\n\n#### Logging out\nMethod | Endpoint  | Query Parameters\n------------ | ------------- | -------------\nPOST | /logout | `{\"user\":\"[user.nameFromInitialCall]\",\"token\":\"[tokenFromInitialCall]\"}`\n\n #### Request\n Eg: From your frontend or else.\n ```javascript\n fetch('http://localhost:3000/logout', {\n   method: 'post',\n   headers: {\n     'Accept': 'application/json, text/plain, */*',\n     'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({user:'TheUser',token:'theTokenFromStep1'})\n }).then(res=\u003eres.json())\n   .then(res =\u003e console.log(res));\n ```\n#### Response\n\n```json\n{\n  \"data\": {\n    \"success\": true\n  }\n}\n```\n\n## Errors\nAPI error will reply with a code `200`, a `name` and a `message` or `500` if something went really bad.\n\n```json\n{\n  \"error\": {\n    \"name\": \"AuthenticationError\",\n    \"message\": \"The password you entered is incorrect. Please try again.\"\n  }\n}\n```\n\n## Install\n\n* **Note: requires a node version \u003e= 6 and an npm version \u003e= 3.**\n\nClone the repo via git:\n\n```bash\ngit clone https://github.com/elyx0/instagram-inbox-api.git your-project-name\n```\n\nAnd then install dependencies.\n\n```bash\n$ cd your-project-name \u0026\u0026 npm install\n```\n\nThen run in dev mode\n```bash\n$ npm run dev\n```\n\nYou can then head to http://localhost:3000/ and should see the success response ✅.\n\n### Security\nSince there is no Oauth / Authorize with instagram for the Inbox endpoint\nYou will need to provide the user and pass of the account\n\n\u003e WE DO NOT STORE THE PASSWORD\n\nInstead the password is hashed using [sha256](https://stackoverflow.com/a/9316461/1659084) and the key of you choice (one way encryption) and used as the filename of your cookie that is used for authentication to instagram\n\n❗️You will need to create a `.env` file containing the following❗️\n```\nSECRET=yourSecretThatWillEncryptTheCredentials\nPORT=3000 //Optional if using Docker\n```\n\n\n\n:bulb: Or even better as an env using [Docker Secret](https://docs.docker.com/engine/swarm/secrets/)\n\nYou can run the [AVA](https://github.com/sindresorhus/ava) and [ESLint](http://eslint.org) tests using: `npm test`\n\n⚠️ If your frontend is in https and not the server hosting this, you might get a `Mixed Content` error. You need to setup a [SSL Nginx Proxy](http://tom.busby.ninja/letsecnrypt-nginx-reverse-proxy-no-downtime/)\n\n\n[travis-image]: https://travis-ci.org/Elyx0/instagram-inbox-api.svg?branch=master\n[travis-url]: https://travis-ci.org/Elyx0/instagram-inbox-api.git\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElyx0%2Finstagram-inbox-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElyx0%2Finstagram-inbox-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElyx0%2Finstagram-inbox-api/lists"}