Codes Model

Codes are intended to make one-time verifications which can be used for various features such as verifying a user and generating one-time passwords. These can be sent through various channels such as email, whatsapp, text message or voice call.

The Codes model has the following endpoints:

ActionMethodResourceDescription
Generate CodePOST/codes/generateGenerate one time code
Generate CodeGET/codes/generateGenerate one time code
Verify CodePOST/codes/verifyVerify one time code
Verify CodeGET/codes/verifyVerify one time code

The Codes model has the following attributes:

AttributeTyperequiredDescription
toString
typeInteger
channelInteger
codestring
sender_idinteger
attempsInteger
timesInteger
send_dataJSON
last_sent_atDate

📘

Restrictions for codes

  • Any user can generate codes
  • Only Admins can verify codes

Codes types

Below mentioned are the values of the type parameters of the respective Codes Type:

typevaluedescription
General1
Cellphone verification2
Email verification3
One time password4

Codes Channels

Below mentioned are the values of the channel parameters of the respective Codes Channels:

typevaluedescription
Email1Send the code via email
SMS (twilio)2Send the code via sms using twilio
Call (Twilio)3Send the code via call using twilio
Whatsapp (Twilio)4Send the code via whatsapp using twilio
Custom5A custom channel can by added using the plugins with the hook code_verification_{channel}_sent