Replacing Data within a JSON (set In)

Im trying to find a solution to updating a key within a JSON. Ill explain my end goal for the flow:

  1. Webhook from Pipedrive Updated Deal
  2. Search our internal DB which returns a JSON
  3. Update ‘deal’ a json key located at pipedrive.deal
  4. Upload new JSON back to our internal DB

The part Im stuck on is getting the JSON put back together. If there was a setIn function like for javascript variables, this would be trivial. I think part of the trouble Im having could be that Im not working with flat arrays, nor is this an option for returning the data to the DB.

Any suggestions would be so much appreciated!

Welcome to the Make community!

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. 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)

3. 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 them 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!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes

Thanks for the suggestion, but this I feel like I’ve asked a fairly high level question here. If you had some insight, that would be greatly appreciated

You’ll have to provide some examples for us to help you further. What do you mean by JSON put back together?

I would suggest completing the Make Academy before jumping into building a complete scenario.

If you need specific assistance when you are building a scenario it’s easier to help you then, by providing the information requested in my previous post.

Otherwise, you can also hire a professional by posting in the Professional Services category

Links

Here are some useful links and guides to help you get started and learn more on how to use the Make platform, apps, and app modules —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the Make unofficial Discord server!

2 Likes

Ive gone through each of the array functions. I have used lodash omit(), to remove the ‘deal’ key, but now I have no idea how to insert / replace the ‘deal’ with the new data.

So the equivalent method in javascript that I would like to use Make for would be similar to this syntax. The line of code with the setIn function, is where im hung up in make. This is what Im referring to putting it back together with new data

High level JS to describe exactly what would do the trick for me.

var updatedDeal = pipedriveWebhook.data.current // incoming webhook from pipedrive
var myData = queryMyInternalDB.data // my results, based on webhook data lookup

jsonData.setValue(myData) // set the variable state

jsonData.setIn([‘pipedrive’, ‘deal’], updatedDeal) // update the json w/ new pipedrive deal

updateMyInternalDB.trigger(jsonData) // send updated json Data back to my DB