Hello,
I am not sure where you are struck up? as you tried, there is a clear
Programmable SMS: Send and Receive Texts in Your App - Twilio[
^] documentation here.
OTP in application logic should be written by you only. for example here I am taking example for change password.
1. In the database - table (user) , add new column called OTPCode.
2. Generate a random string when user click on the forgot password and same same into that column for that user.
3. Send SMS/EMail to that user.
4. validate the same when he wants to try to change the password.
** hope this will help you.
--RA