Is the API connnector broken?

I have spent most of the past week developing an integration with WhatsApp Business API without encountering any significant issues. However, when attempting to update the authorization token today, a portion of the API connector disappeared, causing the backend workflow actions to behave erratically. Some of them indicated that the connector was missing, while the others lost their field values, as shown in the attached picture.

To my dismay, I cannot revert to an older version since Bubble prohibits me from deploying it, claiming that it is out of sync with the live version. I find this to be utter nonsense, but I will not dwell on it. I attempted to resolve the issue by exporting the previously functional version, exporting the app, syncing it with the live version, and reimporting the functional app. However, as soon as I pasted the new API key, it broke once again. At this point, I am seeking assistance. Could someone please help me out?

[edited for clarity and spelling]

Okay so this is a normal behaviour and I’ll explain why and how you can avoid this.

First of all, when you initialize an API call in the API connector, what you’re doing is telling Bubble “Hey, when I do this API call, I should get something that looks like this”.

The mistake

The problem is that if you re-initialize an API call after it’s already being used in workflows and the API returns something that’s missing certain fields that appeared the first time you initialized it, then your workflows will break. This is because those workflow actions are trying to reference a field that didn’t appear the last time you initialized the call (that’s why it says missing).

How you can avoid this

First of all, make sure you test everything using postman before trying to initialize a call. This way, you don’t break your calls with syntax errors or whatnot.

Second, if an API call returns X field in some situations but also returns Y fields in other situations, then the solution is to create two different API calls for those two solutions.

For example, in API I am using I have two calls called “Get business account” and “Get individual account” that make the same request to the same endpoint. But they need to be separate because I’ll get different fields returned for them.

Et voila. API Connector is not broken, ya just gotta take this into consideration. Let me know if you have questions

3 Likes

First of all, thank you for taking the time to help me.

I just need to clarify one thing: I didn’t reinitialize the call. I only changed the text on the value of one of it’s header’s fields (auth_token), changin one key for the other. The firs time I did that, the whole API connection simply disappeared. The second time, it stayed there, but the backend workflow was broken - half said [missing: apiconnector:whatever:] ant the other part kept the same name, with most of the fields gonne or empty. I didn’t expect that.

I have tried it again, and that’s it: if I change the value of the token, the connector breaks, even if I don’t reinitialize it.

Oh, I like your suggestion to use different api calls, but WhatsApp uses the same webhook for all the calls they make me… So I went to Postman and just engineered a all-in-one Frankenstein call with all the possible fields it sends me, used that to initialize my backend workflow and use some of the values when I know I’ll have them… Kind of ugly, but it was the only solution, as Bubble won’t let me have two backend workflows with the same name, and choose which one to trigger according with the call’s content.

BTW my task to rewrite the Actions that were missing got so much easier after I found the “replace with another type” option, when I right click the broken one. Still had to rewrite all the expressions, though. :persevere:

Thanks again for your attention.