Check if user-provided token is correct. See the documentation for more information
1
import { Twilio } from "twilio";
2
3
type Twilio = {
4
accountSid: string;
5
token: string;
6
};
7
8
export async function main(
9
twilio: Twilio,
10
token: string,
11
serviceId: string,
12
phoneNumber: string
13
) {
14
const client = new Twilio(twilio.accountSid, twilio.token);
15
const verificationCheck = client.verify.v2
16
.services(serviceId)
17
.verificationChecks.create({
18
to: phoneNumber,
19
code: token,
20
});
21
return verificationCheck;
22
}
23