Create Message

Method: POST

Endpoint: https://api.assistable.ai/v2/create-message

This endpoint allows you to manually add a message to a specific conversation history.

Use Case: Use this when building a custom chat interface (like a bubble on your website). When the user types something, you send it here so Assistable knows about it. You can then call the [Agent Chat Completion] endpoint to get the AI's answer.

1. Authorizations

You must verify your identity to push messages.

  • Header Name: Authorization

  • Value: Bearer <your_token_here>


2. Body Parameters

To save a message, you need to tell the system who said it, what they said, and where it belongs.

Field

Type

Required?

Description

location_id

string

Yes

The unique ID of the GoHighLevel location.

conversation_id

string

Yes

The ID of the conversation this message belongs to.

message_id

string

Yes

A unique ID for this specific message (you can generate this yourself).

role

string

Yes

Who sent this? Options: user (the person) or assistant (the AI).

content

string

Yes

The actual text of the message.

channel

string

No

The source of the chat (e.g., Live_Chat, SMS).

ai

boolean

No

Set to false if a human sent this. Set to true if it's an AI.


3. Example Request (Code)

Copy the code below to test adding a user message to history.

Bash

curl --request POST \
--url https://api.assistable.ai/v2/create-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"location_id": "loc_12345",
"conversation_id": "conv_98765",
"message_id": "msg_unique_001",
"role": "user",
"content": "Hello, I have a question about pricing.",
"channel": "Live_Chat",
"ai": false
}'

4. Success Response

If the message is successfully saved, you will receive a 200 status.

JSON

{
"status": 200,
"data": {
"status": "stored",
"id": "msg_unique_001"
}
}

5. Troubleshooting

  • "Why didn't the AI reply?" This endpoint only saves the message to memory. It does not trigger a reply. To get a reply, you must call the Agent Chat Completion endpoint immediately after this one.

  • Unique IDs: Ensure your message_id is actually unique. If you send the same ID twice, it might overwrite the old message or return an error.


Was this article helpful?