Home » Developers » Action hooks reference
NiroHelp fires actions at every meaningful moment in a doc’s or a ticket’s
life. Hook them to post to Slack, log to your own table, sync to a CRM, or
anything else.
Note the naming is inconsistent by history: most ticket hooks use hyphens
(nirohelp-tickets-…), two use underscores (nirohelp_tickets_comment_added,
nirohelp_user_inserted). Copy the names exactly as written.
Tickets #
| Hook | Args | Fired when |
|---|---|---|
nirohelp-tickets-ticket_created |
$ticket |
A ticket is created — front-end form, embed widget or POST /tickets/. |
nirohelp-tickets-client_commented |
$ticket |
A client posts a comment. |
nirohelp-tickets-agent_commented |
$ticket |
An agent posts a comment. |
nirohelp-tickets-ticket_status_changed |
$new, $old, $ticket |
The status changed, and both statuses are registered NiroHelp statuses. |
nirohelp-tickets-ticket_status_{new}_to_{old} |
$ticket |
Same event, dynamic name. Note the order — new first, old second. |
nirohelp-tickets-agent_changed |
$new_agent_id, $old_agent_id |
The assigned agent changed. |
nirohelp_tickets_comment_added |
$comment_id, $ticket_id |
Low-level; fires inside the model before the role-specific hooks. |
nirohelp-tickets-ticket_model_status_changed |
(none) | Internal; fires in the Ticket model right after a status is set. |
nirohelp-tickets-login |
(none) | Fired by the four ticket views when the visitor is logged out. Front::show_login_form() listens on it. Hook it to render your own login UI. |
Because nirohelp-tickets-ticket_status_changed requires both statuses to be
registered, moving a ticket to Trash does not fire it — trash is not one
of NiroHelp’s statuses. That is deliberate: it stops a deletion sending
“resolved” emails and adding a bot note.
Auth and users #
| Hook | Args | Fired when |
|---|---|---|
nirohelp-tickets-code_generated |
$email, $code |
A 6-digit login code was generated. Controllers\Common\Email listens and sends it. |
nirohelp-tickets-magic_link_sent |
$email, $link |
A one-click login link was minted, in magic_link mode. Same listener. |
nirohelp-tickets-user_found |
$data |
An existing user was matched during login. |
nirohelp-logged_in |
$user_id |
A client was signed in through the ?nirohelplogin={key} flow. |
nirohelp_user_inserted |
$user_id |
A new NiroHelp client account was created. |
Docs #
| Hook | Args | Fired when |
|---|---|---|
nirohelp-doc_created |
$doc |
A doc is created through POST /docs/. |
nirohelp-before_doc_content |
$doc |
Inside the single-doc template, before the post body. |
nirohelp-after_doc_content |
$doc |
Inside the single-doc template, after the post body. The plugin’s own pagination and rating buttons hang off this. |
AI #
| Hook | Args | Fired when |
|---|---|---|
nirohelp_ai_auto_respond |
$ticket_id |
The auto-responder WP-Cron event. One argument. Unhook the plugin’s callback and add your own to keep the scheduling and cancellation while writing the reply yourself. |
nirohelp_daily_briefing |
(none) | The daily briefing cron event, scheduled for 06:00 site time. |
A practical example #
Post to Slack whenever a Severe ticket lands:
add_action( 'nirohelp-tickets-ticket_created', function ( $ticket ) {
if ( 'severe' !== $ticket->get_meta( 'urgency' ) ) {
return;
}
wp_remote_post( 'https://hooks.slack.com/...', [
'headers' => [ 'Content-Type' => 'application/json' ],
'body' => wp_json_encode( [
'text' => sprintf( 'New severe ticket: %s', $ticket->get_title() ),
] ),
] );
} );
And to react only to a specific transition:
// A ticket that was Resolved and is now Reopened.
add_action( 'nirohelp-tickets-ticket_status_reopened_to_resolved', function ( $ticket ) {
// ...
} );
Was this doc helpful?