help.chat-api.com

Middle links of messengers API chains

The middle links of the chains add the functionality that you would like to introduce into the operation of the chain algorithm. For example, if you are interested in the chain processing the date and forming a text translation request, then add and configure a link with Google translate. If you want the chain algorithm to analyze the text of incoming messages in messengers for the presence of some entities, key phrases, then create a chain with Google natural langue. The number of possible links is unlimited.

The following link templates are available to you:

- A chain with two-way translation of messengers messages via Google Translate;
- A chain for analyzing the text of messengers messages by keywords, entities, Google locations and other objects via Google natural langue;
- A chain with connection to the capabilities of our free messengers Chatbot;
- A chain for saving files from messengers to Google drive;
- A chain for collecting data from messengers messages and saving them in Google Sheets;
- A chain with the ability to embed your own personal Node JS code;
- A chain for testing API requests through the Webhook service;
- A chain with Google mail to send notifications for messengers events;
- An additional chain for sending messages to messengers through the selected instance.

The possibilities of chains will expand over time. You can take part in this – send your wishes to us by email marketing@chat-api.com or write hear. We will definitely take them into account.

Working with messengers API Chains

To add a chain, use the "Plus Sign" button, to delete a link, use the "Delete" button at the bottom of the card.  In the middle links, you need to specify exactly what information you want to keep in the chain. Also note that the left side of the chain will receive information from your requests, while the right side will receive information from the instance's webhook.

Creating a new link

As soon as you click on the "Plus Sign", a template selection card will open for you. Decide what functionality you want to add to the algorithm of the chain.

If the service you want to add has several callbacks, then choose the method you intend to use.

Initial setup

This is the lower section of the card where you can find instructions and configure how to work with the service. Here you can also decide on static and dynamic data. The selected values can fall automatically into static or dynamic data, this happens on purpose (for example, when choosing a translation language in Google Translator, you can find the result of the selection in static data under the target parameter).

Output data

The output is the data that you want to store in the chain for later use. Two parameters must be specified:
- Key name – under which key the date will be saved;
- Data source – by default, headers come under the Headers parameter and date under the Data parameter.

Analysis of the work of the template with Google translator

Let's assume that a response from Google Translator has returned to us. We are sending a message to the instance. We clearly have a "body" parameter in the request that we want to change. Accordingly, we write body in the "key name" and click add, we see a new field that has appeared:

We prescribe the information we want to see there. In the case of a translator, this will be a translated field. First we write the "data" parameter, because it is interesting to get acquainted with the date, and not with the response headers. After that, we write the path to the parameter we are interested in, in the case of Google translator, this is "data.translations.0.translatedtext".

You can find out where to get the path from in the official documentation for Google Translator, or in the log responses, if, for example, you made a test request to an incorrectly configured link After successfully configuring the output data, the data stored in this way will be available in subsequent links (for the left side + request to the instance / for the right side + request to the user's server).

Was this article helpful?

Your opinion will be used to improve the content of the article

The Most Multifunctional API Provider

Chat API has been operating since 2015 and is one of the first and largest providers in Eastern Europe.

Here are some curious and important figures:

  • We have tremendous expertise in docker container management at scale with an SLA of 99.5+%;
  • Chat API involves in its work more than 200 servers, with the ability to quickly connect another 100;
  • 3200 cores and 25 terabytes of RAM;
  • 200+ methods and features that keep adding;
  • Highload system, Up Time servers 99.9%;
  • Support 24\7;
Get access to the API