Webhook to JSON (invalid json)

Hi, I have a scenario that start with a webhook, into parse JSON and the problem is the webhook comes in with the json formatted properly with new lines expressed as ‘\n’ but when it gets to the parse JSON module its expressed as a new line. How do I maintain the formatting from the webhook?

How are you mapping it into the Parse JSON module?

You can try this:

Screenshot_2024-02-16_120229

3 Likes

Your second screenshot doesn’t match anything in your first screenshot. I’m confused now.

If you need further assistance, please provide the following:

1. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

2. And most importantly, Input/Output bundles

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading it here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

2 Likes

Ok, thanks for your help, I have added the downloads and input/output below.

blueprint.json (40.5 KB)

[
    {
        "json": "[\n  {\"name\": \"API Key\", \"value\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2NhdGlvbl9pZCI6IldQVk9zbjFzZDcyRXVVTDJlWjlKIiwiY29tcGFueV9pZCI6InBqbHFHa0liNTBmekFWQXJTWHpqIiwidmVyc2lvbiI6MSwiaWF0IjoxNzA4ODU3OTIzMjk5LCJzdWIiOiJ1c2VyX2lkIn0.fUylXQTIzgNEEYLjeD3C9d1TT5vRapU3GIH_53dvxhU\"},\n  {\"name\": \"Bump SMS 1.1\", \"value\": \"Just bumping this up in case you got busy before and forgot to respond :)\"},\n  {\"name\": \"Bump SMS 1.2\", \"value\": \"{{contact.first_name}}?\"},\n  {\"name\": \"Bump SMS 1.3\", \"value\": \"Or would you prefer to speak on the phone?\"},\n  {\"name\": \"Bump SMS 2.1\", \"value\": \"Seems like we hit a pause – want to resume where we left off?\"},\n  {\"name\": \"Bump SMS 2.2\", \"value\": \"I'm all ears if you want to continue our conversation\"},\n  {\"name\": \"Bump SMS 2.3\", \"value\": \"No worries, I'll close down your file for now :)\"},\n  {\"name\": \"Bump SMS 1\", \"value\": \"{{contact.first_name}}?\"},\n  {\"name\": \"Bump SMS 2\", \"value\": \"Sorry {{contact.first_name}}, I just wanted to follow up on your solar and battery sytems inquiry {{contact.lead_generation_date}}. Sarah\"},\n  {\"name\": \"Bump SMS 3\", \"value\": \"I must have the wrong number, apologies! I'll take you off my list. Thanks, Sarah.\"},\n  {\"name\": \"First Outgoing Message\", \"value\": \"Hi there, it's Sarah from {{location.name}} , is this the same {{contact.first_name}} who inquired about solar and battery sytems {{contact.lead_generation_date}}?\"},\n  {\"name\": \"Prompt Custom Fields\", \"value\": \"I want you to extract key data points from this conversation thread and return them in a comma-separated list. The data points I want extracted are: - Did they already get solar and battery sytems.  - If they already have solar, are they in the market for a battery system. - Approximately how much do they spend on energy each year. - . - . - . -NOTE: I want the data in plain text. Do not include any commas APART from separating the answers. If any of the data points are skipped for any reason, place 'N/A' in its place, as your response will be mapped. This is the conversation: {{ai_memory}}\"},\n  {\"name\": \"Webhook Extract Time\", \"value\": \"https://hook.eu1.make.com/63bna3mptdqzag53j4u2v9lw54n0584b\"},\n  {\"name\": \"Webhook SEND Lead to Client\", \"value\": \"enter webhook url\"},\n  {\"name\": \"Webhook ChatGPT Conversation\", \"value\": \"https://hook.eu1.make.com/9co0h271h8qu2ds5e5e5ulvuxmmqo7hm\"},\n  {\"name\": \"Webhook Get Custom Fields\", \"value\": \"https://hook.eu1.make.com/3qq9o63wa4pxp2snk5oqxjadqjkyaicq\"},\n  {\"name\": \"Webhook Moderate\", \"value\": \"https://hook.eu1.make.com/48td10nw27uogr9uoy48u6lrn3pcw3v8\"},\n  {\"name\": \"Webhook Lead To Client\", \"value\": \"enter webhook url\"},\n  {\"name\": \"Booking Link\", \"value\": \"enter calendar url\"},\n  {\"name\": \"Industry\", \"value\": \"renewable energy\"},\n  {\"name\": \"Product Or Service\", \"value\": \"solar and battery sytems\"},\n  {\"name\": \"Contact Number\", \"value\": \"08 8450 0800\"},\n  {\"name\": \"AI Name\", \"value\": \"Sarah\"},\n  {\"name\": \"Where Did Contact Come From\", \"value\": \"They enquired on our website\"},\n  {\"name\": \"Working Hours\", \"value\": \"Mon-Fri 8am-6pm\"},\n  {\"name\": \"Anything Else\", \"value\": \"\"},\n  {\"name\": \"Brief Company Description\", \"value\": \"Born out of the need to service and repair solar systems installed by companies that no longer exist, NRG Solar is one of the most reputable solar installers operating in Adelaide and Sydney. We’ve worked with many iconic, local brands and people to bring them clean, green and stress-free energy in residential and commercial settings.\nEddy May co-founded NRG Solar in 2014 with exceptional customer service and an unending enthusiasm for renewable energy at its heart. You won’t find a more dedicated and reliable solar team.\nWe do more than just install and maintain solar systems. Our team is truly passionate about making a difference at every level and our solar expertise is unrivalled. Our core values of care and sustainability drive our day to day decisions and steer our business forward.\"},\n  {\"name\": \"FAQs\", \"value\": \"- We can offer finance so they can use the savings from their bills to pay for their new system - We can help them with a competitive price on solar and battery systems for their home. -  -  -  -  -  -  -  - \"},\n  {\"name\": \"Qualification Q1\", \"value\": \"If they already have solar, are they in the market for a battery system\"},\n  {\"name\": \"Qualification Q2\", \"value\": \"Approximately how much do they spend on energy each year\"},\n  {\"name\": \"Qualification Q3\", \"value\": \"\"},\n  {\"name\": \"Qualification Q4\", \"value\": \"\"},\n  {\"name\": \"Qualification Q5\", \"value\": \"\"}\n]"
    }
]
[
    null
]

Replace

Screenshot_2024-02-26_100219

with

This should preserve the newlines in the description variable.

2 Likes

I tried that and it didnt work

You could try ///n and let me know what errors or output you got.

What about instead of //n (the third parameter of the replace function), you use {{newline}}?

This should use Make’s newline character.

2 Likes