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 ThirdPartyPasswordless from "supertokens-node/recipe/thirdpartypasswordless";
import Session from "supertokens-node/recipe/session";

supertokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdPartyPasswordless.init({
smsDelivery: {
override: (originalImplementation) => {
return {
...originalImplementation,
sendSms: async function (input) {
// TODO: before sending SMS

await originalImplementation.sendSms(input)

// TODO: after sending SMS
}
}
}
},
}),
Session.init()
]
});
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI