## Heartbeat logging

Heartbeat is an API to log activity from all over the site. As soon as an event occurs and you have a possibility to take action, activity can be logged.

In short, activity messages are occurencies of an event that happened. Heartbeat comes with a data type "heartbeat message template" which is configurational object that contains a dynamic sentence/phrase. Using dynamic variable within that phrase, we can see ""HeartbeatActivity" objects as the instance of a heartbeat message template at some point in time.

When talking about triggering events and taking action, one module comes to mind: Rules. It is very easy to use the rules integration module and log your activity by UI only.

The biggest change to heartbeat for drupal6 is that the variables in the message template are delivered in separate input fields, making it much easier to assign the tokens to the dynamic phrase variables used in the heartbeat templates. The tokens will be available according to the context the event is in. E.g. when a user adds a node, you will certainly have the user object and the node object to make a dynamical sentence.

In code, HeartbeatActivity is a fieldable entity where the HeartbeatMessageTemplate is the bundle. This means that we can use the drag and drop display overview to layout our messages. The message templates are also exportable objects that live in code and database in case overridden. This implies that you will need to use the ctools CRUD functions.

## Heartbeat streams

Activity streams are a list of activity messages ordered so most recent activity is displayed on top. We have some configurations here as well, the HeartbeatStreamConfig objects.

Each activity message in the stream has a bundle type, the heartbeat message template. By using Display suite or Field group we can bring more conventional and advanced layout to our streams.

HeartbeatStreamConfig objects are exportables as well. The live in code and database in case overridden.