Storing data with unknown keys

  • 10 June 2024
  • 4 replies

I have an api that sends back a json object with keys that may change every time the call is made. It looks like custom objects require strict field declarations beforehand, so I’m not sure how to handle this data. Ideally I’d like to store both the keys and values, as I’ll need both of them. Thanks!


Best answer by Nathan Sudds 12 June 2024, 19:44

View original

4 replies

Userlevel 5
Badge +4

@William Freedman  I'm curious the use case for this, will you be needing to store these keys against the user?


If so maybe Custom Data Attributes is more suited to your needs. 

Feel free to share more if this doesn't look like a good fit for goals. 



I’m relatively new to Intercom so I’m not entirely sure yet. Basically, each key is a date and the value is information about that date. So I’d like each date to be a button, and then to store that date and the associated information for later use in the workflow.

Userlevel 5
Badge +4

@William Freedman interesting, is that information needed for the long term or just short term?


Wondering if it's better suited as a custom event potentially? But then it really depends on how long you need it for and where you want to reference it. 


Is this button you want something in your app, marketing or for the support team to reference, etc? 


More context can help from that perspective to understand the full picture for a recommendation. 


If you prefer feel free to DM or book a time on my calendar to discuss too, happy to jump on a call. 



I’ll only ever need it in the short term. Ideally I could store the api response in something like a local variable, make some buttons based on that response, store which button is clicked in a variable, then use that data in future api calls. What I basically want is the intercom equivalent of this javascript:

let dates = api_call(api_url); 

let selected_date = user.pick(dates) //prompt the user with buttons, store the response