Skip to main content

Pre / Post Hooks / Override

We provide you funtionality to run code before and after an SMS is sent. You can use this for:

  • Logging purposes
  • Spam protection purposes
  • Modifying the SMS template variables before sending the SMS
import supertokens from "supertokens-node";import Passwordless from "supertokens-node/recipe/passwordless";import Session from "supertokens-node/recipe/session";
supertokens.init({    appInfo: {        apiDomain: "...",        appName: "...",        websiteDomain: "..."    },    recipeList: [        Passwordless.init({            smsDelivery: {                override: (originalImplementation) => {                    return {                        ...originalImplementation,                        sendSms: async function (input) {                            // TODO: before sending SMS
                            await originalImplementation.sendSms(input)
                            // TODO: after sending SMS                        }                    }                }            },        }),        Session.init()    ]});
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react