Documentation
Guide
Instruments®
List of instruments

List of instruments (currently available)

Let's review the instruments we have at the moment. From this review, you will know about our instruments, which benefits they bring, and how in practice, they could be used.

💡

Don't forget to add your project description to the instrument's settings! Even though the chatbot can work without them, but with this description, it's much more precise. Please find the information about this setting in the corresponding article (opens in a new tab).

Check parcel status

Using the tracking number, it checks the parcel status and the date of the latest update. Supports multiple couriers. If the user doesn't provide a tracking number, the instrument will ask for it.

Installation and settings

This instrument doesn't require any settings. Just install and use it right in the chatbox!

image

You also may ask additional questions:

image

Limitations

Internally, this instrument calls to a service that checks a parcel based on its tracking number. It can track more than 1000 carrier companies. In some cases, it may not find a parcel because:

  • your carrier may not be on the list of carriers
  • some additional authentication is required.

In the case of the latter, please try to use the Query custom API instrument.

Get URL content

Reads a web page, and extracts the text content from it. This instrument may be useful if your users ask questions on the data that is out of your data sources. Here is an example: let's ask a question on some page on the Internet, for example about some article on Reddit https://www.reddit.com/r/Fitness/comments/1cg1ufj/ultrarunning_and_strength_training_racing_100/ (opens in a new tab) that we are too lazy to read:

image

Installation and settings

No settings are required.

Extract data from JSON

This instrument allows to extract data from JSON and pass it to the chatbot which will generate a human-friendly response based on the passed data.

Installation and settings

After installing this instrument, open the details and add the prompt:

image

In this prompt, you need to specify how this instrument would handle the input and what should be extracted. Let's review the example when we want to extract the airline name from a FlightRadar JSON. Let's add this prompt in the Details:

image

Then, on the Interactions page, create a new chat and ask the question:

image

Custom API endpoint

You can use this instrument to hit an API endpoint, pass the data to it, and read the response which will be passed to the chatbot. You may install as many instruments of this type as you want.

Installation and settings

You need to configure the settings of your API endpoint to be able to pass the data.

Full description

Provide the full description of what exactly this instrument does. It's necessary for proper choosing and running it. For example, you can write something like "Checks the flight status by the provided flight number."

image

Prompt

This part helps to collect the proper information to run the instrument. For example, if a user wants to know the flight status but forgot to provide the flight number, the chatbot should ask them. For it, you can write something like "If user wants to check the flight status, collect the flight number."

image

Return value

The API call may return complex data in any format. You need to provide clear instructions on which data to extract. For example, you can write "From JSON, extract the value from field X."

image

API endpoint

Provide a fully qualified URL to the API endpoint, for example, "https://app.myservice.com/api/customer (opens in a new tab)".

image

API method

We support all the standard HTTP methods, listed below (for general information about HTTP methods, please check the official documentation (opens in a new tab)):

  • GET
  • POST
  • PUT
  • DELETE
  • PATCH
  • HEAD
  • OPTIONS
  • TRACE
  • CONNECT

image

Headers

If the API call should be accompanied by specific headers, you can set up them here.

image

Params

If some params should be passed within the call (in the body), set them up here:

image

Additional settings

image

Data should be passed as a list

Sometimes there is a requirement to pass data not as an object but rather as a list.

Extract text content from HTML

If your API is actually a URL that is returning a valid HTML page, check this setting to extract text from it.

Allow redirects

Sometimes, API internally redirects the call to another endpoint, so check this setting if you know that your endpoint does it.

Data

Here, you provide data that should be passed to the endpoint. This data is passed to the chatbot (for example, collected during the conversation), so you need to formalize data to be extracted from the conversation and passed properly

image

Full example

Let's review a full example of working with such a great instrument as "API endpoint". We will create a chatbot that will give us the information on a custom flight. First of all, let's choose the flight we would like to know about (to test the results and verify their quality). Open the Flight Radar website (opens in a new tab) and select some flight. We liked this one:

image

Let's fun begin!

