How to get the answer of open ai to push in http?

,

:bullseye: What is your goal?

send response of openai to http (gohighlevel blog)

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

the blog is empty the response of ai is not sync

{
“title”: “{{1.customData.topic}}”,
“locationId”: “{{1.location.id}}”,
“blogId”: “Oue5iuWmtTqiCJFLrn7i”,
“rawHTML”: “{{2}}”,
“tags”:
}

:clipboard: Error messages or input/output bundles

The operation failed with an error. Expected ‘,’ or ‘}’ after property value in JSON at position 150

:link: Share a link to your scenario

https://us2.make.com/1693166/scenarios/3730637/edit

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

Welcome to the Make community!

Here is the issue.

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

1 Like

Thank you so much!
i use it but i get an error again.

this is my body content on http:

{
“title”: “{{1.customData.topic}}”,
“locationId”: “{{1.location.id}}”,
“blogId”: “Oue5iuWmtTqiCJFLrn7i”,
“rawHTML”: “{{replace(replace(1.text; “/([””\])/g"; “$1”); “/\r?\n\r?/g”; “\n”)}}",
“tags”:
}

Please, no screenshots of input/output bundles.

Please provide the input/output bundles of each of the relevant modules by running the scenario, or get the bundles from a previous run from the Scenario “History” tab.

Providing the bundles from a scenario run will allow others to replicate what is going on, especially if there are complex data structures (nested arrays and collections) and external services. This helps mapping the correct raw variable names from collections (instead of the label/display name).

Need help❓View instructions ◀

Click on the white speech bubbles on the top-right of each module and select “Download output (or input) bundles”.

A. Upload a Text File

Save each bundle contents in a plain text editor as a moduleNumber-output.txt file. Open the file to check if it has not added additional formatting or encoded the plain text.

  • You can upload files and images to this forum by clicking on the upload button:

    Uploading an attachment here will look like this:
    module1-input.txt (1.2 KB)
    module1-output.txt (3.4 KB)

B. Insert a Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the bundles AND format them correctly.

:warning: Formatting IS Important! :warning:

Here are some ways to provide text content in a way that it won’t be modified by the forum.

  • Method 1: Type code fence manually
    Manually type three backticks ``` in a separate line before and after the content, like this,

    ```
    text goes here
    ```
    
  • Method 2: Highlight the pasted content, then click the preformatted text/code button

  • Method 3: Upload your file elsewhere and share the public link
    This method is only advised for large files exceeding the forum upload limit.

This will allow others to better assist you. Thanks!

@samliew