How to use Kalp Bot API using Postman?

Kalp Bot empowers developers to integrate sophisticated chatbot functionalities into their applications. One of the most common ways to test and interact with any API, including Kalp Bot's, is by using Postman. This powerful API platform simplifies the process of making HTTP requests and viewing responses.

This guide will walk you through the steps to get your Kalp Bot API key, set up a request in Postman, and send your first query to your chatbot via the API.

Prerequisites:

  • A Kalp Studio account.

  • Postman desktop application installed.

  • A configured chatbot within Kalp Studio (from which you'll get the chatbot_id).

Step 1: Obtain Your Kalp Bot API Key

Before you can make any API calls, you need an API key. This key authenticates your requests to the Kalp Bot service.

  1. Log in to Kalp Studio.

  2. Navigate to the API Keys section from the left-hand sidebar.

  3. If you don't have an API key, click the "+ Create API Key" button, typically found in the top-right corner.

  4. Give your API key a descriptive name (e.g., "Postman Test Key").

  5. Once created, the API key will be displayed. Copy this key immediately and store it securely. For security reasons, some platforms only show the full key once. In Kalp Studio, you can see your existing keys listed with their name, a portion of the key, creation date, and status. You can copy the key from this list.

    • Name: e.g., qwerty

    • API Key: e.g., 04fc34eefb357c9... (This is your crucial authentication token)

    • Status: Ensure your key is active (the toggle should be enabled, usually indicated by a purple color).

Step 2: Setting Up Your Request in Postman

With your API key ready, let's configure Postman to send a request to the Kalp Bot API.

  1. Open Postman and create a new request by clicking the "+" tab or "Create New."

  2. Set the HTTP Method: The Kalp Bot API for predictions typically uses the POST method. Select POST from the dropdown menu next to the URL field.

  3. Enter the Request URL: The endpoint for chatbot predictions is: https://stg-chatbot-prediction.p2epp.com/prediction_with_API_KEY

  4. Configure the Request Body: The Kalp Bot API expects data to be sent in the body of the request, typically as form-data.

    • Go to the Body tab below the URL field.

    • Select the form-data option.

    • You'll now add key-value pairs as required by the API.

Step 3: Sending the Request and Interpreting the Response

Once everything is configured:

  1. Click the Send button in Postman.

  1. Analyze the Response: Postman will display the API's response in the bottom pane.

  • Status Code: A 200 OK status code generally indicates a successful request. Other codes (like 400 for bad request, 401 for unauthorized, 403 for forbidden, 5xx for server errors) indicate issues.

    • The response is 503 Service Unavailable with a body no healthy upstream. This typically means the server endpoint was temporarily down or couldn't process the request at that moment. If you encounter this, try again later or check Kalp Bot's status page if available.

  • Body: For a successful request, the body will contain a JSON response with the chatbot's answer and other relevant information.

  • Headers: The Headers tab shows HTTP headers sent and received.

  • Test Results: If you've written any tests for your request, their status will be shown here.

Conclusion

Using Postman to interact with the Kalp Bot API provides a powerful and flexible way to test your chatbot's responses, integrate its functionalities into your applications, and troubleshoot issues. By following the steps outlined above, you can easily send requests, manage your API keys, and understand the data flow between your application and Kalp Bot.

Last updated