The Hooks endpoint in AnswerPal allows you to manage and automate actions triggered by specific events (called “hooks”) within the platform. Technically, hooks in AnswerPal are represented as “SpecialTopic” in the database and API. When you work with the Hooks endpoint, you are actually managing AP_TopicActions (for actions) and TopicDocuments (for documents) where the SpecialTopic field matches the hook’s name (for example, PreSpam, OnEscalate, etc.).
This unified approach allows you to use the same endpoints and data structures for both topics and hooks/events, simply by specifying the hook name as the SpecialTopic.
Base URL: https://api.answerpal.com/api/hookactions Authentication: Bearer token (JWT) required
Supported HTTP Methods:
Note: All API calls for hooks are performed by specifying the hookName parameter, which is internally mapped to the SpecialTopic field. For example, to retrieve or manage actions for the PreSpam hook, you would use hookName=PreSpam in your API requests.
Property | Type | Required | Description | Example |
---|---|---|---|---|
hookActionID | int | Yes | Unique identifier for the HookAction. | 101 |
hookName | string | Yes | Name of the hook/event this action is attached to (e.g., OnEscalate, OnPhonePickup). This is the value of the SpecialTopic field in the database. | “OnEscalate” |
actionID | int | Yes | Reference to the Action definition (see Actions endpoint). | 123 |
actionName | string | Yes | Name of the linked action for clarity. | “Auto-Reply” |
channelName | string? | No | Name of the channel (if applicable). | “Support Email” |
priority | int | Yes | Priority for execution (higher runs first). | 10 |
Property | Type | Required | Description | Example |
---|---|---|---|---|
hookName | string | Yes | Name of the hook/event to attach this action to. This is stored as SpecialTopic in the backend. | “OnEscalate” |
actionID | int | Yes | Reference to the Action to execute. | 123 |
channelID | int? | No | Channel ID to restrict to a specific channel. | 1 |
specialChannel | string? | No | Restrict to special channel type (“Email”, “Chat”, “Phone”, “WhatsApp”, “All”). | “Email” |
priority | int | Yes | Priority for execution (higher runs first). | 10 |
Property | Type | Required | Description | Example |
---|---|---|---|---|
priority | int | Yes | New priority value only. | 20 |
Property | Type | Description |
---|---|---|
items | HookActionReadDTO[] | List of HookActionReadDTO objects. |
totalCount | int | Total number of HookActions found. |
totalPages | int | Total number of result pages (if paginated). |
To retrieve documents associated with a hook/event, use the TopicDocuments endpoint with the hookName parameter. This is internally mapped to SpecialTopic in the database, so only documents linked to that hook/event will be returned.
{
"items": [
{
"hookActionID": 201,
"hookName": "PreSpam",
"actionID": 301,
"actionName": "Spam Filter",
"channelName": "Support Email",
"priority": 100
}
],
"totalCount": 1,
"totalPages": 1
}
{
"hookName": "OnEscalate",
"actionID": 123,
"channelID": 1,
"priority": 10
}
Response:
{
"hookActionID": 101,
"hookName": "OnEscalate",
"actionID": 123,
"actionName": "Auto-Reply",
"channelName": "Support Email",
"priority": 10
}
{
"priority": 20
}
Response: 204 No ContentDELETE /api/hookactions/101 Response: 204 No Content
[
{
"hookName": "OnEscalate",
"actionID": 123,
"priority": 10
},
{
"hookName": "OnPhonePickup",
"actionID": 124,
"priority": 15
}
]
Response:
[
{
"hookActionID": 101,
"hookName": "OnEscalate",
"actionID": 123,
"actionName": "Auto-Reply",
"priority": 10
},
{
"hookActionID": 102,
"hookName": "OnPhonePickup",
"actionID": 124,
"actionName": "Notify Rep",
"priority": 15
}
]
[
{
"documentID": 501,
"name": "Escalation Instructions",
"content": "Please provide additional details for escalation...",
"isDataRetrievalProcess": false
}
]
A Hook is a named event in AnswerPal’s workflow (like OnEscalate, OnPhonePickup, etc.) that can trigger one or more actions automatically.
Higher priority values execute first when multiple actions are attached to the same hook.
Yes, use the channelID or specialChannel property in the create request.
No, only the priority can be updated after creation. To change other properties, delete and recreate the HookAction.
In AnswerPal, hooks and events are stored as “SpecialTopic” in the database. When you use the Hooks endpoint, you’re actually working with TopicActions and TopicDocuments where the SpecialTopic field matches your hook/event name (e.g., “PreSpam”, “OnEscalate”, etc.). This allows for a unified, flexible approach to managing both topic-based and event-based automation.
AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.
For all support, sales, and partnership inquiries, email us at info@answerpal.eu