Magento 2 SMS Notification

 

Magento 2 SMS Notification allows admin to send notification text messages to customers to keep them updated about their activities in Magento 2 store.

Table of Content

  1. Extension Installation Guide
  2. Twilio Registration
  3. Msg91 Registration
  4. Textlocal Registration
  5. Configuration
  6. API Settings
  7. Order Placement Notification Settings
  8. Order Invoice Notification Settings
  9. Order Cancellation Notification Settings
  10. Order Shipment Notification Settings
  11. Credit Memo Notification Settings
  12. Contact Inquiry Notification Settings
  13. New Customer Registration Notification Settings
  14. SMS Notification in Frontend

 

  1. Extension Installation
  • For Magento Marketplace Customers
    • Create a folder structure in Magento root as app/code/Meetanshi/Sms
    • Download and extract the zip folder and upload our extension files to the app/code/Meetanshi/Sms via FTP.
    • Login to your SSH and run below commands step by step:
        • composer require twilio/sdk
        • php bin/magento setup:upgrade
        • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
        • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
        • php bin/magento cache:flush
  • For Meetanshi Customers
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
      • composer require twilio/sdk
      • php bin/magento setup:upgrade
      • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
      • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
      • php bin/magento cache:flush

Note: Don’t forget to install Twilio library even if you are not using Twilio SMS gateway for our extension.

 

  1. Twilio Registration
    If you are going to use Twilio as an SMS gateway to send SMS notifications, you need to register with the Twilio to get Account SID, Auth Token and Twilio Phone Number.
  • First of all, Sign Up for the Twilio account. Add the details and click to get started.


 

  • After the Email verification, enter your mobile number and click to “Verify”.



 

  • Once you click “Verify”, you will get an OTP on the added mobile number. Enter the OTP and verify the mobile number. Now move to Settings > General where you can see API details both for live and testing. Copy the Account SID and Auth Token to use them in Magento backend configuration for Twilio account.



 

  • Now, click three dots from the left sidebar, go to Programmable SMS and click Build under the Learn and Build option. From here, you can get Twilio phone number to use for sending the SMSs. Click on the “Get a number” button.



 

  • You will get a number to choose. Click “Choose This Number”.




 

  • Once you click the button, you will get a Twilio phone number. Copy this number and set it in the Magento backend configuration for Twilio account. 




 

  1. Msg91 Registration
    The extension allows configuration of the Msg91 SMS gateway to send SMS notifications. If you choose to use Msg91 SMS gateway integration, follow the steps below to get sender ID and API key.



 

  • You will get and code or a magic link in the Email to verify the Email address.




 

  • You will be asked to enter the mobile number for verification.



 

  • Enter the OTP to verify the mobile number and you will be registered successfully. Login with the credentials.




 

  • Under the settings, you can find the Sender ID which you need to copy and paste in the Magento configuration.



 

  • Now move to API, where you can find the API key for the Magento configuration.





 

  • You can find the Message type under the Send SMS tab. Select the SMS type in Msg91 configuration in Magento as per your requirement.




 

 

  1. Textlocal Registration
    The extension allows the configuration of the Textlocal SMS gateway to send SMS notifications. If you choose to use Textlocal SMS gateway integration, follow the steps below to get sender ID and API key.

 

  • After the registration, you will get a verification link in your registered Email ID, clicking the link will land you to add additional information page. Here, add the account details and submit to activate your Textlocal account.

 

  • Navigate to Settings > API Keys and create new key to use. Copy the created API Key and paste it in Magento 2 extension configuration.

 

  • Now move to Settings > All Settings and click on “Sender Names” to get your sender name.

 

  • You can copy your Textlocal sender name from here and paste it in Magento 2 extension configuration.

 

  • Textlocal requires to create message template to send SMS notification. Go to Send > Templates & Drafts and click to create and request new SMS template.

 

  • You have to create new message template for each SMS notification enabled in Magento 2 SMS notification extension configuration. Enter title, select category and sender name. Set message text same as SMS text in Magento 2 extension configuration notification settings. You have to create new SMS template in Textlocal for every enabled SMS notification in Magento 2. For example, if you have enabled “Order Placement Notification” from Magento 2 backend, create a message template for the same in Textlocal having exactly the same SMS text.

 

  • For the dynamic values in text message input, click “Insert Restricted Template Items”. Click “Insert an Input Box” and it will open a popup to create new placeholder for the dynamic value. Add placeholder text name and set maximum length for the dynamic value. Insert it into the SMS text and while sending the message, this placeholder will match the variable in Magento 2 notification text and replace it with the real value.

 

  • Once message templates have been created and submitted for each SMS notification, it will take approximately a week to be approved by the Textlocal. You can send SMS notifications only after the message templates approved by the Textlocal.
  1. Configuration
    To configure the extension, login to Magento backend, move to Stores > Configuration > SMS Notification where you can find various settings to configure the extension.
  • SMS Notification: Enable or disable the SMS Notification extension.
  • Admin Mobile Number: Enter mobile number of admin to receive the SMS notifications.


  

 

  1. API Settings
    To allow compatibility of the extension with any SMS gateway, it’s API settings has to configured after receiving the essential details like Sender ID, API key and URL.
  • API Provider: Select one of the SMS gateway API providers from Msg91, Twilio, Textlocal.
  • Sender ID: Enter sender ID you got while registration with SMS gateway.
  • API Key: Enter the API Key.
  • API URL: Enter the API URL.
  • Message Type: Select the message type to be sent to the customers.


 

