Installation



Twilio SDK will be required before you install the extension. 

composer require twilio/sdk



Before installing the extension, please make sure to Backup your web directory and store database


You will require to install MageDelight Base Extension first. If it is not installed then please download it from https://www.magedelight.com/pub/extensions/magedelight-base.zip and unzip the package file into the root folder of your Magento 2 installation.

Root Directory is - "app/code/magedelight/#YourExtensionName#"

  • Unzip the extension package file into the root folder of your Magento 2 installation.
  • Connect to SSH console of your server:
    • Navigate to the root folder of your Magento 2 setup
    • Run command as per below sequence,

      php bin/magento setup:upgrade

      php bin/magento setup:di:compile

      php bin/magento setup:static-content:deploy

      php bin/magento cache:clean

  • log out from the backend and log in again


If you are using Magento 2.3 or later then you do not need to activate license. Extension will be activated with silent activation mechanism and does not require activation keys to be entered manually.   


Installation with Composer


Composer repository using this command:

composer config repositories.magedelight-repo composer https://packages.magedelight.com/


Replace repo public key and private key with your public and private key

composer config http-basic.gitlab.magedelight.com $PUBLIC_KEY $PRIVATE_KEY


composer require mage_delight/smsprofile_module:*

composer require hyva-themes/magento2-hyva-magedelight-smsprofile:*

To obtain your public and private keys, please navigate to the "My Account" section. In the "Download Extension Packages" tab, you will find the keys available for your access.

Backend Configuration (Admin side)


General Configuration

FieldDescription
Enable

Select Yes to enable the module and activate telephone and country validation on the frontend. Select No to disable the functionality.

Require Customer Country With Telephone

Select Yes to require customers to choose their country when entering a telephone number. This helps ensure correct number formatting.

Select Default CountryChoose the default country that will be pre-selected in the country dropdown on the frontend forms (e.g., checkout or registration).
Available Countries

Select one or more countries to display in the country dropdown. Only the selected countries will be available for customers to choose from.

Comment Shows Below Telephone Field in FrontendEnter a positive number to display below the telephone field on the frontend. This helps guide customers on how to correctly enter their phone number.


SMS Service Providers    

SMS

FieldDescription
Send OTP viaSelect the desired option, SMS from the drop-down list to be used for sending OTP messages.
SMS API GatewaySelect the SMS API gateway you wish to integrate with your store. You may choose Twilio or any other supported provider based on your SMS service provider.
Account SIDEnter the Account SID provided by your SMS gateway provider.
Auth TokenEnter the authentication token issued by your SMS gateway provider.
Twilio Phone NumberSpecify the phone number assigned to your Twilio account for sending SMS messages.
Twilio Service IDProvide the Twilio Service ID used for messaging services.


Email

FieldDescription
Send OTP viaSelect the method for sending OTPs (e.g., Email or SMS).
SMS Profile OTP Email Template Choose the email template used to send OTPs when the "Email" option is selected.


Both (Email and SMS ) With Twilio API Gateway

FieldDescription
Send OTP viaSelect how OTPs will be sent: via both (Email and SMS )
Sms Profile OTP Email TemplateChoose the email template used to send OTPs when Email is selected.
SMS API GatewaySelect the SMS service provider (e.g., Twilio) to send OTPs via SMS.
Account SIDEnter the Twilio Account SID obtained from your Twilio account dashboard.
Auth TokenEnter the authentication token provided by Twilio for secure API access
Twilio Phone Number Provide the Twilio phone number used for sending OTPs (e.g., +123XXXXXXXX).
Twilio Service IDEnter the Twilio Messaging Service ID used for the SMS notification service (e.g., ISXXXXXXXX).


Both (Email and SMS ) With Other SMS API Gateway

FieldDescription
Send OTP viaSelect how OTPs are sent: Email, SMS, or Both
Sms Profile OTP Email TemplateChoose the email template used when sending OTPs via email.
SMS API GatewaySelect Other to configure a custom SMS gateway manually.
API URLEnter the base URL provided by your SMS service provider for sending messages.
API CredentialsProvide authentication credentials in the format: username:test password:test123
Authorization HeaderEnter the API key or token in the required header format (e.g., AccessKey YOUR-API-KEY).
Key Name for "Send To"Specify the key used to define the recipient (e.g., to, mobiles, msisdn).
Key Name for "Send SMS Body"Specify the key used for the message body (e.g., message, body, msg).
API Request in GET?Select Yes if the API request should use the GET method.
API Request/Response in XML?Select Yes if the API communicates using XML format.
Add Country Code to Mobile NumberSelect Yes to automatically append country codes to mobile numbers.
API Additional ParametersEnter extra parameters in key:value format separated by commas (e.g., type:transactional,lang:en)
API Additional Parameters to Update for Promotional RouteProvide parameters specific to promotional route configuration or use key1:false to remove.
API URL for Notification RouteEnter the API URL for sending notification messages.
API URL for Promotional RouteEnter the API URL for sending promotional messages.
API URL to Fetch SMS StatusProvide the endpoint used to fetch the delivery status of sent messages. Use a placeholder like {msid} for the message ID.
Processing Status Label of SMSEnter the SMS status values (e.g., queued, pending) to update via cron.
Failed Label of SMSEnter possible failure status values separated by commas (e.g., undelivered,DND,fail).
Key Name for Error MessageEnter the response key that contains the error message (e.g., error, error_message).


