> For the complete documentation index, see [llms.txt](https://docs.intelliticks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.intelliticks.com/ai-builder/advanced/advanced-actions.md).

# Advanced Actions

## Assigning Chat to a specific agent or based on rules

Using this action, you can specify the Assignee of the chat based on your business logic. To use this node, you need to follow these steps

1. Add a [Dynamic Node](/ai-builder/nodes/add-and-send-data/custom-node.md) in your playbook at the stage we want to initiate the assignment.
2. Add the code that creates an Action Node using the code

{% embed url="<https://youtu.be/i2n2NddBf-8>" %}

#### To assign directly to a specified agent

```
return {
    actions: [
        {
             "type": "ASSIGN_AGENT",
             "assignment_type": "DIRECT",
             "assignee": <id of the agent>
        }
    ]
}

```

{% hint style="info" %}
As of now, we do not have agent ids visible in front end. So, you can request the list of agent ids from our support by writing to <support@intelliticks.com>.&#x20;
{% endhint %}

#### To assign the chat based on a rule - assign only to Online Agents

```
return {
    actions: [
        {
            "type": "ASSIGN_AGENT",
            "assignment_type": "RULE_BASED",
            "assign_rule": {
                "agent_type": [
                  "Owner",
                  "Admin",
                  "Member"
                ],
                "status": "ONLINE"
            },
            "reassign_attempt" : 2,
            "reassign_delay" : 120
        }
    ]
}
```

{% hint style="warning" %}
If the action could not find any agent matching the rule, the chat remains unassigned.
{% endhint %}

#### Assign Agent Action Node Schema

| Field Name                    | Field Type      | Description                                                                                                                                                                                                                                          | Required                                                           |
| ----------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| type                          | String          | Fixed value - **ASSIGN\_AGENT**                                                                                                                                                                                                                      | Yes                                                                |
| assignment\_type              | String          | <p>One of the two values <br><br><strong>DIRECT</strong> - directly assigning chat to a specified agent<br><strong>RULE\_BASED</strong> - assigning chat based on rules</p>                                                                          | Yes                                                                |
| assignee                      | String          | The id of the agent to whom the chat has to be assigned                                                                                                                                                                                              | When assignment\_type = DIRECT                                     |
| assign\_rule                  | JSON Object     | Contains the rule to assign the agent                                                                                                                                                                                                                | When assignment\_type = RULE\_BASED                                |
| <ul><li>agent\_type</li></ul> | Array of String | <p>Type of agent role to which the chat has to be assigned. </p><p></p><p>Possible values - <strong>Owner, Admin, Member</strong></p>                                                                                                                | At least one value is required when assignment\_type = RULE\_BASED |
| <ul><li>status</li></ul>      | String          | <p>To specify if only online agents are to be assigned or offline agents can be assigned chats too.</p><p></p><p>Possible values - <strong>DEFAULT, ONLINE, OFFLINE</strong> <br></p><p>DEFAULT means assign irrespective of their online status</p> | <p>Optional.</p><p>Default value = DEFAULT</p>                     |
| reassign\_attempt             | Number          | Number of re-attempts after the first assign attempt fails. This only happens in rule based assignment when no agent is found as per the rule                                                                                                        | <p>Optional.</p><p>Default value = 0 </p>                          |
| reassign\_delay               | Number          | Delay in secons between each re-assign attempt.                                                                                                                                                                                                      | <p>Optional.</p><p>Default value = 60 </p>                         |
