# Language and Notification nodes
### 3.1 Set language
This node lets you change the language of the bot conversation to one of the pre-configured languages. The language can be changed only if you have already set up languages in your bot, otherwise, this node will not work. This node takes input only in the form of [ISO codes](https://docs.yellow.ai/docs/platform_concepts/studio/build/localization#1-supported-languages) based on which it will change the language of the bot.
<img src="https://i.imgur.com/fBHPZLT.png" alt="drawing" width="80%"/>
Let's say that you want to build a flow that asks for user's preferred language to continue the conversation.
1. [Add the preferred languages to your bot](https://docs.yellow.ai/docs/platform_concepts/studio/build/localization#2-add-languages-to-your-bot).
2. Go to the flow and include a [Quick reply node](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/message-nodes#7-quick-replies). Create different buttons for different languages and assign the ISO code as button values to the respective language option.
3. Store the response of the Quick Reply node in a variable.
4. Include the **Set language node** and choose the variable created in the previous step. Refer to the following gif to see how it works.

---
### 3.2 Outbound notification
This node lets you send notifications as part of the bot conversation. Include this node at whichever point of the flow you want the bot send an outbound notification. Using this node you can send notifications via SMS, Email, Whatsapp and Voice.
Imagine you've integrated a chat bot into your e-commerce platform. When a customer successfully places an order, the bot distribute notifications across different channels as configured in the node. For example, customers receive WhatsApp/SMS messages confirming their order details, while Email/Voice notifications are dispatched post-shipping for additional updates.
For a detailed guide on setting up outbound campaigns, click [here](https://docs.yellow.ai/docs/platform_concepts/engagement/outbound/outbound-campaigns/run-campaign).
<center><img src="https://i.imgur.com/7GEgUGE.png" width="70%"/></center>
Option | Description
------ | ----------
Type | Choose the type of communication you want to send: SMS, Email, WhatsApp, or Voice.
Sender | Choose the sender ID from which you want to send the communication.
Profile | Select the sender for the SMS notification. Applicable only for SMS in India.
To | Choose the appropriate variable containing the recipient details, example, SMS phone number, Email address, etc.
CC | Choose recipients for CC (Carbon Copy) if needed.
BCC | Choose recipients for BCC (Blind Carbon Copy) if needed.
Select template | Pick a template to use for your communication.
Store message ID in | Choose the variable where you want to store the Message ID. |
|Text type| Select Text/SSML from the dropdown.|
|TTS Engine| Select the engines from the dropdown- Microsoft Azure, Google Wavenet, Amazon Polly.|
|Voice ID| Type the characters of voice ID. You can add this for Microsoft if text_type = "text" and for Google if text_type = "text" and "SSML".|
|Speed|This value defines how fast the bot must converse. This value can be 0.9 - 1.5 for the bot to soundly humanly. You can add this for Microsoft if text_type = "text" and for Google if text_type = "text" and "SSML".|
|Pitch| Pitch value can be any decimal value depending on the base of voice required, 0 is ideal. You can add this for Microsoft if text_type = "text" and for Google for text_type = "text" and "SSML".|
|Capture DTMF length| Enable this option if the DTMF is to be collected on the specific node.|
|DTMF digital length| Enter the length of characters to be captured. Ex: For an Indian phone number, it is 10.|
---
### 3.3 Notification status
The **Notification status** node helps you track the delivery and status of the notification configured in the [Outbound Notification node](#outbound). It uses the **Message ID** to retrive the notification status. The node offers valuable insights, such as delivery confirmation, read receipts, or error notifications, depending on the capabilities of the communication channel.
You can make use of message status (Sent/Delivered) to take appropriate actions based on the status of your outbound notification, ensuring effective and responsive communication with your audience.
<center> <img src="https://i.imgur.com/rHvs8mM.png" width="70%"/></center>
To use this node:
1. Add an [Outbound Notification node](#out) to your flow and store the response of that node in a variable.

2. Add a **Notification Status node** to the outbound notification node.

3. In **Type**, choose the communication channel: SMS, Email or WhatsApp and in **Message ID** fetch the variable that contains the Message ID.

4. In **notifStatusStoreCustomPayloadIn**, create or choose the variable to store the payload.
5. Connect relevant nodes to **Sent** and **Delivered** options based on what you want the bot to do if the particular notification was sent and delivered.

:::note
To know more about Outbound notifications, click [here](https://docs.yellow.ai/docs/platform_concepts/engagement/outbound/outbound-campaigns/run-campaign).
:::
---
### 3.4 Sync database
:::info
This node is only available when a flow is created as a [skill](https://docs.yellow.ai/docs/platform_concepts/studio/build/Flows/journeys#create-a-skill).
:::
The Sync database node facilitates the synchronization of your bot's database with external databases using APIs. This node streamlines the process of automating data synchronization with external databases.
Let's say you have a bot that assists with inventory management for an e-commerce website. You want to ensure that the inventory data in your bot's database is always up-to-date with your main inventory database. By using the **Sync database node**, you can seamlessly integrate your bot's database with your main inventory database, ensuring that any changes or updates made externally are reflected in real-time within your chatbot, thus providing accurate and timely information to your users.
:::info
Refer to this video to see how this node works
[](https://www.loom.com/share/1e7104db203c4061a5d6839ea515198e)
:::
:::note
* The column names in the table should be exactly the same as the attribute names in the JSON response.
* All the rows will be imported, processed and sent to the selected table to perform the selected action.
:::
To configure the **Sync Database** node:

1. In **API**, choose the preferred API in the drop down. For steps to add a new API to the bot, click [here](https://docs.yellow.ai/docs/platform_concepts/studio/api/add-api).
2. In **Parameters of API**, select the variables that contain the values of the corresponding fields.
* If the values are dynamic, they should be collected from customers using prompt nodes and those variable should be mapped here.
* If they are static values, you can create a variable and type the values.
3. In API response type, choose the API response type of the API added. **JSON** and **CSV** are the options available. Fill the following fields based on the option selected.
* **JSON path selector:(this field is available only for the JSON response)** Select the path where the relevant data lies in the JSON response. For example, the JSON path for the following code would be the is "data.results.*
```
{
data: {
results: {
record1 :{},
record2: {},
........
}
}
}
```
* **Parse API response:** Choose the function that contains the transformation logic. This helps access individual row attributes.
**Sample code**
(This is optional for CSV)
```
return new Promise(resolve => {
let record = ymLib.args.record;
/*
record is an object, representing a row. all values will be of type string, keys will be fetched from the csv-header.
*/
resolve({
identifier: record.identifier,
category: record.category
});
});
```
* **Store Response in:** Choose the variable in which the response of this node should be stored.
* **Select table:** Choose the database table in which the data should be populated.
* **Select action:** Choose one of the preferred actions.
- **Insert**: Adds rows from API call to the end of the table.
- **Update**: Compares rows from API call to the existing table and checks if there is a match in Unique ID and updates those rows.
- **Import**: Truncates existing table completely and replaces it with data from API call.

To use this node in a flow:
1. Create a [Schedule Event](https://docs.yellow.ai/docs/platform_concepts/studio/events/event-hub#schedule-events) (if there is a requirement to schedule the database updates).
2. [Add the API](https://docs.yellow.ai/docs/platform_concepts/studio/api/add-api) and [create a database table ](https://docs.yellow.ai/docs/platform_concepts/studio/database#create-database-table)in the required format (template without any rows).
3. Create or open a [skill](https://docs.yellow.ai/docs/platform_concepts/studio/build/Flows/journeys#create-a-skill). On the start node, select the scheduled event as the start trigger.

4. Connect the start node to the **Sync Database** node.
5. When the Sync DB node gets triggered, it pulls all the data through API.
6. On the scheduled time, status of the sync can be viewed in **status** object.
```
{
success: true,
error : 'if any, we show it',
recordsProcessed: 1230,
}
```