I’m looking for a way to detect whether or not an api call to an endpoint in Bubble included an optional parameter. I know that absent optional parameters are considered empty, but not sending a parameter and sending a parameter with an empty value are not the same thing.
So basically, for a parameter called “contact_fname” I’m looking for a conditional like this “contact_fname was included in call is yes: formatted as text”
The specific use case/ need for this is outlined below:
I have a bubble endpoint set up for editing contacts in PowrLine. Our users can set up API calls to this endpoint (from Zapier for example) to edit contacts in PowrLine based on triggers from other platforms (like their CRM or a form on their website).
The user identifies which company and contact to create/edit using the required parameters (company id, api key, and phone number) and then has 16 other optional parameters they can include in the call for first name, last name, email etc.
Here’s a series of actions that illustrate my issue.
Action 1: A user’s zapier send a new call to PowrLine’s add/edit contact endpoint (triggered by their CRM) with following parameters. This creates a new contact in their company with the information included in the call.
company_id = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
api_key = xxxxxxxxxxxxxxxxxxxxxxxxx
phone = 7702380000
first_name = John
last_name = Do
email = joe@gmail.com
organization = powerline
Since the user’s CRM does not have matching information for them. The following parameters were not used in the above call.
notes
custom_field_1
custom_field_2
custom_field_3
Action 2: User manually adds text to the notes section of the contact in PowrLine, as well as one of the custom fields of the contact. This text is important to the user.
Action 3: The user changes the organization field of the contact in their CRM to “PowrLine” from “powerline”. This triggers another API call that sends information back to PowrLine (via the same endpoint it was created with). This call uses the same parameters as before (leaving out all the parameters that aren’t being used).
company_id = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
api_key = xxxxxxxxxxxxxxxxxxxxxxxxx
phone = 7702380000
first_name = John
last_name = Do
email = joe@gmail.com
organization = PowrLine
This API call triggers the workflow to edit the contact that was created earlier. Since the notes and custom_field_1 parameters were not included in the call, Bubble reads them as being “empty” and changes these fields on the PowrLine contact to “empty”, aka deleting the manually entered text in these fields that the user didn’t want changed.
I would like to be able to add something to this effect on the “Make changes to contact” action of the workflow: “notes was included in call is no: formatted as text” Then if notes were not included it just uses the existing text in the field rather than replacing it with nothing.
Is there a way to do this that I’m just missing?