Saving data from SendGrid API response to database

Hi there

I’m having some troubles setting up a flow that retrieves the contact ID from SendGrid using the user’s email address. I’ve tried to debug it from other forum topics but I’m still struggling.

Context: I want to retrieve a user’s contact ID from SendGrid and store it in my Bubble database so I can have a delete flow that deletes the contact from SendGrid when the user deletes their account. This delete endpoint from sendgrid requires their contact ID but this isn’t returned in the initial response when a contact is created, so I have to first retrieve the contact ID through a separate workflow and then save it.

My current setup is this:

  1. I have a backend API workflow to run the retrieval and storage

  2. This workflow uses an endpoint I created in the API connector with a JSON body to retrieve the contact ID (base on this SendGrid endpoint - Get Contacts by Emails | Twilio)

  3. I have the API response defined to return only 4 attributes from the response

  4. I have an update action to save the contact ID from SendGrid to the user

If I initialise the call using an existing email address as the default, keep the response saved with the specific user’s data and then run the flow with the same user, the whole flow works and the id is saved. As soon as I try to make it dynamic by manually defining the API response, the flow doesn’t work.

Would really appreciate any help I can get. Been wracking my brain over this one for a while.


IT will probably not work because the parameters name is dynamic. You will get a “dictionnary” of values in <user_email> parameters. example: “”:{}
You cannot really use API Connector for this kind of API Response. You may need to create your own Plugin with a server side action to call this API Endpoint.
Another solution that may work is to set the answer of the API to TEXT instead of JSON. And use a json plugin or JS Toolbox plugin to parse the response (or you can also use extract with Regex)

Thanks for the response! Shame that it’s not possible to handle this type of response :frowning:

I’ll see if SendGrid has another way to retrieve the Contact ID.