Altcraft action hooks
Overview
Action Hooks is a mechanism for notifying external systems of platform events. These can range from system actions related to message delivery or importing subscriber profiles, to customer actions tracked by Altcraft platform pixels on your site or application.
Action Hooks can work with all databases or any specific one. Captured events can be transmitted batch in JSON format over HTTP or sent to the broker queue asynchronously.
Configurable by master user user for a specific database or for all databases at once.
From the main menu, select Integrations → Event Capture to get started:
You can activate or stop existing action hooks, clone or delete them using the context menu. If you want to edit a hook, click on its title. To add a new one, click + Create at the top of the page:
Action hook general settings
In General settings enter a name for the new hook. Here you will also find a switch to activate the event capturing process:
Capturing options
Action hook can work with all Profile Databases at once or with one specific one. In the Capture Settings block, select the desired option from the Database drop-down menu:
In the Actions field, select from the drop-down menu the events to be sent to external systems. Event types, their designations in the menu and in the hook request, and descriptions can be found in this article.
By default, Action hook logs all events of the types you select. You can limit the events to get a narrower selection in the Additional Filters: block.
Resources - events related to communications within certain resources will be captured.
Campaign - events from specific marketing campaigns will be captured.
Templates - events from campaigns using specific templates will be captured.
Segments - events related to subscribers entering certain segments will be captured.
Pixels - actions of subscribers on external resources, registered by certain pixels, will be captured.
Request options
The following request types are available:
- Send a JSON batche request. Read more.
- Send a message to the RabbitMQ queue. Read More.
- Send a message to the RabbitMQ exchange. Read More.
- Send a message to Kafka broker. Read more.
Retry
If for some reason an error occurs during sending a message (e.g. network failure), the message will be sent again after a certain period of time. The number of repeated sends and their frequency are set in the system configuration file “main.json”:
"HOOK_RETRY_TIMES"
: set maximum number of attempts (default 4)
"HOOK_RETRY_PERIOD_SEC"
: periods between attempts, in seconds (default 15)
Transmit additional event data in the capture
Client profile data in capture
Along with information about the captured event, you can pass values of standard and additional profile fields. The set of available additional fields depends on the selected database. Select from the drop-down list the profile fields you want to Add fields to custom_data:
The template custom_data can be set below. The platform will use the value from this template in the capture if no data is passed in the custom_data
field in the API request to start the trigger.
Additional data in the hook
In addition to profile data, you can transmit any data in mykey:myvalue
format to the custom_data
object. To do this, manually enter the key and value and then press Enter ↵.
Template options available:
Parameter | Description |
---|---|
{{uuid}} | Generates new UUIDv4 |
{{event_date}} | Event date in the format "2006-01-25T15:04:05.999999Z" |
{{event_date_ymd}} | Event date in the format "2006-01-25" |
{{event_date_rfc3339}} | Event date in the format RFC 3339 |
{{event_date_unix}} | Event date in unix time, in string |
{{event_date_unixnano}} | Event date in unix time (nanoseconds), in string |
{{campaign_name}} | Retrieves the campaign name if it is relevant to the event, otherwise empty |
{{campaign_subid}} | Retrieves the campaign SubID if it is relevant to the event, otherwise empty |
{{database_name}} | Retrieves the database name if it is relevant to the event, otherwise empty |
{{segment_name}} | Retrieves the segment name if it is relevant to the event, otherwise empty |
{{message_name}} | Retrieves the template name if it is relevant to the event, otherwise empty |
{{message_subject}} | Retrieves the template saubject if it is relevant to the event, otherwise empty |
{{resource_name}} | Retrieves the resource name if it is relevant to the event, otherwise empty |
For example, you add fields to custom_data
:
The data will be transferred in this way:
"custom_data": {
"cname": "Black Friday",
"email": "test@example.com",
"eventTime": "2021-03-17",
"eventTimeUnix": "1615988820",
"id": "dc876134-87a4-4437-aabb-d2fc8a3d4213",
}
Message content in hook
In order to transmit the content of all messages along with events, activate the option Add messages content at the bottom of the page.
The content will be passed to the "content"
field. The field structure for each channel is described in this article.
Please note that this will store all sent messages in storage for a fixed amount of time. This will require additional disk space. The default retention time is 72 hours; it is set by the global setting HOOK_CONTENT_CLEANUP_HOURS
in the main.json file. After this time, events will be transmitted without any content associated with them.