Generate Verification Ticket

I need to generate a verification ticket to include in an API call I have that sends the verification email. This API is inside a post-registration hook. What is the best way to go about this? Can I call this inside of my hook: /api/v2/tickets/email-verification, if so, will I also be able to make a call to get the access token inside my hook? I need to include the verification link inside of the verification email my API call is sending. Just need help finding the best and right approach.

Hi @molly.kelsey,

Yes, you are on the right track. I am assuming you are doing this on signup (post registration hook). You can register the hook as a M2M connection, and give it management API permissions. You will then need to request a token, make the call to get the email verification link, and send the API request to your backend.

Another strategy would be to handle this all in your backend, just make the API call from your hook to your backend, and request the email verification ticket there.

Be aware of the management API rate limits, you will want to be prepared to handle too many requests errors if you are expecting a surge of signups.

Let me know if you have questions!
Dan

1 Like

Going down the route of doing this all in our backend. I’m trying to get the access code, and am getting a ‘forbidden’ error message saying I need to create a client grant. Is all of this really necessary just to get a verification ticket? It feels like i’m having to make 2-3 additional api calls just to be able to call the verification ticket api.

Calling the management API to from your backend should be fairly standard OAuth transaction. You will request an access token, then use the access token to call the management API to get the ticket. From there you can do what you wish with the ticket.

What framework is your API?

Also, have you considered using the built in email functionality? It sends a verification email on signup automatically, essentially what you are trying to do here unless I am missing something.

We are wanting to only send the verification email IF they click a newsletter checkbox. Otherwise we just want to send a welcome email to them.

Okay I see. I would suggest verifying all of your users if you don’t have a strong reason not to. Email verification has security implications, like preventing easy bot signups, spam accounts, etc. This is why it is built into flows.

Were you able to get an access token working?

Yes, I was able to get the access token inside of my post-registration hook and pass that to my api call to get the verification ticket in our backend.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.