Messages
Messages are what make a conversation between you and a NexusGPT agent. On this page, we'll dive into the different chat endpoints you can use to discuss with agents programmatically.
The message model
The message model contains informations about a message sent in a chatroom.
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the message.
- Name
chatId
- Type
- string
- Description
Unique identifier of the chat the message was sent into.
- Name
senderType
- Type
- 'USER' | 'VIRTUAL_EMPLOYEE'
- Description
Defines which type of member sent the message.
- Name
content
- Type
- string
- Description
The message sent.
- Name
contentJson
- Type
- object | null
- Description
The content of the proposed plan.
- Name
type
- Type
- 'PLAN_PENDING' | 'PLAN_VALIDATED' | 'PLAN_REJECTED' | null
- Description
The current status of the proposed plan which is stored in contentJson. PLAN_PENDING means the plan is waiting for validation. PLAN_VALIDATED means the plan has been validated and an execution plan is attached to the message. PLAN_REJECTED means the plan has been rejected.
- Name
files
- Type
- File[]
- Description
Array of files sent with the message.
- Name
userSender
- Type
- User
- Description
The informations about the user sender if the senderType is
'USER'
.
- Name
virtualSender
- Type
- Agent
- Description
The informations about the virtual sender if the senderType is
'VIRTUAL_EMPLOYEE'
.
- Name
status
- Type
- 'PROCESSED' | 'IN_PROGRESS'
- Description
The status of the message. IN_PROGRESS means the agent is still writing.
- Name
isTemporary
- Type
- boolean
- Description
Whether the message is temporary or not. A temporay message indicates where the agent currently stands in their thinking process.
- Name
isNotification
- Type
- boolean
- Description
If the message is a notification or not. A notification is a message sent by the agent to notify about the intermediate result of an execution plan step.
- Name
createdAt
- Type
- timestamp
- Description
Timestamp of when the message was created.
- Name
updatedAt
- Type
- timestamp
- Description
Timestamp of when the message was last updated.
Retrieve all messages
This endpoint allows you to retrieve and the messages written in a chatroom. To find your chatroom id, refer to the chats page.
Request
curl -G /api/public/v1/chats/:chatId/messages \
-H "api-key: {your_api_key}"
Response
{
"data": [
{
"id": "49b1f9f9-6f38-4b06-ae39-60d16b163b1c",
"chatId": "e572cbbb-a8c6-400f-a982-78465674df84",
"senderType": "VIRTUAL_EMPLOYEE",
"userSenderId": null,
"virtualSenderId": "1c078ae5-c8d9-46d0-87d5-003cde126f6d",
"content": "Brad: I'm doing well, thank you. How can I assist you today?",
"contentJson": {
"content": null
},
"type": null,
"status": "PROCESSED",
"createdAt": "2023-06-28T10:06:16.279Z",
"updatedAt": "2023-06-28T10:06:28.028Z",
"virtualSender": {
"id": "1c078ae5-c8d9-46d0-87d5-003cde126f6d",
"role": "Management Consultant",
"first_name": "Brad",
"last_name": "Harrison",
"profile_picture": "https://snikpic-marketplace.s3.amazonaws.com/virtual_employees/1c078ae5-c8d9-46d0-87d5-003cde126f6d.jpg",
"short_bio": "I am a Management Consultant who can provide high-quality research and analysis for your company, helping you understand your markets, competitors, and customers, and delivering top consulting-firm level deliverables quickly.",
"bio": "Are you trying to complete a research, analytics or strategic project that is bottlenecking important decisions and actions?\\n\\nDo you need a high-quality deliverable fully aligned with your goals that you can feel comfortable will be done right?\\n\\nI am a Management Consultant passionate about helping people better understand their markets, competitors, and customers. As someone who has worked with dozens of Fortune 500 companies, startups, and investors, I know how painful getting reliable data, research, and analysis is. You don’t need to hire a Bain, BCG, or McKinsey to get high quality, expert-level work done for your company. I love research. I love analysis. I love helping others get to the next level with great research & analysis.\\n\\nI work with you to align on your project goals, break those goals down into key questions we need to answer, set the deliverables you need, and provide them in the format that lets you provide the highest impact.\\n\\nBenefits of working with me:\\n+I help you put your best foot forward, in front of investors, colleagues, and clients\\n+You get top consulting-firm level deliverables\\n+You don’t have to figure out how to do the research and analysis on your own\\n+You get your deliverables quickly. I’m used to working with Private Equity firms who need work done yesterday\\n\\nI can help you across a range of tasks including:\\n✅Storyline: Creating a detailed storyline for a multi-page deck to answer a specific question\\n✅Brainstorm: Coming-up with innovative ideas to answer a specific business question\\n✅Email: Writing professional business emails to your clients, advisors, investors or team members\\n✅Problem-solving: Decomposing a problem into sub-component and helping you answer a specific business question\\n\\n\\nSound like a fit? I'd love to learn about your project and explore how I can help. I look forward to hearing from you!",
"tags": "management consulting, problem solving, excel modeling, communication, powerpoint presentation, team hypothesis, business problems, manager",
"isHighQuality": false
},
"files": [],
"executionPlan": null
},
{
"id": "f6db74fc-1b2f-4e7b-aa84-70a29f09321f",
"chatId": "e572cbbb-a8c6-400f-a982-78465674df84",
"senderType": "USER",
"userSenderId": "user_2OmHlggp3Q73U9M1pqIhINoOMlh",
"virtualSenderId": null,
"content": "How are you today?",
"contentJson": null,
"type": null,
"status": "PROCESSED",
"createdAt": "2023-06-28T10:06:16.267Z",
"updatedAt": "2023-06-28T10:06:28.019Z",
"userSender": {
"id": "user_2OmHlggp3Q73U9M1pqIhINoOMlh",
"email": "user@user.com",
"firstName": "user",
"lastName": "user",
"createdAt": "2023-05-15T09:01:29.463Z",
"updatedAt": "2023-06-28T10:06:27.761Z"
},
"files": [],
"executionPlan": null
}
],
"meta": {
"total": 2,
"lastPage": 1,
"currentPage": 1,
"perPage": 10,
"prev": null,
"next": null
}
}
Send a message
This endpoint allows you to send a new message to one of your chatrooms
Required attributes
- Name
content
- Type
- string
- Description
The message content. If you want to send a command, please make sure to include the command prefix followed by your request.
For example, "/InternetSearch What are the latest trends in AI?"
Available commands are:
- /Default which is used when no command is specified will let the agent decide what which command from below to use in order to process the request
- /Auto to request an execution plan proposition for the request
- /Chat to simply chat with the agent without triggering any task, tool or execution plan proposition
- /InternetSearch to trigger an internet search.
- /DocumentLookup (will only work if you have PDF documents attached to the chat)
- /DataLookUp (will only work if you have XLSX or CSV documents attached to the chat)
- Tasks attached to the agent (the "/" should be followed by the name of the task stored under
action
inAgent Task
) - Tools attached to the agent (the "/" should be followed by the name of the tool stored under
name
inAgent Tool
)
Request
curl https://api.gpt.nexus/api/public/v1/chats/:chatId/messages \
-H "api-key: {your_api_key}" \
-d content="How are you?"
The agent response following a message sent on this endpoint will be sent to your defined webhook url as MESSAGE_FINALIZED
Update a message
This endpoint allows you to update the contentJson and the type of a message. This is especially useful when you want to edit a proposed execution plan and approve or decline it.
Required attributes
- Name
contentJson
- Type
- object
- Description
Proposed plan which can eventually be updated
- Name
type
- Type
- 'PLAN_VALIDATED' | 'PLAN_REJECTED'
- Description
Status of the proposed plan.
Request
curl https://api.gpt.nexus/api/public/v1/chats/:chatId/messages/:messageId \
-H "api-key: {your_api_key}" \
-d contentJson="" \
-d type="PLAN_VALIDATED" \
If you validated the proposed plan, the agent response following a message update on this endpoint will be sent to your defined webhook url as MESSAGE_FINALIZED