A hook is a fixed event in AnswerPal’s processing, such as an incoming e-mail before the spam check, an escalation or the end of a phone call. You link actions to a hook to run them at that event, and documents to add their content to the prompt. Each link applies to one channel, a channel type or all channels.
/api/HookActionshookName or actionId (at least one is required), pageNumber (at least 1), pageSize (1 to 100, default 10), sortBy (actionName by default, or hookName, channelName, priority) and sortOrder. Only links of active actions are returned./api/HookActions/api/HookActions/bulk/api/HookActions/wait-secondschannelId and hookName. Answers { "totalWaitSeconds": 30 }: the sum of waitSeconds of the active Wait actions linked to that hook for the channel, its channel type or All, each action counted once. An unknown channel gives 0./api/HookActions/{id}/api/HookActions/{id}priority of a hook link; nothing else changes. Answers 204 No Content./api/HookActions/{id}/api/HookDocuments/api/HookDocuments/promptDocumentshookName (required) and channelId (optional: links for that channel, its channel type and All). Returns an array, see below.Hook document links are listed and deleted with the topic document endpoints on the Documents page: GET /api/TopicDocuments?hookName=OnPhonePickupSay and DELETE /api/TopicDocuments/{id}. To run the actions of a hook on one message, or to read the prompt documents of a message, use the execute-hook and prompt document routes on the Ticket Messages page. Actions themselves are defined on the Actions page.
PreSpamDelete action here skips the e-mail.PostSpamPostTopicDetectionOnEscalateOnEscalateFailedOnEscalate, when the ticket still has no representative.OnPhoneCallEndedReply, Send, ReplySend, Forward, Wait, Delete and the cleanup types are skipped here.OnTranscribeHookDoesNotSupportActions.OnAppointmentBookedOnAppointmentRequestedOnClose, OnEndUserAdd, OnEndUserUpdate, OnEndUserDelete, PostEscalateOnPhonePickup, OnPhonePickupSayOnPhonePickupSay for the greeting) and can start their actions with execute-hook.UserTriggeredThe appointment hooks only take ApiCall, AICall and SendNotification actions; another type gives 400 with code HookDoesNotSupportActionType. They cannot be started by hand. The stored hook name is limited to 20 characters, so at this revision a link to OnAppointmentRequested (22 characters) cannot be saved and fails with 500.
hookName (string)PreSpam.actionID (integer)channelID (integer or null)specialChannel (string or null)Email, Chat, Phone, WhatsApp, SMS, Teams or All.priority (integer)hookActionID, actionName and channelName (the channel name, or the channel type).A link applies to a message when its channel is the message’s channel, its channel type is the type of that channel, or it is All. An action linked twice to the same hook runs once, with its lowest priority. The update changes only priority; to move a link to another hook or channel, delete it and create a new one.
specialTopic (string, max 20)topicID (integer or null)OnTranscribe refuses a topic.documentID (integer)channelID, specialChanneltopicDocumentID, customerID, topicName, documentName and channelName.An exact copy of an existing link gives 409 Conflict. For OnTranscribe the document must be a plain text document of the customer (not a data retrieval or function tool document) and a given channel must belong to the customer; otherwise 400 with code InvalidTranscriptionLexiconDocument.
documentID (integer), name (string)content (string){{now}}, {{today}}, {{next_week}}, relative values such as {{now_plus_2_days}} and {{TopicList}} filled in. Data retrieval documents are not run here.includeInRealtimeInstructions, openAIVectorSearchEnabled (boolean), openAIVectorStoreId (string or null)images (array)documentImageID, fileName, contentType, caption, sortOrder, size), up to the customer’s maximum per prompt.contentType (null) and imageUrls (empty array) are always empty here.Each document appears once. When no document matches, the array holds one entry with documentID 0, name No documents found and empty content. With the phone token the channel of the token is used; another channelId gives 403.
POST /api/HookActions
Authorization: Bearer <token>
Content-Type: application/json
{
"hookName": "PostSpam",
"actionID": 58,
"specialChannel": "Email",
"priority": 20
}
201 Created
Location: /api/HookActions/905
{
"hookName": "PostSpam",
"actionID": 58,
"channelID": null,
"specialChannel": "Email",
"priority": 20,
"hookActionID": 905,
"actionName": "Look up order status",
"channelName": "Email"
} GET /api/HookActions?hookName=OnEscalate&sortBy=priority&pageSize=50
Authorization: Bearer <token>
200 OK
{
"items": [
{
"hookName": "OnEscalate",
"actionID": 61,
"channelID": null,
"specialChannel": "All",
"priority": 1,
"hookActionID": 911,
"actionName": "Notify team lead",
"channelName": "All"
}
],
"totalCount": 1,
"totalPages": 1
} POST /api/HookDocuments
Authorization: Bearer <token>
Content-Type: application/json
{
"topicID": null,
"specialTopic": "OnPhonePickupSay",
"documentID": 140,
"channelID": 7,
"specialChannel": null
}
201 Created
{
"topicID": null,
"specialTopic": "OnPhonePickupSay",
"documentID": 140,
"channelID": 7,
"specialChannel": null,
"topicDocumentID": 377,
"customerID": 12,
"topicName": null,
"documentName": "Phone greeting",
"channelName": "Main line"
} GET /api/HookDocuments/promptDocuments?hookName=OnPhonePickupSay&channelId=7
Authorization: Bearer <token>
200 OK
[
{
"documentID": 140,
"name": "Phone greeting",
"content": "Welcome to Example Services. How can I help you?",
"contentType": null,
"includeInRealtimeInstructions": true,
"openAIVectorSearchEnabled": false,
"openAIVectorStoreId": null,
"imageUrls": [],
"images": []
}
] The hook action endpoints and POST /api/HookDocuments work for every signed-in user of the customer. GET /api/HookDocuments/promptDocuments is also open to the phone token. The access line of each endpoint above is the reference.
200 OK, 201 Created, 204 No Content400 Bad RequesthookName and actionId; an unknown hook name; { "code": "HookDoesNotSupportActions" }, { "code": "HookDoesNotSupportActionType" } or { "code": "InvalidTranscriptionLexiconDocument" }, each with a message; an unknown sort field.401 Unauthorized, 403 Forbidden404 Not Found409 Conflict500 Internal Server ErrorspecialChannel outside the list, or a hook name longer than 20 characters. These are not validated up front.A topic link runs its action when the topic is detected on a message. A hook link runs its action at a fixed event, whatever the topic. Both have a channel scope and a priority.
The list only shows links of active actions. Activate the action on the Actions page to see its links again.
Find the link with GET /api/TopicDocuments?hookName=... and delete it with DELETE /api/TopicDocuments/{id}. The document itself stays.
Yes, on one message with the execute-hook route of the Ticket Messages page, except for OnTranscribe and the appointment hooks.
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
AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium
+32.36416685
BE 0862.692.858