OTP Configurations

FieldDescription
OTP FormatSelect the format for the OTP (One-Time Password). Options typically include Numeric, Alphanumeric, etc.
OTP Digit LengthChoose the number of digits in the OTP. For example, selecting "4" will generate a 4-digit OTP.
Expire OTP Within (Minutes)Define how long the OTP remains valid. The OTP will expire after the specified number of minutes.
Skip the "Verify" Button for OTPSelect Yes to automatically verify the OTP as soon as the user enters it. Selecting No will require users to manually click the "Verify" button.
Enable Resend OTPSelect Yes to allow users to request a new OTP if needed. Select No to disable the resend feature.
Show Resend Button After (Seconds)Specify how many seconds the user must wait before the Resend OTP button appears. If set below 5, the system will default to 5 seconds.
Max Resend AttemptsSet the maximum number of OTP resend attempts allowed. After exceeding this number, users will have to wait 24 hours before trying again.
Select Address To Get Phone Number To Map With Existing Customer ProfileChoose the address source (e.g., Default Shipping Address) to fetch the phone number for mapping with the customer profile.


reCAPTCHA Settings

FieldDescription
Enable reCAPTCHASelect Yes to enable Google reCAPTCHA on selected frontend forms. Select No to disable it.
reCAPTCHA Site KeyEnter your Google reCAPTCHA Site Key here. You can obtain this from the Google reCAPTCHA admin console.
reCAPTCHA Secret KeyEnter your Google reCAPTCHA Secret Key. This is used for backend validation of reCAPTCHA responses.
reCAPTCHA Forms

Select the forms where reCAPTCHA should be applied. Common options include:

  • Registration Page

  • Login Page

  • Forgot Password Page

  • Edit Account Information Page

Only the selected forms will display the reCAPTCHA widget to users.


Login and Registration

FieldDescription
Enable Login PopupSelect Yes to display a login popup instead of redirecting customers to a separate login page.
Login Options

Choose how customers can log in to their accounts:

  • Login with OTP only – Users can log in using a one-time password sent to their mobile number.

  • Login with Password only – Users log in using their email/username and password.

  • Login with OTP and Password – Both login methods are available; users can choose either.

Redirect the Old Customer to Add a Mobile Number After Logging InSelect Yes to redirect existing users to the customer information page after login to add their mobile number, if it’s missing.
Keep Mobile Number Optional While Customer RegistrationSelect Yes to make the mobile number optional during registration. Select No to make it a required field.
Verify OTP During Customer Registration

Determine when OTP verification is needed during registration:

  • Not Required – OTP is not needed to register.

  • Required Before Registration – OTP must be verified before completing registration.

  • Required After Registration – OTP is sent and verified after the account is created.

Set Email as an Option During the Customer RegistrationSelect Yes to allow email to be optional during registration. If enabled, Magento’s default email confirmation will be disabled.
Dummy Email DomainSpecify a domain (e.g., example.com) to auto-generate an email address when none is provided.
Format: {mobile_number}@{dummy_domain} (e.g., [email protected]).


Checkout Settings

FieldDescription
 Enable OTP LoginSelect Yes to allow customers to log in using an OTP during the checkout process.
Send OTP During Checkout For COD Payment MethodSelect Yes to send an OTP to the customer's shipping address phone number when Cash on Delivery (COD) is selected at checkout.


Admin Notification

  • This section allows store admins to receive alerts via email or SMS when certain events occur or when SMS sending fails.
FieldDescription
Failure Notification Email To AdminSelect Yes to enable email alerts for failed SMS notifications.
Notification To EmailEnter one or more admin email addresses (comma-separated) where failure notifications should be sent.
Email SenderChoose the email identity that will be used as the sender for failure notifications (e.g., General Contact).
SMS Profile Alert Email TemplateSelect the email template to be used for SMS failure alerts. Default: Failed SMS Email Template (Default).
Notify Admin by SMSSelect Yes to enable SMS notifications to the admin for selected events.
Admin Phone NumberEnter the admin's phone number, including the country code. You can enter multiple numbers separated by commas.
Admin Events

