Agent Chat Completion (GHL-Safe)

Method: POST

Endpoint: https://api.assistable.ai/v2/ghl/chat-completion

This endpoint triggers the AI to generate a text message response for a specific contact.

Use Case: You can use this in a workflow (e.g., "When a lead fills out a form") to make the AI immediately send a welcome message via SMS or DM inside GoHighLevel.

1. Authorizations

You must verify your identity to trigger a chat response.

  • Header Name: Authorization

  • Value: Bearer <your_token_here>


2. Body Parameters

To generate a reply, the system needs to know which AI is talking and who it is talking to.

Field

Type

Required?

Description

assistant_id

string

Yes

The ID of the AI Assistant that will generate the message.

location_id

string

Yes

The GoHighLevel Location ID where the contact lives.

contact_id

string

Yes

The specific GoHighLevel Contact ID to reply to.

message

string

No

Optional. If provided, this acts as the "User's" input to prompt the AI. If left empty, the AI looks at the last message in the GHL conversation history.


3. Example Request (Code)

Copy the code below to test a chat completion.

Bash

curl --request POST \
--url https://api.assistable.ai/v2/ghl/chat-completion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"assistant_id": "asst_12345",
"location_id": "loc_98765",
"contact_id": "cont_abc123",
"message": "Hey, are you still interested?"
}'

4. Success Response

If the message is successfully generated and queued to send in GHL, you will receive a 200 status.

JSON

{
"success": true,
"data": {
"response": "Yes, I can help you with that! When are you free?",
"thread_id": "thread_xyz789",
"status": "sent"
}
}

5. Troubleshooting

  • Empty Response: If the AI decides no response is needed (based on the conversation history), it might return success but an empty string.

  • Looping: Be careful not to trigger this endpoint inside a workflow that fires on "Outbound Message," or the AI will reply to itself endlessly.

  • GHL-Safe: This endpoint is designed to handle GoHighLevel's timeout limits, so it is safe to use in "Custom Webhook" actions inside GHL workflows.


Assistable.ai Setup Walkthrough

For a deeper look at how these "GHL-Safe" endpoints fit into a real automation workflow, check out this comprehensive guide:

Assistable.ai Comprehensive Voice AI in GHL Setup

This video covers the full setup from A to Z, which is highly relevant as it demonstrates the practical application of the API endpoints you are documenting.


Was this article helpful?