> For the complete documentation index, see [llms.txt](https://docs.aisera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisera.com/aisera-platform/ai-automation-optimize-flow/ai-workflow-studio/building-workflows/using-workflow-actions/internal-actions.md).

# Internal Actions

Each of the following Actions is discussed in this topic:

* [Neural Search General Search Action](#neural-search-general-search-action)
* [Auto Resolution Prediction via Ticket IQ Widgets Server](#auto-resolution-prediction-via-ticket-iq-widgets-server)
* [Clean Ticket Data](#clean-ticket-data)
* [Schedule Task](#schedule-task)
* [Authenticate OAuth for Tenant](#authenticate-oauth-for-tenant)
* [Alert Action](#alert-action)
* [List Approvals V2](#list-approvals-v2)
* [Create Flow Approval](#create-flow-approval)
* [Resume AskForApproval Process](#resume-askforapproval-process)

***

### Neural Search General Search Action

**Description:** Performs a general search query using neural (vector-based) search. Automatically populates the index name in the payload based on the tenant ID and bot ID.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **botId (Long, Optional):** The bot ID to use for building the search index name. Only used when invoked from a tenant-level scope flow where the bot ID is not available in the execution context.
* **payload (String, Optional):** The JSON payload for the general search query. – example: `{"indexName": "...", "searchQuery": "<search text>", "filteringRule": "<JSON-encoded filter key/value pairs>", "topK": 10, "fields": ["field1", "field2"]}`. The `indexName` field is automatically overridden based on the tenant ID and bot ID.

**Output:**

* **success (Boolean):** Indicates whether the search request was executed successfully. Returns `false` if the payload is blank or invalid.
* **response (String):** The JSON response body as a string. On success: `{"searchResults": [{"_index": "...", "_id": "...", "_score": 0.95, "_source": {...}}, ...]}`. On failure or no results, `searchResults` will be an empty array.
* **mapResponse (Map\<String, Object>):** The response parsed as a key/value map.

{% hint style="info" %}
The `indexName` in the payload is always overridden with a value derived from the tenant ID and bot ID, in the format `nba_idx_<tenantId>_<botId>_content_with_faq_v2`.&#x20;
{% endhint %}

***

### Auto Resolution Prediction via Ticket IQ Widgets Server

**Description:** Generates auto-resolution predictions for a ticket, including similar tickets, related knowledge base articles, major incidents, sentiment, and emotion analysis. The payload is automatically populated with the tenant ID and bot ID before being sent.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **botId (Long, Optional):** The bot ID associated with this prediction request. If not provided, the bot ID from the execution context is used.
* **payload (String, Optional):** The JSON payload for the auto-resolution prediction request. Required fields: `tenantId` (String), `dataSourceId` (Number). Optional fields: `botId` (Number), `channelId` (Number, defaults to `0`), `contentType` (String, defaults to `"Incident"`), `displayId` (String), `ticketId` (Number), `ticketExternalId` (String), `title` (String), `description` (String), `debugMode` (Boolean, defaults to `false`), `additionalAttributes` (Object). The `tenantId` and `botId` fields are automatically populated before sending.

**Output:**

* **success (Boolean):** Indicates whether the auto-resolution prediction request was executed successfully.
* **response (String):** The JSON response body as a string. On success, contains predictions, similar tickets, related KBs, major incidents, sentiment, emotion, public KBs, and ticket info. On failure, contains an error object with `message`, `details`, and error code.
* **mapResponse (Map\<String, Object>):** The response parsed as a key/value map.

***

### Clean Ticket Data

**Description:** Cleans ticket data by removing junk content such as emails, URLs, phone numbers, timestamps, and non-alphanumeric noise from ticket titles, descriptions, and comments. Optionally performs similarity-based filtering against a corpus to remove redundant sentences.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **payload (String, Required):** The JSON payload containing the ticket data to be cleaned. Required: `request_context` with `tenant_id` and `bot_id`. Optional: `corpus` (for similarity-based filtering; `threshold` defaults to `0.6`), `original_title`, `original_description`, `original_comments`. – example: `{"request_context": {"tenant_id": "acme", "bot_id": 123, "domain": "IT"}, "corpus": {"file_name": "kb.txt", "threshold": 0.6}, "original_title": "VPN not working", "original_description": "Cannot connect to VPN.", "original_comments": ["Tried restarting.", "Still broken."]}`

**Output:**

* **success (Boolean):** Indicates whether the junk filter request was executed successfully.
* **response (String):** The JSON response body as a string. On success: `{"success": true, "request_context": {...}, "cleaned_title": "...", "original_title": "...", "cleaned_description": "...", "original_description": "...", "cleaned_comments": [...], "original_comments": [...]}`. On cleaning failure: same structure with `success: false` and empty strings/arrays for cleaned fields. On error: `{"detail": "Unexpected error"}`.
* **mapResponse (Map\<String, Object>):** The response parsed as a key/value map.

***

### Schedule Task

**Description:** Schedules a task to fire a named event after a specified delay. The event can trigger a downstream flow with the provided payload. Delay can be specified in minutes or seconds; defaults to 15 minutes if neither is provided.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **event (String, Required):** The name of the event to fire after the specified delay. This event will be handled by the corresponding downstream flow. – example: `"Send reminder for conversation"`
* **delayInMinutes (Number, Optional):** The number of minutes to wait before firing the event. Ignored if `delayInSeconds` is provided and greater than zero. Defaults to `15` if neither `delayInMinutes` nor `delayInSeconds` is specified.
* **delayInSeconds (Number, Optional):** The number of seconds to wait before firing the event. Takes precedence over `delayInMinutes` when provided and greater than zero.
* **payload (Map\<String, Object>, Required):** A map of key/value data to be passed to the flow that handles the scheduled event.

**Output:**

* **status (Boolean):** Indicates whether the task was successfully scheduled. Returns `true` if the event was queued, `false` otherwise.

{% hint style="info" %}
`delayInSeconds` takes precedence over `delayInMinutes` when both are provided. If both are omitted or zero, the delay defaults to 15 minutes.
{% endhint %}

***

### Authenticate OAuth for Tenant

**Description:** Authenticates an OAuth connection for a tenant and the specified external system. Returns the authentication response, which may contain tokens or session details.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **externalSystemId (String, Optional):** The ID of the external system to authenticate the OAuth connection for. – example: `"servicenow-prod"`

**Output:**

* **success (Boolean):** Indicates whether the OAuth authentication request was executed successfully.
* **response (String):** The JSON response body as a string containing the OAuth token details. On success: `{"access_token": "...", "id_token": "...", "refresh_token": "...", "token_type": "...", "expires_in": 3600}`. On failure: `{"errorCode": 500, "errorMessage": "...", "message": "Exception during request", "userError": false}`. Treated as sensitive.
* **mapResponse (Map\<String, Object>):** The response parsed as a key/value map. Treated as sensitive.

{% hint style="warning" %}
The `response` and `mapResponse` outputs are treated as sensitive and should be handled securely.
{% endhint %}

***

### Alert Action

**Description:** Sends alerts through one or more notification channels: channel notifications, email, SMS, and internal action logs. Each channel can be enabled independently using its corresponding flag. Supports sending to multiple recipients via comma-separated email addresses or phone numbers.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **sendChannelNotification (Boolean, Optional):** Set to `true` to send a channel notification. The notification is only delivered if the recipients are part of a channel. Defaults to `false`.
* **channelMessage (String, Optional):** The message text that recipients will receive in the channel notification. Defaults to `"Alert from Aisera"` if not provided.
* **channelUsers (String, Optional):** A single email or comma-separated list of emails identifying the users who will receive the channel notification. Required when `sendChannelNotification` is `true`. – example: `"abc@xyz.com,xyz@abc.com"`
* **sendEmailNotification (Boolean, Optional):** Set to `true` to send an email notification. Only works if SMTP has been configured for the tenant. Defaults to `false`.
* **emailSubject (String, Optional):** The subject line of the email notification. Defaults to `"Alert from Aisera"` if not provided.
* **emailBody (String, Optional):** The body content of the email notification. Defaults to `"Alert from Aisera"` if not provided.
* **emailRecipients (String, Optional):** A single email or comma-separated list of emails identifying the recipients of the email notification. Required when `sendEmailNotification` is `true`. – example: `"abc@xyz.com,xyz@abc.com"`
* **sendSmsNotification (Boolean, Optional):** Set to `true` to send an SMS notification. Only works if an SMS provider (e.g., Twilio) has been configured for the tenant. Defaults to `false`.
* **smsText (String, Optional):** The text content of the SMS notification. Defaults to `"Alert from Aisera"` if not provided.
* **phoneNumbers (String, Optional):** A single phone number or comma-separated list of phone numbers to receive the SMS notification. Required when `sendSmsNotification` is `true`. – example: `"+14155550100,+14155550101"`
* **publishToLogs (Boolean, Optional):** Set to `true` to publish the alert message to internal action logs as a warning. Defaults to `false`.
* **logText (String, Optional):** The text to publish to internal action logs. Defaults to `"Alert from Aisera"` if not provided.
* **botId (Number, Optional):** Bot ID to override the bot ID from the execution context. If not provided, the universal bot ID or context bot ID is used.

**Output:**

* **success (Boolean):** Indicates whether all enabled notification channels were processed successfully. Returns `false` if any exception occurred during execution.

{% hint style="info" %}
Email notifications require SMTP to be configured for the tenant. SMS notifications require an SMS provider (e.g., Twilio) to be configured for the tenant. Each notification channel is independent; enabling one does not affect the others.&#x20;
{% endhint %}

***

### List Approvals V2

**Description:** Lists approval tasks managed by Aisera. Can retrieve a specific approval by its ID, all approvals associated with an AI Ticket, or all approvals assigned to the current user. Results can be filtered by status and limited to a configurable time window.

**Configuration Parameters:**

* **defaultDurationInDays (Number, Optional, Default: 7):** The default number of days to look back when retrieving approvals for the current user. Used when the `duration` input is not provided.
* **maxNumOfTickets (Number, Optional, Default: 10):** The maximum number of approval tasks to return in a single query. Applies when retrieving approvals by AI Ticket ID or for the current user.

**Input:**

* **id (String, Optional):** The ID of a specific approval task to retrieve. When provided, the action returns only this approval and ignores other filter inputs.
* **aiTicketId (String, Optional):** The AI Ticket ID to retrieve approvals for. Returns all approvals associated with the specified AI Ticket, filtered by the given status. Ignored if `id` is provided.
* **status (String, Optional):** The approval status to filter by. Possible values: `"Pending"`, `"Accepted"`, `"Rejected"`, `"NotNeeded"`. Defaults to `"Pending"` if not specified.
* **duration (Number, Optional):** The number of days to look back when retrieving approvals for the current user. Overrides the configured `defaultDurationInDays`. Only applies when neither `id` nor `aiTicketId` is provided.

**Output:**

* **approvals (String):** A JSON array of approval task objects. Each object contains: `id`, `assignedToId`, `assignedToDetails`, `aiTicketId`, `status`, `completionTime`, `nextReminderTime`, `lastReminderTime`, `rejectionReason`, `rejectionComment`, `followUpQuestion`, `approvalGroupId`, `approvalDetails`, and a nested `request` object with: `id`, `title`, `status`, `requesterUserDetails`, `requesterId`, `requesterEmail`, `approvalRuleId`, `emails`, `expirationTime`, `contextId`, `source`, `sourceId`, `completionTime`, `currentApprovalGroupId`, `botId`, `details`, `approvalStatus`. Returns an empty array if no matching approvals are found.

{% hint style="info" %}
Lookup priority: if `id` is provided, it takes precedence; otherwise `aiTicketId` is used; if neither is provided, approvals assigned to the current user are returned.&#x20;
{% endhint %}

***

### Create Flow Approval

**Description:** Processes a pending flow approval decision (approve or reject) for the specified approval ID. The payload must be a URL-encoded form string containing the decision, conversation context, and optionally rejection details or a follow-up question.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **approvalId (String, Optional):** The ID of the pending approval to process.
* **payload (String, Optional):** A URL-encoded form string containing the approval or rejection details. For approval: `source=Channel&decision={decision}&conversationContextId={contextId}`. For rejection: `source=Channel&decision={decision}&rejectionReason={reason}&rejectionComment={comment}&conversationContextId={contextId}`. Optional parameters: `addActivity` (activity to log) and `followupQuestion` (follow-up question for the requester).
* **botId (Long, Optional):** The bot ID associated with this flow execution. If not provided, the bot ID from the execution context is used.

**Output:**

* **success (Boolean):** Indicates whether the approval decision was processed successfully.
* **response (String):** The JSON response body as a string. On success, contains the approval task object with fields such as `id`, `assignedToId`, `assignedToDetails`, `aiTicketId`, `status`, `completionTime`, `rejectionReason`, `rejectionComment`, `followUpQuestion`, `approvalGroupId`, and `approvalDetails`. On failure: `{"error": "<message>"}`.
* **mapResponse (Map\<String, Object>):** The response parsed as a key/value map.

{% hint style="info" %}
The `payload` must be URL-encoded form data (content type `application/x-www-form-urlencoded`), not JSON.&#x20;
{% endhint %}

***

### Resume AskForApproval Process

**Description:** Resumes a paused AskForApproval business process by submitting an approver's decision (approve or reject) along with optional comments. The decision is keyed by the approver's email and passed to the workflow driver to continue the process execution.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **processInstanceId (String, Required):** The ID of the paused business process instance to resume.
* **actionExecutionId (Number, Required):** The action execution ID within the business process that is waiting for the approval decision.
* **approverEmail (String, Required):** The email address of the approver submitting the decision. Used to key the approval decision in the workflow inputs. – example: `"approver@example.com"`
* **decision (String, Required):** The approval decision. – example: `"approve"` or `"reject"`
* **approveComment (String, Optional):** A comment provided by the approver when approving the request.
* **rejectComment (String, Optional):** A comment provided by the approver when rejecting the request.

**Output:**

* **status (Boolean):** Indicates whether the business process was successfully resumed with the approval decision. Returns `false` if the workflow driver failed to resume the process.

{% hint style="info" %}
The decision is keyed internally by the approver's email address in the format expected by the workflow engine.
{% endhint %}
