How to Validate Custom Invitation Codes

If you need to provide someone or a group of people direct access to your website or application without them having to signup for your waitlist (to be invited and get a unique invitation code), you can create custom invitation codes for them. 

Custom invitation codes can be set to expire after a given number of uses or time. These are good to directly hand out to journalists, bloggers, investors, social networks, etc.  These people can immediately use this code on your website or app to create/register an account. 

Types of Invitation Codes

To better understand how custom invitation codes differ from unique invitation codes, here's a comparison: 


Unique Invitation Code Custom Invitation Code
Tied to user's email address Yes (exclusive to the invited user) No (anyone can use it)
Validation requirement Secret Decoder Key API
Creation process Automatically generated Manual




Note: Both invitation code features are part of the Beta Management suite which is only available to Pre-launch Campaign type projects

Creating Codes

Custom invitation codes can be generated within the Prefinery project dashboard by navigating to Settings > Invitation Codes

You can set your own code name and then specify how many times can it be used/claimed, and/or if it expires and can no longer be used after a specific date and time. 

Here's an example of creating a custom invitation code that can be used indefinitely: 

Here's one that can only be claimed up to 10 times before it expires on the 30th day of July 2023: 

You can Edit or Delete these codes at any time: 

However, validation of these codes requires the use of our API as documented here: https://www.prefinery.com/api/v2/docs/testers#create

Validating Codes

Validation is actually quite easy, you just need to ask for the user's invitation code and email address as part of your account registration form and then send an API request to Prefinery within your account creation source code.

Basically, you just try to create an active tester/user in your Prefinery project by sending a Testers#create API call with the tester's email address, the invitation code they want to use, and a status of active. 

  • If the request is successful because the invitation code they want to use is valid (e.g. code quantity is not all used up nor has it expired yet) then they get added as an active user to Prefinery and a HTTP 201 (created/success) is returned so you can complete the tester's account creation in your website/app. 
  • If they could not be added to Prefinery because the code is invalid (e.g. code quantity is all used up or it's already past its expiration date), then we return an error so you can notify the user in your website/app that the code they used was invalid. 

You just send us the custom code and the user's email via API request so we can verify it, and we'll return a success or failure so your website or app can take the expected action. 

Examples

Let's say you have created a custom invitation code named ORDRTKR . Here are two scenarios that can occur:

1

user@host.com signed up for your waitlist. A while later you invite them. They receive an email with the unique invitation code ABCDE12345. That invitation email message also includes a link to your registration page where they enter and submit their email address and code. 

From your backend you would make a call to Testers#create with email address = user@host.com, status = active and invitation_code = ABCDE12345

While the code that the user used is not the custom invitation code  ORDRTKR the call will still succeed because the unique invitation code ABCDE12345 used matches the user. It it was any other code, the call will fail.

2

partner@host.com was directly given the custom invitation code ORDRTKR by someone on your team (perhaps over email, a phone call, an investor deck, a webinar with your partners, etc.). This person visits your registration page where they enter their email address and code. 

From your backend you would make a call to Testers#create with email address = partner@host.com, status = active and invitation_code = ORDRTKR

This call will succeed for any email address, even if the user hasn't signed up for your waitlist, so long as the invitation_code is valid (correctly entered, not expired or all used up).

Still need help? How can we help? How can we help?