{"id":20747975,"url":"https://github.com/vicchi/node-getpocket","last_synced_at":"2025-08-22T06:10:10.248Z","repository":{"id":23191837,"uuid":"26548234","full_name":"vicchi/node-getpocket","owner":"vicchi","description":"Node.js module for authenticating and accessing the GetPocket API","archived":false,"fork":false,"pushed_at":"2018-03-13T15:36:10.000Z","size":14,"stargazers_count":48,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-28T12:04:36.766Z","etag":null,"topics":["getpocket","javascript","node-js","pocket-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vicchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-12T17:44:44.000Z","updated_at":"2025-01-25T18:15:33.000Z","dependencies_parsed_at":"2022-08-21T21:30:47.271Z","dependency_job_id":null,"html_url":"https://github.com/vicchi/node-getpocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vicchi/node-getpocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fnode-getpocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fnode-getpocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fnode-getpocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fnode-getpocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vicchi","download_url":"https://codeload.github.com/vicchi/node-getpocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fnode-getpocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271594379,"owners_count":24786707,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["getpocket","javascript","node-js","pocket-api"],"created_at":"2024-11-17T08:14:56.184Z","updated_at":"2025-08-22T06:10:10.216Z","avatar_url":"https://github.com/vicchi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-getpocket [![Build Status](https://travis-ci.org/vicchi/node-getpocket.svg?branch=master)](https://travis-ci.org/vicchi/node-getpocket)\n\nA Pocket API client for Node.js.\n\n## Installation\n\n```bash\nnpm install node-getpocket\n```\n\n## Authentication\n\nThe Pocket API uses a variant on OAuth 2.0 to authenticate access. This means writing some\ncode to negotiate the OAuth handshaking process. If the next steps make no sense, or\nthis seems too much like hard work or if you just want to get on with writing code to\nmake your app ... work, then `node-getpocket` includes a thing called `authorise.js` to\nmake this process a little bit less convoluted. Running ...\n\n```bash\nnode authorise --consumerkey 'YOUR-CONSUMER-KEY'\n```\n\n... from within wherever you've installed `node-getpocket` (typically in `node_modules/node-getpocket`)\nwill do the OAuth authorisation dance for you; just point your browser to `http://localhost:8080`. Running ...\n\n```bash\nnode authorise --help\n```\n\n... will show you how to change the host name or IP address and the port number `authorise` listens on.\n\n### Obtaining a Platform Consumer Key\n\nYou'll need to register your app with Pocket by filling in the _Create an Application_ form at http://getpocket.com/developer/apps/new.\n\nWatch out. The permissions you specify when you register your application are carved in tablets of stone once you've registered. Or to put it another way, you can't change permissions for a registered application once it's been registered. It's a good idea at this point to work out what you want to do with the Pocket API and make sure you select the right set of permissions from the choices of _Add_, _Modify_ or _Retrieve_.\n\nOnce you've completed registration you'll have your _consumer key_, which you'll need to authenticate with the Pocket API.\n\nNow you'll need to write some code. The example code here uses the `Express` framework to make handling the OAuth redirection and callbacks easy, but you're not constrained to using this framework.\n\nThe aim here is to pass the Pocket API your `consumer_key` and eventually get back and store an `access_token` which you'll need to use together with the `consumer_key` to access the Pocket API's methods in the future.\n\n### Get a Request Token\n\nYou need to create an instance of the `GetPocket` class and pass the Pocket API's _Consumer Key_ to the `GetPocket.getRequestToken` method, passing a callback that will receive the request token or handle any errors.\n\n```javascript\nvar GetPocket = require('node-getpocket');\n\nvar config = {\n    consumer_key: 'YOUR-CONSUMER-KEY',\n    redirect_uri: 'http://localhost:8080/redirect'\n};\n\nvar pocket = new GetPocket(config);\nvar params = {\n    redirect_uri: config.redirect_uri\n};\npocket.getRequestToken(params, function(err, resp, body) {\n    if (err) {\n        console.log('Oops; getTokenRequest failed: ' + err);\n    }\n    else {\n        // your request token is in body.code\n        var json = JSON.parse(body);\n        var request_token = json.code;\n    }\n});\n```\n### Redirect the User to Pocket for Permission\n\nAssuming you've stored your _request token_ somewhere safe, you'll\nnow need to get Pocket's authorization URL and redirect your\nauthenticating user to that URL. If you're using the `Express`\nframework, the `redirect` method is the one you need here.\n\n```javascript\nvar config = {\n    consumer_key: 'YOUR-CONSUMER-KEY',\n    request_token: 'YOUR-REQUEST-TOKEN'\n};\nvar url = pocket.getAuthorizeURL(config);\n// work whatever redirect magic you need here\n```\n\n### Handle the Pocket API's Callback\n\nProviding you've granted your application permissions to access\nthe Pocket API using your account's credentials, the API will\nreturn to your application by opening the URL you specified as\nthe `redirect_uri` property of your configuration parameters.\nHow you enable this to run depends on how you're handling URLs\nin your application. If you're using `Express` then queueing\na handler for `redirect` will work.\n\n### Convert the Request Token to an Access Token\n\nWithin your redirect callback, you'll finally be able to get\nyour application's `access_token`, that you'll need to pass,\ntogether with your `consumer_key` to all subsequent calls to\nthe Pocket API by calling `GetPocket.getAccessToken`.\n\n```javascript\nvar params = {\n    request_token: 'YOUR-REQUEST-TOKEN'\n};\npocket.getAccessToken(params, function(err, resp, body) {\n    if (err) {\n        console.log('Oops; getTokenRequest failed: ' + err);\n    }\n    else {\n        // your access token is in body.access_token\n        var json = JSON.parse(body);\n        var access_token = json.access_token;\n    }\n});\n```\n\n## Configuration\n\nBefore using the `GetPocket` class you'll need to have authenticated\nwith the Pocket API as described above. If you want to use\nsubsequent Pocket API calls in the same session as authenticating, then you can call `GetPocket.refreshConfig` passing a `config` object containing the `consumer_key` and `access_token`.\n\n```javascript\nvar config = {\n    consumer_key: 'YOUR-CONSUMER-KEY',\n    access_token: 'YOUR-ACCESS-TOKEN'\n};\npocket.refreshConfig(config);\n```\n\nThis is the same `config` object that you'll create a new instance of the `GetPocket` class, passing in the `consumer_key` and `access_token` that you got back during authentication and have stored away for future use somewhere. You did store that `access_token` didn't you?\n\n```javascript\nvar config = {\n    consumer_key: 'YOUR-CONSUMER-KEY',\n    access_token: 'YOUR-ACCESS-TOKEN'\n};\nvar pocket = new GetPocket(config);\n```\n\n## Usage\n\n### `add` - Add an Entry to a Pocket Queue\n\n```javascript\nvar params = {\n    url: 'url to add', // (required),\n    title: 'title', // (optional),\n    tags: 'tag,tag,...', // (optional)\n    tweet_id: 'id' // (optional)\n};\npocket.add(parms, function(err, resp) {\n    // check err or handle the response\n});\n```\n\nSee the Pocket API documentation at http://getpocket.com/developer/docs/v3/add for the latest\nparameters.\n\n**Code Health Warning**: your `consumer_key` **must** have _add_ permissions.\n\n### `send` - Modify an Existing Entry in a Pocket Queue\n\n```javascript\nvar params = {\n    actions: [\n        // array of actions; too many options to list here\n        // see the official Pocket API documentation\n    ]\n};\npocket.send(params, function(err, resp) {\n    // check err or handle the response\n});\n```\n\nSee the Pocket API documentation at http://getpocket.com/developer/docs/v3/modify for the latest\nparameters.\n\n**Code Hint**: the Pocket API call to modify is called `send`.\nWhich makes sense. Sort of. `GetPocket` tries to be helpful by\nproviding `GetPocket.modify` which just calls `GetPocket.send`.\n\n**Code Health Warning**: your `consumer_key` **must** have _modify_ permissions.\n\n### `get` - Retrieve an Entry in a Pocket Queue\n\n```javascript\nvar params = {\n    // get/retrieve/search parameters\n};\npocket.get(params, function(err, resp) {\n    // check err or handle the response\n});\n```\n\nSee the Pocket API documentation at http://getpocket.com/developer/docs/v3/retrieve for the latest\nparameters.\n\n**Code Hint**: the Pocket API call to retrieve or search is called `get`.\nWhich makes sense. Sort of. `GetPocket` tries to be helpful by\nproviding `GetPocket.retrieve` which just calls `GetPocket.get`.\n\n**Code Health Warning**: your `consumer_key` **must** have _retrieve_ permissions.\n\n### `archive` - Move an Item to the User's Archive\n\n`GetPocket.archive` is a helper function to call `GetPocket.send` with the actions neccessary to archive an item. This may or may not\nbe helpful to be honest.\n\n```javascript\nvar params = {\n    //     item_id: 'item to archive'\n    // };\npocket.archive(params, function(err, resp) {\n    // check err, resp\n});\n```\n\n### `delete` - Permanently remove an Item from the User's account\n\n`GetPocket.delete` is a helper function to call `GetPocket.send` with the actions neccessary to delete an item.\nThis may or may not be helpful to be honest.\n\n```javascript\nvar params = {\n    //     item_id: 'item to delete'\n    // };\npocket.delete(params, function(err, resp) {\n    // check err, resp\n});\n```\n\n## Changelog\n\n### 1.0.3\n\n* 2017/07/11 - add test cases for `get` and `delete`.\n\n### 1.0.2\n\n* 2017/07/11 - add integration with TravisCI for upcoming tests.\n\n### 1.0.1\n\n* 2017/07/10 - add `delete` action to the API wrapper.\n\n### 1.0.0\n\n* 2014/12/02 - this is the first version of `node-getpocket`. Be gentle.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicchi%2Fnode-getpocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvicchi%2Fnode-getpocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicchi%2Fnode-getpocket/lists"}