Integrations

The bot can use external services to enrich its functionality. The first integration we launch is the ability to use OpenAI (ChatGPT and other models) to process Telegram messages.

Integration with OpenAI – general information

OpenAI API allows you to describe in plain language the action you want to perform with a text or image from a Telegram message coming from any Telegram source. Next, the bot sends to the AI the message and your instructions and publishes the result of the processing to a destination. Popular use cases include translation into another language, analyzing and summarizing long texts, smart filtering, changing numbers in text based on specified criteria, translating images into text, analyzing images, and more.

You can enable the OpenAI API integration in Menu → Forwarding settings → Choose source and destination → Integrations.

Since OpenAI API is a paid product, we provide two payment scenarios: from your pro-balance in the bot or self-payment. The general advice is this: if you plan to just experiment with AI, it is easier to pay from your pro-balance. If you plan to use OpenAI on a regular basis to process large amounts of data, you can save some money by creating your own OpenAI account.

Paying from your pro-balance

This payment mode is the simplest. It is used by default and does not require any additional actions from you. Just activate the OpenAI API integration in the forwarding settings and set the required parameters. After each successful use of the API together with the result we receive the cost of the call in OpenAI API tokens and will deduct it from your pro-balance according to the rates below.

Paying from your own OpenAI account

You can register on the OpenAI platform yourself, purchase a paid subscription, and create your API key. Then, you need to enter this key in Menu → Preferences → OpenAI. If you have an API key in your preferences, the bot will use your OpenAI account and no extra fees will be charged to your balance in the bot itself.

Important: For your key to work, you must have at least one payment method connected to your OpenAI account. Also, note that an OpenAI account and a ChatGPT account are not the same thing.

Advantages: it is cheaper than paying with pro-balance; also, you have access to usage statistics.
Disadvantages: you need to make sure your OpenAI account is paid and has enough credits.

OpenAI Chat

You can enable message processing through the OpenAI Chat service in Menu → Forwarding settings → Choose source and destination → Integrations. The following settings are available.

Prompt template

A prompt is the text that contains the instructions for the AI. Since your prompt will most likely consist of both your instructions and the text of the message to be processed, a template provides a convenient way to combine them. As a template you can write any text describing your task and put a special tag ${body} inside. Then in the place in the text where this tag is specified, the bot will add the text of the message to be processed. In the simplest case, just describe your task and add ${body} at the end. See the examples below on how to use it.

Model

The models differ in cost, smartness and some other features. For most applications, the cheapest model gpt-3-turbo will do the job. You can read more about the different models here.

Creativity

This parameter is also called “temperature”. The higher the temperature, the more artistic the answer will be. The lower the temperature, the more “scientific” the answer will be, the more accurate, the more factual. For most cases, you can leave this parameter equal to 1.

Examples

Translation

You can create automatic mirrors of your channel in several languages at once. To do this, set up copying from the original channel to the channels in the corresponding languages and set the appropriate instructions for the AI in the integration settings.

Prompt template:
Translate the following text into a German language:
${body}

You can keep Model and Creativity on their defaults.

Filtering

You can use AI as a smart filter. It will analyze the text according to your criteria and give a green light to publish it. Since usual filters are applied before processing through AI, you first need to create a redirect to an intermediate channel with the following parameters:

Prompt template:
If the following text mentions a probability of a success of a deal equal or greater than 90%, reply to me with this text unchanged. If it does not occur, reply to me with the message "copying not required".
${body}
.

You can keep Model and Creativity on their defaults.

Then, configure a redirection from the intermediate to the final channel by setting usual filters to not allow messages with the text “copying not required” to pass through.