Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an example to cron hook #6188

Merged
merged 2 commits into from
Jun 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding an example to cron hook
  • Loading branch information
juancarlosjr97 committed Jun 10, 2021
commit d9d8fb9973566a566f1c63bda9767f2a9e675ae5
12 changes: 11 additions & 1 deletion docs/guides/api-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,17 @@ module.exports = function registerHook({ exceptions }) {

Hooks support running on an interval through [`node-cron`](https://www.npmjs.com/package/node-cron). To set this up,
provide a cron statement in the event scope as follows: `cron(<statement>)`, for example `cron(15 14 1 * *)` (at 14:15
on day-of-month 1) or `cron(5 4 * * sun)` (at 04:05 on Sunday).
on day-of-month 1) or `cron(5 4 * * sun)` (at 04:05 on Sunday). See example below:

```js
module.exports = function registerHook() {
return {
'items.create': function () {
axios.post('http://example.com/webhook');
},
rijkvanzanten marked this conversation as resolved.
Show resolved Hide resolved
};
};
```

## 3. Register your Hook

Expand Down