Choose the events for which the admin should receive SMS alerts. Available options:

  • New Registration – Sends SMS when a customer registers.

  • New Order – Sends SMS when a new order is placed.

  • Customer Contact – Sends SMS when a customer submits a contact form.


Customer SMS Configuration

  • This section allows you to configure SMS notifications that are sent to customers based on specific order and account-related events.
FieldDescription
Customer Events

Select the events that will trigger SMS notifications to customers. You can select multiple events from the list:

  • Order Place – When a customer places an order.

  • Contact – When a customer submits a contact form.

  • Admin Order Cancel – When an order is canceled by the admin.

  • Admin Invoice Order – When an invoice is created by the admin.

  • Admin Creditmemo Order – When a credit memo is issued by the admin.

  • Admin Shipment Order – When a shipment is created by the admin.

  • Admin Shipment Tracking – When tracking information is added to a shipment.

Select Number For SMS

Choose which phone number should receive the SMS notifications:

  • Shipping Address Number – Sends SMS to the shipping address phone number.

  • Billing Address Number – Sends SMS to the billing address phone number.

  • Both – Sends SMS to both the billing and shipping address phone numbers.


Developer Options

  • This section allows you to manage how all SMS logs—including general and notification-specific (admin/customer) logs—are stored, updated, and automatically cleared from the system.
FieldDescription
Enable Sandbox ModeSelect Yes to activate sandbox mode. In this mode, SMS will not be sent—useful for testing without incurring SMS charges.
Enable SMS LogSelect Yes to store SMS logs in the database. This helps in tracking sent messages and their statuses.
Cron Timeout to Update SMS StatusSpecify the time (in seconds) after which the system should update the status of sent SMS messages. Example values: 60, 300, 600, 1000.
Enable Cron to Clear SMS LogSelect Yes to enable an automatic cron job that clears old SMS logs from the database.
FrequencyChoose how often the SMS logs should be cleared. Example options: Daily, Weekly, etc.
TimeSet the exact time at which the cron job will run to clear SMS logs.
Enable Notification SMS LogSelect Yes to store logs of notification-related SMS messages in the database.
Enable Cron to Clear SMS LogSelect Yes to automatically clear notification SMS logs using a cron job.
FrequencySet how often the notification SMS logs should be cleared.
Time

Define the time of day the cron job should run for clearing notification SMS logs.


Email Template Configuration

FieldDescription
Sms Profile Notification TemplateSelect the email template that will be used to send notification emails related to the SMS profile.

Backend Functionality


OTP SMS Templates

  • This section allows users to view and manage OTP SMS templates through a dedicated grid interface, where previously added templates can be reviewed, edited, or removed. Click the "Add New OTP SMS Template" button at the top right to create a new SMS template for any customer-related OTP event.


  • This section allows you to create a new OTP SMS template that will be triggered by specific customer actions such as signup, login, or password reset.

    FieldDescription
    Template NameProvide user user-friendly name to identify the SMS template by the admin.
    Event Type

    Select the event that will trigger this SMS. Options may include:

    • Send OTP At Customer Signup Event

    • Send OTP At Customer Login Event

    • Send OTP For COD Payment Method During Checkout

    • Send OTP For Forgot Password Event

    • etc.

    Template ContentProvide template content as given in the sample "Dear Customer, use {otpcode} as OTP for your recent transaction. OTP is valid for 10 minutes.".
    Store ViewSelect store view to send SMS with the current template.
    OTP TemplateEnter the ID or identifier of the pre-approved template from your SMS provider

 SMS Promotional

FieldDescription
Select Grid TypeSelect the type to send promotional SMS. Current selected type is "Custom Numbers".
To NumbersProvide comma-separated customer numbers as per your SMS service provider's requirements.
MessageProvide a promotional message to send to the entered numbers.



FieldDescription
Select Grid TypeSelect the type to send promotional SMS. Current selected type is "Customer Group".
Customer GroupSelect the customer group to send promotional SMS. It will be sent to all customers who belong to the selected customer group.
MessageProvide a promotional message to send to the selected customer group numbers


FieldDescription
Select Grid TypeSelect type to send promotional SMS. Current selected type is "Customers".
Customer GroupSelect customers to send promotional SMS. 

A searchable, filterable table showing customer details such as:

  • ID

  • First Name

  • Last Name

  • Email

MessageProvide a promotional message to send to the selected customer.

FieldDescription
Select Grid TypeSelect the type to send promotional SMS. Current selected type is "Abandoned Cart".
Message

Provide a promotional message to send to those customers who have abandoned.


