• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2section: cli-commands
3title: npm-hook
4description: Manage registry hooks
5---
6
7# npm-hook(1)
8
9## Manage registry hooks
10
11### Synopsis
12
13```bash
14npm hook ls [pkg]
15npm hook add <entity> <url> <secret>
16npm hook update <id> <url> [secret]
17npm hook rm <id>
18```
19
20### Example
21
22Add a hook to watch a package for changes:
23```bash
24$ npm hook add lodash https://example.com/ my-shared-secret
25```
26
27Add a hook to watch packages belonging to the user `substack`:
28```bash
29$ npm hook add ~substack https://example.com/ my-shared-secret
30```
31
32Add a hook to watch packages in the scope `@npm`
33```bash
34$ npm hook add @npm https://example.com/ my-shared-secret
35```
36
37List all your active hooks:
38```bash
39$ npm hook ls
40```
41
42List your active hooks for the `lodash` package:
43```bash
44$ npm hook ls lodash
45```
46
47Update an existing hook's url:
48```bash
49$ npm hook update id-deadbeef https://my-new-website.here/
50```
51
52Remove a hook:
53```bash
54$ npm hook rm id-deadbeef
55```
56
57### Description
58
59Allows you to manage [npm hooks](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm),
60including adding, removing, listing, and updating.
61
62Hooks allow you to configure URL endpoints that will be notified whenever a
63change happens to any of the supported entity types. Three different types of
64entities can be watched by hooks: packages, owners, and scopes.
65
66To create a package hook, simply reference the package name.
67
68To create an owner hook, prefix the owner name with `~` (as in, `~youruser`).
69
70To create a scope hook, prefix the scope name with `@` (as in, `@yourscope`).
71
72The hook `id` used by `update` and `rm` are the IDs listed in `npm hook ls` for
73that particular hook.
74
75The shared secret will be sent along to the URL endpoint so you can verify the
76request came from your own configured hook.
77
78### See Also
79
80* ["Introducing Hooks" blog post](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm)
81