Skip to main content

Method 3) SuperTokens SMS service

Using this method, SuperTokens will send SMSs to your users automatically. Use this method if:

  • You are already using our managed service - this is the quickest way to setup SMS sending.
  • You want to take advantage of some of the SMS sending optimisations we add over time:
    • Reduce SMS cost by picking a local SMS service based on the destination country.
    • Fight spam / misuse of SMS.
important

This is a paid service and we charge for every SMS based on the cost we incur. We give new users $10 worth of credits.

1) Get the SMS API key#

  • Sign up on supertokens.com
  • Create a new development env
  • Scroll down and create a new production env (it takes a few minutes to create one)
  • Once the production env is created, you can find your SMS API key under the setup section:

2) Set the SMS API key in the backend SDK config#

import supertokens from "supertokens-node";import Passwordless from "supertokens-node/recipe/passwordless";import Session from "supertokens-node/recipe/session";import { SupertokensService } from "supertokens-node/recipe/passwordless/smsdelivery"
supertokens.init({    appInfo: {        apiDomain: "...",        appName: "...",        websiteDomain: "..."    },    recipeList: [        Passwordless.init({            smsDelivery: {                service: new SupertokensService("<SMS API KEY GOES HERE>")            },        }),        Session.init()    ]});
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react