Docs

Waitlist methods

These methods on the Clerk class allow you to add users to your waitlist.

The following example assumes:

  • You followed the quickstart to add Clerk to your JavaScript app.
  • You set your sign-up mode to Waitlist.

joinWaitlist()

Create a new waitlist entry programatically.

function joinWaitlist({ emailAddress }: JoinWaitlistParams): Promise<Waitlist>
  • Name
    emailAddress
    Type
    string
    Description

    The email address of the user you want to add in the waitlist.

main.js
import { Clerk } from '@clerk/clerk-js'

// Initialize Clerk with your Clerk publishable key
const clerk = new Clerk('YOUR_PUBLISHABLE_KEY')
await clerk.load()

const joinWaitlistButton = document.getElementById('join-waitlist-button')
joinWaitlistButton.addEventListener('click', () => {
  clerk
    .joinWaitlist({ emailAddress: 'user@example.com' })
    .then((res) => console.log(res))
    .catch((error) => console.log('An error occurred:', error.errors))
})
index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Clerk + JavaScript App</title>
  </head>
  <body>
    <div id="app"></div>
    <button id="join-waitlist-button">Join Waitlist</button>
    <script type="module" src="/main.js"></script>
  </body>
</html>

Feedback

What did you think of this content?

Last updated on