FieldDescription
Select Grid TypeSelect the type to send promotional SMS. Current selected type is " Import CSV".
Import CSVUpload a CSV file with the list of customer numbers to send promotional SMS.
Download CSV

Download a sample CSV file to get the file format.

Message

Provide a promotional message to send to imported customers from CSV.


SMS Logs

  • .This section offers a comprehensive log of all SMS messages sent or attempted through the system, enabling users to monitor delivery status, audit activity, and troubleshoot issues effectively. Users can search and filter logs by status, phone number, service provider, or transaction type for streamlined access. Additional features include pagination for easy navigation, an export option for CSV or Excel downloads, and a Clear Log function to permanently delete all records—please use this option with caution, as it is irreversible.

Frontend Functionality


  • During customer registration, users are required to enter their mobile number and request an OTP (One-Time Password) using the Generate OTP button. The OTP is sent via SMS and must be entered in the verification field before proceeding. Once verified using the Verify OTP button, users can complete the registration by clicking Create an Account. This ensures mobile number validation for secure account creation.

  • During customer registration, users are prompted to enter their details along with a valid 10-digit mobile number. After selecting the appropriate country code, users must click the Generate OTP button to receive a One-Time Password via SMS. This OTP is used to verify the mobile number before account creation, ensuring secure and authenticated registration.


  • During the login process, registered customers can authenticate using their mobile number. After selecting the correct country code and entering a valid 10-digit number, users click the Generate OTP button to receive a One-Time Password via SMS. This OTP enables secure and password-free login, offering a seamless and user-friendly authentication experience.


  • OTP verification on the checkout process if the selected payment method is "Cash on Delivery. During the checkout process with the Cash On Delivery (COD) payment method, customers must verify their order using a One-Time Password (OTP) sent to their shipping address mobile number. A countdown timer is displayed for OTP resend eligibility and the remaining number of resend attempts. Customers must enter the received OTP and click the Verify OTP button to complete verification. This process ensures added security and helps prevent fraudulent COD orders.


  • This is a sample OTP (One-Time Password) email sent to a customer during the login process. The email includes a unique OTP code (0622) and informs the recipient, Johan Wick, that the code is valid for 1 minute. It serves as a secure, time-sensitive authentication method for logging into the store without a password.

Sample OTP SMS

  • Sample OTP message and Promotional message.

API



Please use SWAGGER to get detailed information on parameters.

https://mobileotplogin.m2.demo.magedelight.com/swagger

Send/resend OTP - GraphQL: rest/V1/

sendotp

Sample Data

{
"resend":0,
"storeId":0,
"mobile":1234568520,
"eventType":"customer_signup_otp"
}


Customer login  with OTP Only - GraphQL: customertoken

Sample Data

{
"mobile":1234568520,
"otp":1234,
"websiteId":1
}


Customer login  with OTP and Password - GraphQL: customertokenwithotpandpassword

Sample Data

{
"mobile":1234568520,
"otp":1234,
"password":"roni@123",
"websiteId":1
}

Customer account created with OTP : customersignupwithotp

Sample Data

{
"customer":{
"prefix":"Mrs.",
"firstname":"Veronica",
"middlename":"John",
"lastname":"Costello",
"email":"roni_cost@example.com",
"dob":"12/15/1973",
"taxvat":"",
"gender":2
},
"mobile":1234568520,
"otp":1234,
"password":"Roni@123"
}

Customer account edit  with OTP : customereditwithotp

Sample Data

{
"customer":{
"prefix":"Mrs.",
"firstname":"Veronica",
"middlename":"John",
"lastname":"Costello",
"email":"roni_cost@example.com",
"dob":"12/15/1973",
"taxvat":"",
"gender":2
},
"mobile":1234568520,
"otp":1234,
"password":"Roni@123",
"websiteId":1
}


Send reset password link in mail with OTP - GraphQL: passwordwithotp

Sample Data

{
"mobile":1234568520,
"otp":1234,
"template":"email_reset",
"websiteId":1
}


Guest place order with payment information saving for COD - GraphQL: guestcheckoutwithotpforcod/:cartId

Sample Data

{
"cartId":195
"email":"roni_cost@example.com",
"mobile":1234568520,
"otp":1234,
"paymentMethod":"cod"
}


My place order with payment information saving - GraphQL: carts/mine/checkoutwithotpforcod

Sample Data

{
"paymentMethod":"cod"
"cartId":195,
"mobile":1234568520,
"otp":1234
}

Demo



Click here to visit the frontend.

Click here to visit the backend admin panel.

FAQs


Click here to visit FAQs.

Support


Click here to raise a support ticket using your MageDelight account.

Additional Services


Click here to get the customized solution for this extension.



Thank you for choosing MageDelight!



  • No labels