For Other SMS API:
If you are going to use custom SMS API other than Msg91, Twilio or Textlocal, you have to add your CURL URL as below:

 

 

 

 


 

Format:
https://yoursmsapi.com/sms/submitsms.jsp?user=yourusername&senderid=yoursenderid&key=yoursmskey&mobile={mobile}&message={msg}

Sample CURL URL:
https://foxxsms.com/sms/submitsms.jsp?user=METANSHI&senderid=FOXGLV&accusage=6&key=587e05afbcXX&mobile={mobile}&message={msg}

 

  1. Order Placement Notification Settings
    The module allows to send notification to both admin and customers when they place the order. To configure its settings, follow these steps as shown below:
  • Order Placement Notification: Enable order placement notification to customers.
  • SMS Text for Customers: Add order placement notification text to send to customers.
  • Order Placement Notification to Admin: Enable order placement notification to admin.
  • SMS Text for Admin: Add order placement notification text to send to admin.


 

  1. Order Invoice Notification Settings
    You can send notification to customers as well as admin to let them know that the Order Invoice is generated once the following settings are configured:
  • Order Invoice Notification: Enable order invoice notification to customers.
  • SMS Text for Customers: Add order invoice notification text to send to customers.
  • Order Invoice Notification to Admin: Enable order invoice notification to admin.
  • SMS Text For Admin: Add order invoice notification text to send to admin.


  

 

  1. Order Cancellation Notification Settings
    To let customers know that their order has been cancelled, an SMS notification is sent. Additionally, admin is also notified of a cancelled order. Follow these steps for the same:
  • Order Cancellation Notification: Enable order cancelation notification to customers.
  • SMS Text for Customers: Add order cancellation notification text to send to customers.
  • Order Cancellation Notification to Admin: Enable order cancellation notification to admin.
  • SMS Text For Admin: Add order cancellation notification text to send to admin.


 

  1. Order Shipment Notification Settings
    Customers get notification when their shipment is off for delivery. Admin is also notified for the same. This feature will be enabled when the following settings are configured:
     
  • Order Shipment Notification: Enable order shipment notification to customers.
  • SMS Text for Customers: Add order shipment notification text to send to customers.
  • Order Shipment Notification to Admin: Enable order shipment notification text to send to admin.
  • SMS Text For Admin: Add order shipment notification text to send to admin.




 

  1. Credit Memo Notification Settings
    To confirm with customers that their refund request has been accepted, an SMS will be sent to customers. Similarly, admin will be sent an SMS notification when a credit memo is generated. Configure the following settings to enable this feature of the module.
     
  • Order Credit Memo Notification: Enable refund request notification approval to customers.
  • SMS Text for Customers: Add refund request notification approval text to send to customers.
  • Order Credit Memo Notification to Admin: Enable credit memo generation notification to admin.
  • SMS Text for Admin: Add credit memo generation notification text to send to admin.


 

  1. Contact Inquiry Notification Settings
    Admin is notified whenever there is a contact inquiry. To enable this feature, configure following settings:
  • Contact Inquiry Notification: Enable contact inquiry notification to admin.
  • SMS Text for Admin: Add contact inquiry notification text to send to admin.


 

  1. New Customer Registration Notification Settings
    The admin is notified when a new customer registration takes place. To enable this notification, following settings are to configured:
  • New Customer Registration Notification: Enable new customer registration notification to admin.
  • SMS Text for Admin: Add new customer registration notification text to send to admin.


 

  1. SMS Notification in Frontend
  • New Registration Notification to Admin
    When a customer registers a new account, admin is notified as shown below:
     

 

  • New Order Placement Notification to Customer
    A notification of acknowledgement of the order placed is sent to customers as shown here:


 

  • New Order Placement Notification to Admin
    Admin is notified when a new order is placed in the store as shown below:
     

 

  • Order Invoice Generation Notification to Customers
    When an Order Invoice is generated, a notification as shown below is sent to customers.


  

 

  • Order Invoice Generation Notification to Admin
    When an Order Invoice is generated, a notification is sent to Admin as shown here:


  

 

  • Order Shipment Notification to Customer
    Customers get notified at the time of order shipment via SMS as shown below:


 

  • Order Shipment Notification to Admin
    Once the order gets shipped and shipment is generated, admin gets notified by an SMS as shown here.


 

  • Refund Request Notification to Customer
    A customer gets notified of refund request approval as shown below:


 

  • Credit Memo Generation Notification to Admin
    Credit memo generation notification sent to admin is shown below:




 

  • New Contact Inquiry Notification to Admin
    Whenever a customer inquires through submitting contact form, admin is notified as below: