API Call DELETE Contact with Sendgrid

Hi there,

I have an issue with the dynamic expression for a DELETE call through Sendgrid API and therefore API Connector. Basically to delete a contact in Sendgrid from Bubble the process is simple: first a POST call to get “contact_id” (from the email stored in our Bubble DB) and then a DELETE call to delete the contact in Sendgrid (delete the contact in a list, marketing campaign list) from the “contact_id”. It can only be done this way, in 2 steps/calls, since Sendgrid needs the id of the contact to delete it, the email is not enough. The POST+DELETE call sequence works perfectly if I indicate a value in the param (on API Connector). The contact is then properly deleted on my campaign list.

The issue is really in my “step 3” in the WF for the dynamic expression. The dynamic expression of the step 3 “delete_contact” call is taking automatically the email of the contact used for the initialization call (in this case “quent-s@hotmail.fr”). I simply cannot change it to “Result of step 2’s contact_id” which should be the correct dynamic expression. It cannot be changed. Don’t know why. So the call/WF works, deleting “quent-s@hotmail.fr” from the Sendgrid list instead of “Current User”.

Any clue what’s going on? I mean i keep the param value empty and private, so that dynamic data is enabled, call is non private, and query, as requested by Sendgrid. Indeed Sendgrid requires this call to be Query. But why on earth is the dynamic expression in Step3 a non-dynamic one basically adding the initiaitlization call email used? I tried to set this up from scratch on another Bubble app. It does the exact same thing!

Hope someone can help! Best

According to Screenshot, seem that Sendgrid will return “emailaddress”:“id” as the response in search action. Sadly, this is the kind of payload that Bubble cannot handle. Instead, use the Search contact endpoint.

Thanks Jici. I don’t fully get it, what do you mean by “this is the kind of ‘payload’ that Bubble cannot handle”? What is your alternative to my POST+DELETE calls, therefore do a POST search contact (your link) as Step2 and then used the DELETE call as Step3? That should fix the dynamic data expression and this way i’ll be able to use “step 2’s contact_id” and not “quent-s@hotmail.fr’s contact_id” so with real dynamic data, correct?

The problem is they key returned by API will change according to the email. Using the search contact endpoint, according to documentation, will return a payload that you can use in Bubble.

1 Like

Thanks - but your proposed POST call just gives me metadata, not the contact_id of the current. So it doest not fit the need. Let me know if you get to set it up properly on your side with dynamic data.

According to doc, it will return the ID

Okay but it actually returned the meta, not the ID. So we had to pass the data through an API we made, and then to Sendgrid. So far, no solution right now for this. Would be great that Bubble develops a plugin for this.