API Connector - Setup works but not in app

Hey all, I set up the Postmark Broadcasts Email API call through the API connector. The set up works fine when I initialize it. But when I try in the app through a workflow, I get a 402 error which means JSON error. I copied the JSON passed to the Action that calls the API (as shown in the logs) into the API connector to confirm that what I was passing is valid - and it ran fine. The JSON is perfectly formatted.

Any ideas what it could be? Is possible adding some extra character in production that is breaking it?

Can you share your settings in workflow?

Sure thing:
As mentioned, I have copied the JSON passed through this back into the API Connector and reinitialized with no issue. This has to mean that Bubble is adding something errant in the live call but I have no way to see what.

Try to use requestbin to debug. Send the request to requestbin using API connector and in workflow to compare

Good call. Here is the API connector response:

"Messages": [
			{"From":"Sample School <support@prentus.co>","To": "rod.danan+jorttg7r@prentus.co", "ReplyTo": "rod.danan+demo@prentus.co", "TemplateId": 28285602, "MessageStream": "broadcasts","TemplateModel": {"subject": "test","communityName": "Sample School", "domain": "demo.prentus.co","primaryColor": "#353640","adminEmail": "rod.danan+demo@prentus.co", "body1": "<p>test</p>", "communityLogo": "//prentusapp.cdn.bubble.io/f1682106407094x703832147770990800/sample-logo-white-1.png"}},{"From":"Sample School <support@prentus.co>","To": "rod.danan+d3k6zyex@prentus.co", "ReplyTo": "rod.danan+demo@prentus.co", "TemplateId": 28285602, "MessageStream": "broadcasts","TemplateModel": {"subject": "test","communityName": "Sample School", "domain": "demo.prentus.co","primaryColor": "#353640","adminEmail": "rod.danan+demo@prentus.co", "body1": "<p>test</p>", "communityLogo": "//prentusapp.cdn.bubble.io/f1682106407094x703832147770990800/sample-logo-white-1.png"}}

Here is the production data:

"Messages": [
			{\n  "From":"Sample School <support@prentus.co>",\n  "To": "rod.danan+jorttg7r@prentus.co", \n  "ReplyTo": "rod.danan+demo@prentus.co", \n  "TemplateId": 28285602, \n  "MessageStream": "broadcasts",\n  "TemplateModel": \n  {\n      "test": "subject",\n      "communityName": "Sample School", \n      "domain": "demo.prentus.co",\n      "primaryColor": "#353640",\n      "adminEmail": "rod.danan+demo@prentus.co",\n      "<p>test</p>1": "body", \n      "communityLogo": "//prentusapp.cdn.bubble.io/f1682106407094x703832147770990800/sample-logo-white-1.png"\n   }\n},\n{\n  "From":"Sample School <support@prentus.co>",\n  "To": "rod.danan+d3k6zyex@prentus.co", \n  "ReplyTo": "rod.danan+demo@prentus.co", \n  "TemplateId": 28285602, \n  "MessageStream": "broadcasts",\n  "TemplateModel": \n  {\n      "test": "subject",\n      "communityName": "Sample School", \n      "domain": "demo.prentus.co",\n      "primaryColor": "#353640",\n      "adminEmail": "rod.danan+demo@prentus.co",\n      "<p>test</p>1": "body", \n      "communityLogo": "//prentusapp.cdn.bubble.io/f1682106407094x703832147770990800/sample-logo-white-1.png"\n   }\n}

Looks like Bubble is adding in some weird characters in there for some reason. Wonder how I can stop it.

1 Like

I have seen this before too. So weird. Not sure why they do that. I saw the same thing before.

You can normally fix the issue by putting the live data in an arbitrary text then at the end choose JSON safe.

1 Like

Perhaps Bubble tries to add a new line after {

You could try to remove that enter and space and see what happens.

But indeed, Bubble does weird things now and then. Without telling you…

Got it working! So the solution was two things:

  1. I went through and removed every extra space and line break in the formatastext part. Also on the delimeter, I removed the extra line I was adding.
  2. Moved it into Arbitrary text. I did not use JSON safe since that added extra “” around the text which broke the API call.

Thanks for your help!


Glad you got it working. :blush:

Had the same issue and this worked! @rod.danan have you reported this bug to bubble support?
@henry.dowling @grace.hong

Yes I did but didn’t get a clear plan of action from them on how they will fix it.

1 Like