Require Email Confirmation + different registration methods + custom email templates?

I have two ways of creating a user:

  1. Regular registration
  2. Registered user adding their own users (thus registering them)

I would like to require email confirmation for both but for the latter, I would like to send a custom email template. It seems as though any registration will trigger the Confirmation template email—which I cannot disable if I want to preserve Require email confirmation. I would even be open to bypassing the email confirmation for the second type of user but I don’t know if that is possible.

Is there a way to either:

  1. Require email confirmation while using either one of two different email templates?
  2. Bypass the email confirmation requirement when using the User registration (via Codeless)?

To help me answer your question, could you please tell me which API you use for the following way of creating a user:

Registered user adding their own users (thus registering them)

Sorry, I edited my comment but you’re already up and at 'em.

I’m using Codeless. I’ve also edited my original question.

In order to send out different emails, you need to register users differently. If you use the user registration API (regardless whether it is from code or using Codeless), it boils down to the same event which triggers the email. However, if you use the registration API for (1) and Database API for (2), then it would be possible to send out different emails. The first email type would be sent from an event handler for the Register user API and the second email would be sent from your Codeless logic.

1 Like

This still triggers the Confirmation template email to be sent, as if using the Users API. I don’t want the standard registration email to be sent in this situation.

.then(resp => { … }

Am I using the right call? I want to create the user without having a registration email triggered and send a custom template email on my own.

I’ve also tried this approach with Codeless but it too triggers the registration email. I’m starting to think this isn’t possible.


Hi Stephen,

I apologize for misguiding you. I didn’t realize the database event of creating a user in the Users table triggers the email.

When a user registers someone else, does that call need to happen in Cloud Code? That’s the part that makes it very challenging. The reason is there is a rule that Backendless will not call Cloud Code for anything that got triggered from Cloud Code. For example, if you save a user from Codeless (or any other form of Cloud Code), the registration API event will not happen. If it did, it would be a solution for what you need. So my question is - does the second scenario, when a user registers someone else, need to happen on the server side or you can do it from the client?


Hey Mark,

I don’t have a preference for how the user registers someone else. I’ve tried both. I have tried a couple of Codeless approaches (Data API > Save Object in Backendless and Users API > Register User) but so far both have triggered the registration email. On the client, I’ve tried registering via the User and Data APIs.

Here’s what you could try:

  1. Disable Confirmation template.
  2. Do both direct user registration and registering a user by another user on the client side. The former will use the Registration API and the latter will use the Data API.
  3. Add afterRegister event handler in Business Logic. It will be called when the registration API is used. In that handler you will send out an email (using a custom template perhaps) to the users who register directly.
  4. Add afterCreate event handler in Business Logic. The event handler should be created for the Users table. It will be called when the Data API is used to register a user by another user. You will need to add logic here as well to send out an email.

Hope this helps.


Thanks, Mark. That is a good approach but the tricky thing is that Backendless currently insists that in order to use Email Confirmation, I must use the Confirmation template. I am finding that limiting because I do want to use Email Confirmation… but I need to register users in two different ways that require different messaging.

Hi Stephen,

You can disable email confirmations in console. Here’s a video that shows how to enable them, disabling is the same process:

Once email confirmation is disabled, create two separate templates and use them in two different event handlers.


The problem is that I do want to use Email Confirmation but seem to be coupled to the Confirmation template to do so.

Yes, the email confirmation toggle is coupled with Confirmation template. With the solution I proposed (2 event handlers for separate API events), you’d need to implement the email confirmation link in your business logic.

Ah, yes… leverage the userStatus column independently. I’ll try that. Thanks.

Edit: Am I restricted from setting userStatus via Codeless? It’s not letting me with this approach:

Does anyone know if I am restricted from setting userStatus via Codeless? The field doesn’t appear (to me) in the schema…

Hi @Stephen_Peasley,

Unfortunatelly currently there is no way to chage userStatus from Codeless due to security reasons and internal logic constrains. We will discuss today possibility of extending API for covering your case.

Regards, Andriy

Thank you. I’m interested to see what comes out of the conversation. For me, this was driven by my need to have control over the Confirmation template being sent only when I want it to (not on every User registration) while still being able to require users’ Email Confirmation. I hope that helps inform the discussion.

I’m assuming it’s best if I figure out some kind of workaround for now?

@Stephen_Peasley we have internal ticket BKNDLSS-21703 and discussing possible solution.

1 Like

Hello @Stephen_Peasley

Unfortunately, there is no way to separate the registration process using build-in API, because it doesn’t matter which API you use to register a new user, BeforeRegister and BeforeCreateObject EventHandlers will be invoked for both cases below:

  1. create a new User object using Data Service
  2. register a new User using Users Service

However, we can propose you a workaround

  • create a new API Service to replicate the EmailConfirmation flow,
  • the API Service will be able to generate/store and verify the confirmation token
  • in your logic, you can request a new token for a particular user and send specific Email with the token
  • you can build the verification URL which will point to your app which in turn will send a request to verify it and change the user’s status

We have added an API for changing UserStatus which works only inside BussinessLogic, but it’s not released yet, I assume it will be released in a few days (BKNDLSS-21736)

To store these verification tokens you can use Data Service or Cache

Also, we are going to add another API for requesting the verification URL but it won’t be soon.

Regards, Vlad

Hi, @Stephen_Peasley

We’ve just updated cloud servers with a fix for the issue you described above. We have added a new Codeless block to solve your problem.
You can find it in the Users API section.


1 Like