Adding/modifying JSON with Make? Answered
Hi,
I'm just getting started with Memberstack but I think I've established I'll need to use JSON to store some additional complex bits of member data.
There will be occasions where updating something in Airtable would then prompt adding or modifying a member's JSON in Memberstack. I'm using Make from some other things – is there a way of using Make for this as well? And if not, what are my other options?
Any help or guidance would be really really appreciated!
Comments
19 comments
Hi Charles Lewis 👋
First off, welcome! Glad you hear and excited to see what you build.
UPDATED May '24 :
I can confirm it's possible to update JSON using Make.
Thanks Duncan from Memberstack! Are you able to point me in the direction of a couple in particular that use Make to update Member JSON?
I was looking for something in Make similar to the custom fields and metadata fields, but I'm guessing it's a bit more complex than that then?
Hey Duncan from Memberstack I'm also trying to work on something similar and it would be helpful to see the specific set up for how to update the member JSON in Make. What I'm stuck on right now is how to add something using make to the JSON object without overwriting the whole thing. Hopefully I can figure it out soon.
I too would appreciate seeing an example of how to cleanly make changes to the JSON with something like Make.com Duncan from Memberstack as I'm currently looking into a way of using Memberstack for an MVP without having to lean on something like Xano/Wized just yet by using the member JSON as a light way of storing data on use profiles.
Josh Lopez Julian Galluzzo
I'd love to hear what you guys think about this one.
I just remembered that most of the MemberScripts are using the DOM package (not Make, as I thought). I'll keep looking for an example...
I did use Make + Metadata for this Credit System Tutorial.
And this documentation might help as well... but I'm not sure. https://docs.memberstack.com/hc/en-us/articles/15731922023451
Hey Duncan Hamra,
I'm also looking for a solution to this. I've started to write out some script that you can run in Airtable scripts but I'm a long way off from getting it to work.
Best,
Nicholas
Hi, did you guys find any solution to this? In order to only update some json within make and not have to rewrite the whole thing?
Josh Lopez I wonder if we could create a short tutorial video or article that would explain best practices when updating JSON? I know we usually recommend grabbing the JSON, manipulating it, and then updating it - but it's easier said than done.
We have a lot of examples here https://docs.memberstack.com/hc/en-us/articles/15731922023451-Advanced-JSON-Data-Usage-With-The-Memberstack-Dom-Package
I'll make a new doc that will show how to do it in make and zapier.
Josh Lopez that would be awesome!! Being able to manipulate JSON via Make has stumped me and others in the past - so a new doc would be greatly appreciated 🎉
Update on this. We are trying to figure out how we can add additional functionality in the make and zapier apps that will help with updating member JSON data! Keep an eye in the announcements channel in our slack community for additional updates.
Thank you!
+1
Duncan from Memberstack
Please can you explain in a bit more detail how to not overwrite existing member JSON in Make?
I am trying to create an image upload feature for each user that sends the uploaded images to Google Drive - then turns the images into JSON - and then sends that JSON back to the member (using the unique Memberstack ID) - then to be displayed back into the web app in the user's dashboard (by accessing the member JSON).
I can't figure out how to NOT overwrite the existing member JSON. I simply want to add to it.
Hey Josh Dean
I dont think this is possible at the moment. What we recommend is to get the json, add or update it, then send the whole json object back.
Hey Josh Lopez , thank you for letting me know.
But 2 questions: -
1. Is there any other way to get the user's uploaded images to be displayed back in their dashboard other than using JSON?
2. If not, how do I get the JSON and then add or update it?
Josh Dean Here is some additional info that should help. If this doesnt make sense or you cant get it working I suggest reaching out to one of the experts here to help with your custom code.
To use JSON with Memberstack 2.0, you can leverage the Memberstack DOM Package and the Memberstack Admin API to retrieve, update, and save JSON data for members. Here’s a step-by-step guide:
1. Retrieve Member JSON Data
First, you need to get the current member's JSON data. You can use the getMemberJSON function from the Memberstack DOM Package:
2. Update Member JSON Data
After retrieving the JSON data, you can modify it as needed. For example, you can add a new field or update an existing one:
3. Send Updated JSON Data Back to Memberstack
Use the updateMemberJSON function to save the updated JSON data:
await memberstack.updateMemberJSON({ json: memberJson });
Example: Complete Script
Here’s a full example that gets the member JSON data, updates it, and saves it back to Memberstack:
Using Memberstack Admin API (for server-side operations)
For more advanced operations or server-side handling, you can use the Memberstack Admin API. Here’s how you can update a member's JSON data using the REST API:
For anyone that comes across this in the future... I can also confirm that it is possible to work with Make.com to retrieve member JSON manipulate it inside of make and then send it back into Memberstack. What finally worked for me was getting a lot of help from chatGPT to figure out the right regular expressions I needed in order to consistently find and replace segments of the JSON for a member that I wanted to add or update. The modules that I used in make were 1) Transform to JSON which allowed me to take the json data from the get a member module and turn it into one string. 2) Text Parser Replace which in combination with regex you can target and manipulate the items in the json. Once you have the changes made you can have the module output the entire string including any original json and send that right back into the update member module for Memberstack. This is a greatly oversimplified description but it might be just the little bit of help someone needs to figure out the next step in their project.
Please sign in to leave a comment.