Hooks
Hooks is a webhook application used for connecting applications together. It is an event based system that has a number of triggers or listeners. You can access the Hooks system under Automation > Hooks. Some typical use cases for Hooks include
- Connect forms to your CRM. When a new user fills out a form, they are added to a CRM.
- Page cache updates. In the case you use an external page cache, you can be notified of a page edit, and you can send that page contents to your caching engine.
- Share information with Slack. Based on an action you can seamlessly connect this to a Slack channel via a REST API.
- Compliance. Notify your compliance team when a webpage has changed.
Each Hook must be given a Name, an Entity and a Method.
Entities
Hooks listeners are currently available on the following entities or modules:
- Blogs
- Blog
- Post
- Comment
- Books
- Book
- Unit
- Page
- Common
- Category
- Custom Field
- Global Component
- Tag
- Widget
- Documentation
- Page
- Comment
- Comment Vote
- Files
- File
- File comment
- File share
- Folder
- Folder comment
- Image
- Hooks
- Hook
- Mailer
- Batch
- Menus
- Menu
- Menu Element
- Pages
- Page
- Products
- Product
- Product Variant
- Product Description
- Category
- Category Description
- Rewrites
- Rewrite
- Scheduler
- Task
- Sites
- Client
- Site
- Environment
- Hostname
- Users
- Person
- Group
- User
Methods
Based on these entities you are able to apply a listener to certain methods. These currently are
- Created
- Updated
- Deleted
For example, you can have a listener waiting for changes to a Page, in this case, you would create a Hook for the Page entity and the method would be Updated. Based on this listener you can then take one or more actions.
Actions
Current actions supported:
- Create File
- Send Email
- HTTP Request
These actions are performed in the order they are listed in.
Create File
You can create a file based on a template located in templates /hooks/ folder.
Output file: This will create a file in folder /hooks/{hookName}/{batchId}/{actionId}. If no file name specified, the action-{actionId} will be used as filename.
Send Email
You can send an email based on a template located in templates/hooks/ folder.
You can specify the following details:
- From email address
- From name
- To email address
- To name
- Email subject
- Description