NOTE: Topics are created only when needed, as such if the task has not triggered an alert yet, the topic will not exist.
If you get an error about the topic not existing, cause an alert to be triggered.
Either change the thresholds on the task or create some cpu load.

To configure a handler we must first define the handler.
A handler definition has a few parts:

We are done, future alerts triggered by the cpu_alert task will be send to Slack via the cpu topic.

Conclusion

While it is simple to define alert handlers directly in the TICkscript it can become burdensome once you have many tasks.
Using topics decouples the definition of the alert from the handling of the alert.
Now to change the slack channel is a single API call to update the slack handler and no TICKscripts have to change.

Going further

Chaining topics

Topics can be chained together using the publish action.
This allows you to further group your alerts into various topics.

For example the above task could be modified to send alerts to the system topic instead of the cpu topic.
This way all system related alerts can be handled in a consitent manner.