Jump to Content

Objective HTML

Postmaster

The definitive email solution for ExpressionEngine

Hooks


What is a hook?

Hooks were introduced to Postmaster v1.2 and are really the missing link to making to a complete application with notifications occur at anytime. Hooks are a native to ExpressionEngine, and a way for developers to add "insertion points" for other developers to execute custom logic and change the core functionality. In the case of Postmaster, hooks can be used to send email and pass custom variables to the email parser. Every hook in ExpressionEngine, first or third-party, is included by default. Advanced integration is possible by extending the core Base_hook class.


Installing hooks

Before you can use a hook, you must install it using the ExpressionEngine control panel. Go to Add-ons > Modules > Postmaster > New Hook. The hooks setup is a lot like a parcel. Hooks can even have their own unique settings UI for advanced configurations.


Pre-defined Hooks

Postmaster has a growing catalog of campatible hooks. These hooks are ones that developers have included advanced support for Postmaster to pass custom variables which can be parsed inside email templates. Custom logic can also be performed inside these hooks, with unique settings panes, so developers can really deliver whatever feature is required.


User-defined Hooks

If a developer hasn't included support for a specific hook you require, it will still work within Postmaster. However, you emails will have to be pretty much static in the sense that no hook specific variables will be passed to the template. You can still use all the EE tags you are desired. To use a user-defined hook, simply enter the name of the hook you are want to use and Postmaster will start sending emails when it is triggered.


Template Variables

Hooks have a set of default templates variables. Each hook can pass custom variables, entry data to be parsed against the respected fieldtype, and member data.

Member Variables

All of the following member variables are available by default. The default member is the member that is currently logged in while triggering the hook. If no member is logged in, these variable won't be available unless the desired hook overrides the default functionality.


{member:member_id}
{member:group_id}
{member:email}
{member:username}
{member:screename}
{member:custom_member_field}
Hook Variables

Note, these variables are not available by default. Rather, this is the syntax any given hook will follow to parse variables and channel data.


{hook:some_var}
{hook:entry_id}
{hook:custom_field}
{hook:custom_tag_pair}
	....
{/hook:custom_tag_pair}