Prerequisites
- An API key for accessing the Chatwize API.
- A development environment or tool for making HTTP requests, such as Curl or a programming language like Python.
Please note that to chat on specific topics, your chatbot needs to have relevant data sources uploaded.
Why Create a Chat Session?
Before sending messages to the chatbot, it’s essential to create a chat session. A chat session acts as a container that holds all the messages exchanged between you and the chatbot. Here’s why creating a chat session is necessary:- Message Context: A chat session allows you to maintain context throughout a conversation. It ensures that the chatbot understands the context of your questions or statements.
- Order of Messages: The chat session helps in maintaining the order of messages. This is crucial for having meaningful and coherent conversations with the chatbot.
- State Management: The chat session allows you to manage the state of the conversation. You can continue a conversation seamlessly by referencing the session UUID.
Create a Chat Session
To create a chat session, you need to use a POST request to the API endpoint:https://app.chatwize.ai/api/v1/chatbot/{uuid}/session/create
.
Make sure to replace
{uuid}
with the UUID of your chatbot.Example Request
Here’re example command to create a chatbot using the Chatwize API:Replace token with your actual API key.
uuid
from this response is essential for sending messages within the established chat session.
Send Messages
With a chat session created, you can now send messages to your chatbot. Use the following API endpoint to send messages:https://app.chatwize.ai/api/v1/session/{uuid}/message/stream
Make sure to replace
{uuid}
with the UUID of created session.Example Request
Here’re example command to create a message using the Chatwize API:Replace token with your actual API key.