Step 1. Find and install the API endpoint

You can find a good API on the Rapid API service (opens in a new tab) - it doesn't only have tons of great APIs, but many of them are free or super-cheap!

The first step is to sign up and confirm your email. Before we proceed with this API, we need to create an app. Please, navigate to the App page and click the Add New App on the left menu:

image

Give it any name and then click the Add app button:

image

So, after you creating an app, you will be navigated to https://rapidapi.com/hub (opens in a new tab) where you "flight status" in the search field:

image

Click the "Flighter Flight Data" and you will be redirected to their RapidAPI page:

image

💡

Warning! This endpoint doesn't have the actual information about the current flight but rather the calculated statistics about this flight. For the real-time information, use other endpoints.

Now, to test the endpoint, you need to subscribe to their API. They have a free plan so click the Subscribe to Test button (it doesn't require you to provide your CC information):

image

Click the Start free plan button, then click the Subscribe button:

image

Then, click the Skip, get started button and you are good to go!

image

You will be redirected to the App tab of the page, so click the flightStatistics item on the left menu:

image

Click the Params tab and enter the flight number (see the screenshot of the FlightRadar website above, to find the flight number):

image

While you enter your data, the service will automatically generate the code snippet that you can use, it's very convenient to figure out which data we should use, and how (we selected Python but you can select any other available programming language):

image

Click the Test endpoint button and then move to the Results tab (select the JSON format of data):

image

We highlighted the data we are interested. It's the departure and destination airports, and the delay. If we check the flight stats (from the FlightRadar screenshot) we see that this value avg_delay is exactly delay we would like to know, and the value in minutes. Remember this fact.

Step 2. Install and configure the API endpoint instrument in the Enum dashboard

Now, come back to the Enum dashboard. Open the Instrument market page in your project and click the Install button for the Custom API endpoint instrument.

image

Move to the My instruments menu and see our instrument is installed. Click the Details button to configure the instrument:

image

Provide the following data for the corresponding fields:

  • Full description: "Answers questions on flight status, delay, and other information."
  • Prompt: "If user wants to check the flight status or obtain any other information about it, collect the flight number."
  • Return value: "Read the returning JSON data. The field "avg_delay" gives the average delay in minutes so if the question is about delay, read from this field. The fields "from" and "to" mean the airport abbreviation. You should know what they mean, so give the full qualified name of airport."

Copy values for the next fields from the code snippet:

image

So, your data so far should like like that:

image

image

Now, the most interesting part which makes the magic true! Have you noted the "Data" part on the screenshot above? We can just add it to the parameters value but we don't want it to "hardcode" - as our goal is to allow the users to enter the flight number on their own. So, instead of parameters, we provide this part in the Data section. Add one variable, copy the "flnr" to the Name field, then select string type and add the description, for example, "flight number".

image

Providing this data, we tell the chatbot to extract the flight number and pass it as "flnr" variable with the corresponding value to the endpoint. Now, save the data, and let's test our instrument!

Step 3. Testing and tuning our instrument

For testing purposes, let's move to the Interaction page where we can test without using any Crisp chatbot and ask the chatbot about our flight:

image

So far so good but not very specific... let's try again:

image

But... it's slightly wrong, let's go back to the API test response:

image

It looks like the chatbot takes the delay information from a wrong field. Let's improve the instrument's settings. Open its configuration and change the return value to "Read the returning JSON data. The field "avg_delay" gives the average delay in minutes so if the question is about delay, read from this field, and ignore "delay_30d" field. the fields "from" and "to" mean the airport abbreviation. You should know what they mean, so give the full qualified name of airport."

image

Save the instrument and then, let's try again:

image

This is exactly what we need! Let's also test the departure and destination:

image

Now, it works as expected!

Let's test our real chatbot:

image

What if we change the model to a Claude 3 Haiku by Anthropic? It works really great:

image

If you wonder what was the raw data, here you are:

image

If you like the article and this use case, let us know by sharing it on social networks. You also can send us your opinion at info@enumhq.com!