Valid JSON body

Hello,

I would like to create a mailing in a sending system via an API. I would like to transfer the html template via the “Content” variable.
I always get the error message “Please enter a valid JSON body”.

Attached you can find the code from the API.

How do I have to format the html so that it can be transferred?

Does somebody has any idea?

Thanks,
Dennisbody

You don’t have the " " around 1234, 12346 and HTML.

Also you did a space after each : - not sure if that’s breaking it too, but I don’t usually put a space

2 Likes

To add to the above comment when sending HTML in JSON Your HTML within the JSON will need escaped out as per the attached link:

If you are using simple text within your HTML magic text within your JSON snippet above it will work fine. But when applying styles to your email HTML it will not work unless you escape your HTML.

I used several email providers and they will all throw the same problem if HTML is not escaped.

Thanks for your feedback. The missing “” were just for the screenshot and its still the same when I add them. The problem is only when I add the html.body

I have the same problem, the input fields automatically delete “” … Why?

Until recently everything worked!

Hi @miticobeppe,

Could you please provide the screenshot with the non-working JSON?

Best,
Victor

Example, I insert this JSON text with HTML in the subject of the mail when I press “DONE” automatically (I don’t know why) the system eliminates the syntax of the HTML:

FROM:
<html><head></head><body><p style=\"text-align: center;\"><span style=\"color: #0ac5cf; font-size: 18pt;\"><strong><span style=\"font-family: arial,helvetica,sans-serif;\">Benvenuto nella community</span></strong></p></body></html>

TO:
<p style=\"text-align: center;\"><span style=\"color: #0ac5cf; font-size: 18pt;\"><strong><span style=\"font-family: arial,helvetica,sans-serif;\">Benvenuto nella community</span></strong></p>

I noticed this error today, because I had already created the mail sending with JSON + HMTL and everything worked, then today I modified and I realized that adalo eliminated the syntax and this results in an error.

What happened? I tried to insert the JSON + HTML code also in an input field, but the same thing happened.

Why is it eliminated? I had personalized emails and now I can’t edit them anymore!
<html><head></head><body>

Hi @miticobeppe,

As I understood, the problem is NOT with the being unable to insert JSON (like on the first post)?
In future, I would advise to consider creating a separate post for this as your case doesn’t relate to the original topic - this will help future readers to find information easier.

As for your question - if I understood correctly Adalo stripped off the opening and closing tags for and ? It is an interesting effect, didn’t know about it :slight_smile: I tried this by myself - here are the results:

  • when I try to use < or > in configuring custom action in parameters (variables), it automatically replaces it with < and >
  • when I try to put or directly into the custom action parameters (Action → Custom Action), builder deletes these tags completely.

I wonder why this was implemented…

Best,
Victor

yes you understood correctly. TAGs are removed automatically. But before this was not the case in fact I had created a custom code to send emails and everything worked! now I am also wondering why they implemented this automatic REMOVAL!

@anon78309838 can you help us understand why? can you ask the team why they implemented this feature?

No news??? Nobody, and not even the Adalo team, knows why it is no longer possible to insert HTML code in the input fields or even in the custom actions?

@anon78309838 , @Victor please?

This change was made for security reasons. We are certainly at fault here in not communicating this thoroughly and do understand that these changes may have impacted several use cases that our makers might have embedded in their apps.

We apologise for the inconvenience these unexpected changes may have impacted your app but we have not taken these actions without due cause.

1 Like

@Colin thanks for the reply. however, I am no longer able to send personalized emails to my users upon registration. are you going to release other features on that? or is there another method to send personalized emails?

Hi @miticobeppe,

I’m not sure which type of email provider do you use, but in my experience with SendInBlue I managed to create quite extensive setup of personalised emails.
I did it via SendInBlue templates - all is set up there, and I pass only necessary parameters from Adalo (for example, recipient email, booking time - this is a booking app, booking status, etc.).

As for me such approach is more flexible: it takes much more effort to create HTML emails in Adalo, I prefer to use specialised service for this.

May be this could be helpful for your case as well.

Best regards, Victor.

@Victor this could help me… I use sendinblu for sending mails. how do you create personalized emails with Adalo parameters?

Hi @miticobeppe,

I don’t have an instruction at hand. As I answered in DM, please see the docs here: Batch send customised transactional emails

May be I will create a video for this some time :slight_smile:

Best regards, Victor.

1 Like

Hi all,

I can confirm that is now broken. It is impossible to correctly insert variables into the HTML code of the JSON, because the editor moves around/removes HTML tags automatically.

@Victor - your tutorials were great and worked until Adalo broke this.

Hi @Vasily,

Just checked - Adalo removed HTML, HEAD, BODY tags. But tags like P remain. This is enough to send basic formatted letters.
And as I suggested above - if you’d like to send more complex emails, using templates is the best way to do this; it saves a lot of time and effort (and also allows to use mail tracking capabilities like mail open, deliveries, etc.).

Not sure how this is related to my tutorials though :))

Best regards, Victor.

Hi @Victor

Yes HTML formatting tags still remain, but it’s impossible to insert a variable inside that HTML content because the tags keep getting moved as you edit. That’s the problem!
The reference was to your password reset tutorial - Adalo tutorials: customised password reset

Do you have an example / article of how to use templates?

Thanks!

Hi @Vasily,

I checked that exact tutorial and it works. I did that before answering you yesterday.
This is how the custom action looks like:

As you can see, there are no HTML, HEAD and BODY tags, but password reset messages are received successfully.

If you experience problem with custom action, I would advice to see if it works in a test mode and if you can see the messages on your email provider side.

Best regards, Victor.

Hey @Victor

If you try and wrap the Code variable around for example a tag, you still see that the tag gets closed before the variable.