# Macroses AI

In NovaTalks, AI macros can be used:

* as an assistant for an agent when it comes to correcting mistakes, rephrasing a response, translating into another language, changing the tone of a message, summarising a dialogue, etc.

{% embed url="<https://www.youtube.com/watch?v=DxbyQWmCXdI>" %}

* as massive functions that will allow you to evaluate dialogues according to your criteria, check for compliance with the script, determine customer emotions, and anything else you can think of.

{% embed url="<https://www.youtube.com/watch?v=8Lymo_Yzgog>" %}

In the NovaTalks macros, the standard TOP functions of the AI requests have been created:

* ai\_rephrase\_message - to rephrase an answer
* ai\_fix\_grammar\_message - to correct mistakes
* ai\_shorten\_message - to shorten a message
* ai\_expand\_message - to expand a message
* ai\_friendly\_tone\_message - to change the tone of a message to friendly
* ai\_formal\_tone\_message - to change the tone of a message to formal
* ai\_translate\_en\_message - to translate a message to English
* ai\_summarize\_dialog - to summarize a dialog
* ai\_reply\_suggestion - to provide a reply suggestion

You can edit these macros or create your own.

{% hint style="success" %}
To create your own AI macros, we recommend copying an existing macro and changing the text in the **command** field.&#x20;

You can edit standard **AI** macros as needed. However, to send a request correctly, we recommend changing only the command text in the **command** field, leaving the other parameters unchanged
{% endhint %}

{% hint style="info" %}
To enable an agent to use an AI macro while interacting with a customer, it is necessary to add it as a button to the agent's workspace (For more details - [Buttons Settings](/en/get-started/settings/account-settings.md#buttons)) and configure integration with OpenAI (For more details - [OpenAI](/en/get-started/settings/integrations/ai.md)).
{% endhint %}

***

## Common settings

Each macro has the following common settings:

<figure><img src="/files/YS3sKQBdyy40BV1iIOOT" alt=""><figcaption></figcaption></figure>

1. **Send Custom Event** - custom.send\_to\_ai with the following variables:

* send\_content\_type - content type to be sent to AI. Possible values:

message - a text entered in the Reply section

dialog - messages within a dialog

* command - a command text to AI

{% hint style="success" %}
When creating an AI macro, you can specify conditions in the command text for evaluating the dialogue, indicating the names and values of user variables that should be returned according to the specified conditions. For example:

*Please set the following variables based on the following conditions:*

1. *Cross-Selling:*

*ai.reply.crossel = yes - If the customer orders goods and the agent proposes additional goods to buy.*

*ai.reply.crossel = no - If the customer orders goods but the agent does not propose additional goods.*

*ai.reply.crossel = n/a  - If the customer does not order goods.*

2. *Guarantee Offering:*

*ai.reply.guarantee = yes - If the customer orders goods and the agent proposes to buy a guarantee.*

*ai.reply.guarantee = no - If the customer orders goods but the agent does not propose a guarantee.*

*ai.reply.guarantee = n/a - If the customer does not order goods.*

As a response, AI will return a list of variables and their values. This function can be useful, for example, if you need to evaluate or check a dialogue for compliance with a script.
{% endhint %}

* other additional parameters - required if the AI response contains custom variables that need to be parsed. Such variables should be added in the format:

**Key** - variable name,&#x20;

**Value** - json\_param.

2. AI response text to **Add to**:

* Private Note - a private note of a conversation in which a macro was run (with sending to the conversation).
* Reply section - the Reply section of a conversation in which a macro was run (without sending it to the conversation).
* Dialogue note - a dialogue note (with saving to a note), within which the macro was launched
* Conversation Custom Attributes (text only)
* Contact Custom Attributes (text only)

{% hint style="info" %}
If the AI's response contains user variables, you need to specify them in the "Add to" section in the format - {{ai.reply.name}}, where "name" is the name of your variable.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.novatalks.com.ua/en/get-started/settings/macros/macroses-ai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
