# Action Nodes
You can use Action nodes to perform a specific task. For example, you can use the **Send OTP** node to send out an OTP to the user.
:::info
Action nodes will not display any message to the user during conversation, they run the configured tasks in the background.
:::
The following are the different types of Action nodes available on Yellow.ai:
[1. Interactive nodes
2. Code Based
3. Language & Notification
4. Skill nodes](https://)
## 1. Interactive nodes
Interactive nodes lets you manage and improve bot conversations. These nodes help you trigger events, handle OTPs, search documents and respond to user queries, execute flows within flows, delay implementation, ticket generation, analytics capture, PDF/image generation, user event triggering, data formatting, and flow switching.
### 1.1 Send Event
Kt required
### 1.2 Send OTP
This node lets you send an OTP to the mentioned number.
:::info
One-Time Passwords (OTPs) serves as a versatile security measure, enhancing user authentication in scenarios such as user registration, account recovery, two-factor authentication (2FA), transaction verification, login security, identity verification, secure messaging, device pairing, coupon redemption, and attendance tracking.
:::
1. Use the [prompt node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/prompt-nodes) to capture the phone number from the user and store that phone number in a variable.

2. Add the **Send OTP node** and choose the variable in which the phone number is stored (in the previous step).
<img src="https://i.imgur.com/StadUVa.png" alt="drawing" width="80%"/>
The user will recieve the OTP in a text message.
<img src="https://i.imgur.com/mDlVuCn.jpg" alt="drawing" width="50%"/>
### 1.3 Verify OTP
Use this node to verify the OTP sent to bot users. OTP verification is an important security measure that is used to confirm user identity during various processes.
1. Add a [prompt node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/prompt-nodes) to get the OTP and store that in a variable.

2. Add the **Verify OTP** node.
i. **OTP variable**: Choose the variable that contains the otp.
ii. **Store response in**: Choose the variable to store the response of the Verify OTP node. If the variable is not available, create a new one.
<img src="https://i.imgur.com/e0tytJq.png" alt="drawing" width="80%"/>
3. Add a [text node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/message-nodes#2-text) to **Success** and **Fallback**. Success indicates the successful verification of the otp, Fallback indicates that the verification has failed.
<img src="https://i.imgur.com/T2UM4xp.png" alt="drawing" width="80%"/>
### 1.4 Document Search
<not working currently, checking with Gautham>
### 1.5 Execute flow
> This node is available for voice bots.
This node lets you executes a different flow from the current flow. Use this node when you want to trigger a flow within a flow.
For example, in a customer support bot, you can provide multiple options such as **Talk to an agent**, **Raise a ticket**, **Check status** and add execute flow node to each of the option. So, when a user clicks on an option, the respective flow gets triggered.

Once you add the node, you can choose the flow you want to execute. Click **Go to flow** to check the added flow.
### 1.6 Delay
This node allows you to delay the progression of the conversation to the next node by a few minutes or hours.
For example, in response to a user query about the current temperature, the bot incorporates a delay, imitating real-time data retrieval like "Checking the latest weather in New York City..." After a short pause, it provides the up-to-date information, creating a more effective and engaging interaction.
You can delay by minutes/hours.

:::info
Alternative method is to set the delay on each of the nodes:

:::
### 1.7 Raise Ticket
Raise ticket node lets your users connect with live agents in your bot. Click [here](https://docs.yellow.ai/docs/platform_concepts/inbox) to know more about adding live agents to Yellow.ai. You can also connect users with live chat agents in [different third-party applications](https://docs.yellow.ai/docs/platform_concepts/appConfiguration/overview#6-live-chat).
This node is used create a live chat request with basic or advanced scenarios such as **Working Hours**, **Agent Availability**, **Voice/Video calling**, etc.

* **Live chat agent:** Choose the portal in which your live agents are available. It can be Yellow.ai Inbox or any live chat integration integrated with your bot.
* M**essage after ticket assignment:** The message displayed to the user when an agent is assigned to the chat.
Name, Mobile, Email and Query fields can be filled by passing variables. Use prompt nodes to collect these data in variables and pass it in the corresponding fields.
**Advanced options:**
To provide additional information to the ticket.

As configured in Inbox Settings, [Tags](https://docs.yellow.ai/docs/platform_concepts/inbox/inbox-settings/workflows/tags) and [Custom Fields](https://docs.yellow.ai/docs/platform_concepts/inbox/inbox-settings/workflows/chat_custom_fields) will be visible in a multi-select dropdown(i.e. more than one options can be added to ticket)
- **Tags**: Selected Tags from dropdown will be added to the extra details of the ticket (useful for agents to get a quick overview of the issue).
- **Group code**: Similar tickets can be assigned to relevant groups.
- **Priority**: Denotes the priority of tickets from high, medium or low. (default priority is MEDIUM)
- **Voice Call Options**: Voice Call, SIP Call and Auto Start Call can be enabled.
- **Custom Fields**: Based on the use case additional information collected by bot can be added to ticket. for example, in eCommerce Order ID, Payment Mode, Delivery date etc can be asked before connecting to the agent. Just like key value pairs, once a custom field is selected, an additional prompt will be seen.
<img src="https://cdn.yellowmessenger.com/iE4ppldmrE7k1625673583277.png" alt="drawing" width="65%"/>
The response of a Raise ticket node:
```json
{
"tags": [],
"responded": false,
"ticketType": "livechat",
"ticketCsatScore": null,
"agentCsatScore": null,
"assignedByAdmin": false,
"manualAssignment": false,
"lastAgentMessageTime": null,
"lastUserMessageTime": null,
"lastBotMessageTime": null,
"userActiveStatus": null,
"agentActiveStatus": null,
"replyCount": 0,
"voiceCall": false,
"sipCall": false,
"agentCurrentHandlingTicketsCount": 0,
"autoStartCall": false,
"autoTranslate": false,
"autoDetectLanguage": false,
"_id": "6156df377b7bb14e16bae116",
"botId": "YOUR_BOT_ID_HERE",
"uid": "106265078787462873391306131746",
"source": "yellowmessenger",
"issue": "ISSUE_TITLE_HERE",
"priority": "MEDIUM",
"severity": "MEDIUM",
"contact": {
"phone": "1234567890",
"name": "CUSTOMER_NAME",
"email": "[community@yellow.ai](mailto:community@yellow.ai)"
},
"assignedTo": "community_yello_ai",
"sessionId": "5b8a665e69dbc5c451d88bf0",
"userLanguage": "en",
"ticketId": "100001",
"logs": [],
"timestamp": "2021-10-01T10:13:11.657Z",
"reassignmentLog": [],
"collaborators": [
{
"_id": "6156df377b7bb15d9fbae11a",
"username": "community_yello_ai",
"xmppUsername": "user_1624003758958",
"name": "yellow.ai Community"
}
],
"agentLanguage": "en",
"status": "ASSIGNED",
"assignedTime": "2021-10-01T10:13:11.695Z",
"xmpp": "user_1624003758958"
}
```
#### Raise ticket outputs
1. **Ticket Closed**: Add any node to perform the preferred action when a ticket is closed successfuly.
2. **Error**: Add any node to perform the preferred action when there's an error connecting to an agent.
<img src="https://i.imgur.com/Fn7QnKd.png" alt="drawing" width="50%"/>
#### Error handling
The output of a Raise Ticket Node dictates general behaviour for any error in creating a ticket. In most real life scenarios, it is preferred to show appropriate reasons to users as to why they cannot to an agent.
:::note
Once any specific event is active and configured, the corresponding flow will be given preference. Bot is never paused unless a ticket is in ASSIGNED state (i.e. Agent is interacting with the user).
:::
Two steps to handle custom scenarios are as follows:
1. In [Events](https://docs.yellow.ai/docs/platform_concepts/studio/events/event-hub), activate the custom inbox event. Scenarios that can be handled:
- All Available Agents Busy
- All Available Agents Away
- All Available Agents Offline
- All Available Agents Limit Reached
- Queue Not Enabled
- Group Queue Not Enabled
- Group Queue Limit Reached
- Offline Ticketing Not Enabled
- Offline Ticketing Not Enabled for Groups
- Offline Ticket Queue Limit Reached
2.[ Build a flow with relevant events added in the Start Trigger](https://docs.yellow.ai/docs/platform_concepts/studio/build/Flows/configureflow#13-trigger-flow-using-event).
#### Working hours
If the bot is supposed to respond with a different message outside of agent working hours, [Logic Node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/logic-nodes) can be used.
<img src="https://i.imgur.com/J3W0HWX.png" alt="drawing" width="70%"/>
:::note
The bot default timezone is considered while evaluating whether a user is outside working hours.
:::
#### Auto-translate incoming chats
Inbox supports automatic translation, allowing agents to assist customers without requiring knowledge of the customer's language. Just enable `Translate User Message` in the raise ticket node configuration to use this feature.
<img src="https://i.imgur.com/frCvffs.png" alt="drawing" width="40%"/>
### 1.8 Analytics
This node lets you capture analytics.
You can use the analytics node to send analytics events and capture custom events at any point in the execution of a flow. You can type the event name to push and select a value.
The data passed via the node will flow into the analytics table of Data Explorer inside the Insights section.
For instance, use the analytics node to record a **SignUp** event with a corresponding value and keys, allowing you to analyze user interactions and track metadata in the Data Explorer's Insights section.
**Event**: This can be a static name or a variable which will be captured under the Events column on the analytics table.
**Value**: A variable needs to be selected here which will be captured under the eventValue column.
**Keys**: This is an optional field to capture metadata and will be created as a new column. Multiple columns can be created using keys.
:::info
Using custom events, you can analyse user flow from one flow/step to another, filter by specific custom events, summarise by different user responses, visualise drop offs and conversion funnels, etc.
:::

Open the Analytics page by clicking the Analytics Table link.

-----
### 1.9 Generate PDF/Image
Use this node to generate PDFs and images (JPG/JPEG/PNG) files from docsx, html and Base64 files.
#### To convert from docsx

1. In **Template**, click **Upload file** and upload the template based on which the PDF should be generated. This document should be in .docx format and have placeholder values wherever the dynamic data is to be inserted. The placeholder should be enclosed in single brackets, that is`{placeholdername}`. For example, The company name is {company name}.
2. In **+ Add Variable Mapping**: Enter the placeholder name without the brackets in the left column and select a variable (in which the value is collected from the user) in the right column.
<img src="https://i.imgur.com/RW5UWNW.png" alt="drawing" width="60%"/>
3. **Select an output format** will be auto-populated by PDF as that's the only available option for docs.
#### To convert from HTML

1. In **Select variable containing HTML string**, choose the variable that contains the HTML string.
2. In **Select an output format**, choose the format in which the file should be generated, **PDF**/**JPG**/**JPEG**/**PNG**
Enable **Advanced options** to set the margin and dimensions based on which the file should be geenrated.
<img src="https://i.imgur.com/JTS0zZ8.png" alt="drawing" width="50%"/>
#### To convert from Base64
There are two ways by which you can convert Base64 files:
**From APIs**

1. In **Input type** choose **API**.
2. In **API**, choose the API added to your bot. If your API has dynamic paramters, add nodes to collect that information from users.
3. In **Path to a BASE64 key**, enter the path to the BASE64 key.
4. **Select an output format** will be auto-populated by PDF as that's the only available option for docs.
**From variables**

1. In **Input type** choose **Variable**.
2. In **Select variable**, choose the variable that contains the BASE64 file.
3. **Select an output format** will be auto-populated by PDF as that's the only available option for docs.
Display the file though the [File node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/message-nodes#6-file). Simply choose the relevant variable from the **fetch from variable** dropdown, it will send the dynamically generated file as a PDF to the user.
### 1.10 User event
This node lets you trigger an event with a certain amount of delay. For example, if you can get feedback from users after the chat gets over, you can use this node to trigger that event which will trigger the feedback flow.
To use this node:
1. Create a user event. To do so, go to **Studio** > **Builder** > **User Events** > **+ Add Even**t.

2. In **Event name**, provide a name for that event and in **Event description** descruibe the nature of that event. Click **Create Event**.
3. Go back to **Build**, create a flow with the [start trigger](https://docs.yellow.ai/docs/platform_concepts/studio/build/Flows/configureflow#13-trigger-flow-using-event) as this event created in the previous step. This flow should essentially contain all the nodes required to execute the action when this event takes place.
4. Then go to the flow which should send this event and include the **User event** node.

5. Fill in the following fields:
* **Event key**: Choose the event created in step 2.
* **Event delay**: Enter the time by which the event occurence should be delayed.
* **Payload**: Choose the variable that contains the data that should be sent along with the event.
6. Once the flow reaches this node, the event is triggered, and the associated flow will be executed precisely after the specified delay time.
### 1.11 Data formatter
Use the **Data Formatter** node to convert the incoming data to JSON. For instance, convert user input, such as name and email, into a structured JSON object for better processing in downstream applications.

* **Input**: Create/select the variable that contains the data to be converted and select the format of the data. CSV (raw, base64, url) and XML are supported in our platform.
* **Format to**: Select JSON.
* **Parse json output**: Choose the function that filters out a certain data from the JSON. Click [here](https://docs.yellow.ai/docs/platform_concepts/studio/build/code) to know about writing functions.
----
### 1.12 Switch flow
This node lets you quit the current flow and launch another flow. The conversation switches from the current flow to another flow from that point and you cannot add any nodes post this.
For instance, you can use this to guide users from an initial greeting flow to a specific feedback flow, ensuring a smooth transition.
Add the node and choose the flow to which the bot should switch from the flows drop-down.
