Open Ai connecting to GHL

:bullseye: What is your goal?

onnect GoHighLevel (GHL) SMS replies to OpenAI via Make so that:

When a contact replies via SMS in GHL

The message is sent to OpenAI through a Make webhook

OpenAI generates a response

Make sends the response back to the same contact via the LeadConnector Conversations API

In short: build a fully automated two-way AI SMS conversation between GHL and OpenAI using Make.

:thinking: What is the problem & what have you tried?

What works:

GHL successfully triggers a webhook on inbound SMS

Make receives the webhook payload

OpenAI generates a valid response (confirmed in OpenAI module output)

The OpenAI response is visible in Make execution logs

What does NOT work:

When Make sends the OpenAI response back to GHL via HTTP (POST to LeadConnector Conversations API), GHL returns: 422 Unprocessable Entity
“There is no message or attachments for this message. Skip sending.”

:clipboard: Error messages or input/output bundles

{
“status”: 422,
“message”: “There is no message or attachments for this message. Skip sending.”,
“name”: “HttpException”
}
This is what I have inputed-
{
“type”: “SMS”,
“contactId”: “{{1.contact_id}}”,
“message”: “{{3.output.content.text}}”
}

:small_blue_diamond: Additional context (important)

This is a real-time SMS workflow (timing-sensitive)

The issue appears related to how Make handles OpenAI output fields vs. JSON string serialization

Possible race condition, output truncation, or incorrect field reference when OpenAI returns a response object instead of a simple string

Suspecting either:

Incorrect OpenAI output field to map or

A Make bug with OpenAI module output + HTTP JSON string

What help is needed

Confirmation of the correct OpenAI output field to map for HTTP SMS sending

Best-practice pattern for GHL ↔ Make ↔ OpenAI two-way SMS

Whether this is a known Make + OpenAI module issue

Recommended workaround if OpenAI output must be transformed before sending to GHL

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Welcome to the Make community!

Here’s where the issue lies.

Escaping strings before mapping into another JSON string

Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain special characters that are reserved. Special characters in JSON needs to be escaped (encoded) as a “literal” character, otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.

You can escape string variables by passing the text into the “Transform to JSON” module. You can also build a valid JSON string by using a Data Structure with the “Create JSON” module. Then, you can map the output of the Transform module into another JSON string, or simply use the whole output of the Create module.

:warning: Note:

When using the “Transform to JSON” module on a string-type variable, the output should already contain the double quotes " " around your text, so when you map this output into your JSON, you should not need to wrap another pair of double quotes around it.

Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions. To do this, simply paste this into the field, and replace the 1.text variable:

{{ replace(replace(1.text; "/([""\\])/g"; "\$1"); "/\r?\n\r?/g"; "\n") }}

For more information on JSON and escaping JSON strings, see:

Hope this helps! If you are still having trouble, please provide more details.

— @samliew