Getting started

Channel hooks are set up by creating a configuration file that has a .HOOK extension. The main parameters are defined like this:

[Config]
ScriptFilename = ...
DisplayName = ...
AuthorName = ...
AuthorEmailAddress = ...
Notes = ...
HelpFile = ...

ScriptFilename specifies where the actual channel hook script lives. If it is not an absolute path then it is assumed that it is in the same directory as the .HOOK file.

Registering for events

Channel hooks must register for the events that they want to be called for.

The available events are:

Event
Description
ChannelHookLoaded Raised when the channel hook has been loaded.
ChannelHookAttached Raised when the channel hook has been attached to the channel.
ChannelHookDetached Raised when the channel hook has been detached from the channel.
BeginChannelUpdate Raised before the channel is updated.
EndChannelUpdate Raised after the channel has been updated.
NewFeedItem Raised when a new feed item has been received for the channel.
A new process is started to run the channel hook for every event. If a hook wants to be notified of new feed items, it is better to register for the ConsolidatedNewFeedItems event (to handle all the new feed items in one go), rather than the NewFeedItem event (which will be much slower since it will invoke the channel hook once for each new feed item).
ConsolidatedNewFeedItems Raised when one or more new feed items have been received for the channel.
RevisedFeedItems Raised when one or more revised feed items have been received for the channel.
EndDownloadOfflineFeedItem Raised when a feed item has finished being downloaded for offline reading.
ChannelAutoDownloadCompleted Raised after an enclosure has finished being downloaded.
ChannelAutoDownloadCleanup Raised just before a previously-downloaded enclosure is deleted (because it is too old).
MarkFeedItemsAsViewed Raised when feed items are marked as read/unread.
ChannelConfigChanged Raised when the channel's configuration has been changed by the user.
ChannelFeedUrlChanged Raised when the channel's feed URL has been changed by the publisher.
ChannelError Raised whenever an error occurs on the channel.

 

A channel hook indicates that it wants to be notified of an event by including it in the [Events] section in the .HOOK file. For example:

[Events]
BeginChannelUpdate = 1
ConsolidatedNewFeedItems = 1

Whenever an event the channel hook has registered for occurs, it will be called and passed an INI file that contains detailed information about the event.

Hint
The contents of the INI file depends on the type of event. Attach the supplied LogChannelActivity channel hook to your channel to examine how Awasu invokes hooks for each type of event.