Skip to main content

Learn how to test your API in POSTMAN and configure them in Atom's HTTP requests

Learn how to test your API in POSTMAN and configure them in Atom HTTP requests

In this article, we will see in simple steps a use case where an API connects with ATOM and the configurations for this use case, using POSTMAN and the HTTP Request component in Atom. Let's get started!

Use case:

A company uses an internal system that registers its clients using a field called ID or identifier. This ID is unique for each client and allows specific information requests. For this, the client must log in with their username and password that will be provided by email. Using this ID, and through the "HTTP Request" component of Atom, both systems will be connected to request the necessary additional data of the client, such as, for example, when they want to know their outstanding balance or the date of their next invoice.

When the client interacts with a bot and requests this information, after the corresponding login by the client, Atom sends a query to the internal system using the HTTP Request component using this ID field. This data is returned by the internal system to Atom and these fields are stored in the Save Response section of the HTTP component of the platform. In this way, the requested information is automatically available and updated so that, if the conversation escalates to an agent, they can see the complete details of the client without having to make a new request.

It is important to note that, for this integration to work correctly, it is first necessary to verify that the authentication to the internal system's API is configured and working properly. For this, POSTMAN is used, where you can validate access and test API requests. Once it is verified that the authentication is successful, the same authentication is configured in the "HTTP Request" component of Atom, allowing the flow of information to be continuous and without interruptions.

Connection test with Postman

Prior to configuring the HTTP request, we can perform a test to verify if the authentication with our API is correct.

For this we will perform a Basic Authentication test in Postman. For this you need to have the username and password of the API.

Basic

If you want to know more about different types of authentication in POSTMAN, read the following article

To do the authentication test, then we go to POSTMAN

There in New Request, we will use the GET Method, we will write the URL of our API, and in the Authorization section, we select in this case Basic Auth and place the access with the corresponding username and password. We click on Send to test:

Once the connection is successful you will see the code 200 OK, as shown on the screen, which means that the connection was successful, and in the BODY tab, look for the Authorization section and the token that was generated that is between quotes after the two points on the same line. That will help you later to configure the headers of our HTTP request component, where Authorization will be our Key and in this case Basic cG9zdG1hbjpwYXNzd29yZA== will be our token for the header of this connection.

Configuration in HTTP Request

We fill in the corresponding fields in the HTTP request as we will see below. Within our bot we access the HTTP Request component, double clicking to access the fields in the right sidebar of our screen.

Here we will perform the following configurations:

  • We will use the POST method and place the URL of the API to which we will connect

In the body we will detail the fields that we will send to the API with the ID of our client:

As headers, we will use a corresponding Key and Token, which was described in the previous step.

Important: Keep in mind that, in Postman it is configured in Basic Authentication, and username and password are specified, but from the HTTP component, in the Header, it is only possible to specify a token. This Token can be generated from Postman or from a key generator such as:https://www.debugbear.com/basic-auth-header-generator

Then in Save response, for example, since our client wanted to know the outstanding balance, we will save in the information fields SALDOPENDIENTE and FECHAPAGOSALDO, the information that comes from the API of the variables data.adeudo and data.fecha_limite

Did this answer your question?