{"id":22450273,"url":"https://github.com/haykam821/shortcuts.js","last_synced_at":"2025-08-01T23:31:27.059Z","repository":{"id":57358751,"uuid":"149802608","full_name":"haykam821/Shortcuts.js","owner":"haykam821","description":"A simple library for Apple's Shortcuts.","archived":false,"fork":false,"pushed_at":"2020-01-20T18:22:21.000Z","size":678,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T17:15:45.304Z","etag":null,"topics":["api","shortcuts"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haykam821.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-09-21T18:29:54.000Z","updated_at":"2024-08-14T03:06:24.000Z","dependencies_parsed_at":"2022-09-06T22:21:47.703Z","dependency_job_id":null,"html_url":"https://github.com/haykam821/Shortcuts.js","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haykam821%2FShortcuts.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haykam821%2FShortcuts.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haykam821%2FShortcuts.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haykam821%2FShortcuts.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haykam821","download_url":"https://codeload.github.com/haykam821/Shortcuts.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228414003,"owners_count":17915931,"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":["api","shortcuts"],"created_at":"2024-12-06T05:14:37.527Z","updated_at":"2024-12-06T05:14:38.243Z","avatar_url":"https://github.com/haykam821.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shortcuts.js\n\n[![GitHub release](https://img.shields.io/github/release/haykam821/Shortcuts.js.svg?style=popout\u0026label=github)](https://github.com/haykam821/Shortcuts.js/releases/latest)\n[![npm](https://img.shields.io/npm/v/shortcuts.js.svg?style=popout\u0026colorB=red)](https://www.npmjs.com/package/shortcuts.js)\n[![Travis (.com)](https://img.shields.io/travis/com/haykam821/Shortcuts.js.svg?style=popout)](https://travis-ci.com/haykam821/Shortcuts.js)\n\nA simple library for Apple's Shortcuts.\n\n## Installation\n\nYou can install this module with NPM or [Yarn](https://yarnpkg.com/):\n\n```shell\nnpm install shortcuts.js\nyarn add shortcuts.js\n```\n\n## Usage\n\nFirst, you must require the library:\n\n```js\nconst shortcuts = require(\"shortcuts.js\");\n```\n\nAfterwards, you can use its methods. One of the simplest things you can do with this library is grab the ID from an iCloud URL. This is useful for more complex methods such as getting a shortcut's details from a user-submitted value, which might not always be just the ID.\n\n```js\n// Get an ID from a iCloud URL\nconst id = shortcuts.idFromURL(\"https://www.icloud.com/shortcuts/903110dea9a944f48fef9e94317fb686\");\n```\n\nIn addition, Shortcuts.js can retrieve metadata from the shortcut itself in addition to the overview information. This example uses promise chaining to get shortcut metadata from an iCloud URL:\n\n```js\n// Chain promises to get a shortcut's metadata\nshortcuts.getShortcutDetails(id).then(shortcut =\u003e {\n    console.log(`Hi, I'm ${id}! What's your name?`);\n    return shortcut.getMetadata();\n}).then(metadata =\u003e {\n    console.log(`I have ${metadata.actions.length} actions! How cool is that?`);\n}).catch(error =\u003e {\n    console.log(`${error.code}? How could this happen!`);\n});\n```\n\nThe following example uses [async/await](https://javascript.info/async-await) to achieve the same purpose:\n\n```js\nasync function getBasicInfo() {\n    const shortcut = await shortcuts.getShortcutDetails(id);\n    const metadata = await shortcut.getMetadata();\n\n    return `Hi! I'm ${shortcut.name}. I have ${metadata.importQuestions.length} import questions, and I'm happy to be here. What's your name?`;\n}\n\ngetBasicInfo().then(console.log).catch(error =\u003e {\n    console.log(`There was an error: ${error.code}. At least I can say that I tried...`);\n});\n```\n\n## Documentation\n\nDocumentation is available on [GitHub Pages](https://haykam821.github.io/Shortcuts.js/).\n\n## See also\n\n* [Shortcutify](https://github.com/haykam821/Shortcutify), the framework for building shortcuts with JavaScript.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaykam821%2Fshortcuts.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaykam821%2Fshortcuts.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaykam821%2Fshortcuts.js/lists"}