Published on : June 10, 2020

https://loantap.in/wp-admin/post.php?post=1095879&action=edit

In this section we have to set the config variable array with the event name for customer notification.

First we will add content type as follows :

[content_types.add cnotify_customer /]

Initiate notification config array :

[cnotify_customer.config.set_array]

For email we have to define following configuration variables :

[email_provider default="sendgrid"]
    [sendgrid]
      [provider]sendgrid[/provider]
      [key]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[/key]
      [billing_key]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[/billing_key]
      [balance_url]https://api.sendgrid.com/v3/user/credits[/balance_url]
    [/sendgrid]
  [/email_provider]

For SMS we have to add following configuration variables :

[sms_provider default="msg91"]
    [msg91]
      [provider]msg91[/provider]
      [key]261160Abal7nsx5c57c974[/key]
      [country]91[/country]
      [route]4[/route]
      [sender]LONTAP[/sender]
      [balance_url]https://control.msg91.com/api/balance.php[/balance_url]
    [/msg91]
    [kookoo]
      [key]KK7ee3766a9efa61b60a2940d0aa935779[/key]
    [/kookoo]
  [/sms_provider]

Then we have to add from email id and domain name :

[email]
  	[from_email_id]application@help.loantap.in[/from_email_id]
  	[reply_to_domain]@help.loantap.in[/reply_to_domain]
  [/email]

Now we will set the event to send notification to clients :

[notification_sets]
    [notification_application_created post_type='notify_templates' slug='application-created']
    	[email send='yes' /]
    [/notification_application_created]   
    [notification_mobile_verified post_type='notify_templates' slug='mobile-verified']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_mobile_verified]
    [notification_loan_availed post_type='notify_templates' slug='loan-availed']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_loan_availed]
    [notification_kyc_completed post_type='notify_templates' slug='kyc-completed']
    	[email send='yes' /]
    [/notification_kyc_completed]
    [notification_docs_uploaded post_type='notify_templates' slug='docs-uploaded']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_docs_uploaded]
    [notification_employment_details post_type='notify_templates' slug='employment-details-filled']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_employment_details]
    [notification_dropout post_type='notify_templates' slug='dropout']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_dropout]   
    //*****processing notifications****//
    [notification_received  post_type='notify_templates' slug='mail-after-status-received']
    	[email send='yes'/]
        [whatsapp send='yes'/]
    [/notification_received]
    [notification_ca_to_cd post_type='notify_templates' slug='dropout']
    	[email send='yes'/]
    	[whatsapp send='yes'/]
    [/notification_ca_to_cd] 
    [notification_paytm_mobile_verified post_type='notify_templates' slug='test']
    	[email send='yes'/]
    	[whatsapp send='yes'/]
    [/notification_paytm_mobile_verified]  
    
    [notification_tran_disbursal post_type='notify_templates' slug='transaction-disbursal']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_disbursal]

    [notification_tran_instalment_post post_type='notify_templates' slug='transaction-instalment-post']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_instalment_post]

    [notification_tran_nach_update post_type='notify_templates' slug='transaction-nach-update']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_nach_update]

    [notification_tran_principal_dues_receipt post_type='notify_templates' slug='transaction-principal-dues-receipt']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_principal_dues_receipt]

    [notification_tran_closure_details post_type='notify_templates' slug='transaction-closure-details']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_closure_details]

    [notification_tran_close post_type='notify_templates' slug='transaction-close']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_close]

    [notification_tran_restructure_rejected post_type='notify_templates' slug='transaction-restructure-rejected']
        [email send='yes' /]
        [sms send='no' /]
    [/notification_tran_restructure_rejected]

    [notification_tran_restructure post_type='notify_templates' slug='transaction-restructure']
        [email send='yes' /]
        [sms send='no' /]
    [/notification_tran_restructure]
    
  [/notification_sets]

Now we have to set the methods on with the notification will get triggered :

[methods]
  	//**This method will have all the events present in notification sets**//
    [mostly-all]
        [notification_application_created /]
    	[notification_mobile_verified /]
        [notification_loan_availed /]
        [notification_kyc_completed /]
        [notification_docs_uploaded /]
        [notification_end_of_flow /]
        [notification_dropout /]
        [notification_received /]
        [notification_ca_to_cd /]
        
        [notification_tran_disbursal /]
        [notification_tran_instalment_post /] 
        [notification_tran_nach_update /]
        [notification_tran_principal_dues_receipt /] 
        [notification_tran_closure_details /] 
        [notification_tran_close /]
        [notification_tran_restructure_rejected /]
        [notification_tran_restructure /]
    [/mostly-all]  
   [/methods]

Following is the full example to set the configuration variables and methods :

[content_types.add cnotify_customer /]

[cnotify_customer.config.set_array]
  [email_provider default="sendgrid"]
    [sendgrid]
      [provider]sendgrid[/provider]
      [key]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[/key]
      [billing_key]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[/billing_key]
      [balance_url]https://api.sendgrid.com/v3/user/credits[/balance_url]
    [/sendgrid]
  [/email_provider]
  [sms_provider default="msg91"]
    [msg91]
      [provider]msg91[/provider]
      [key]261160Abal7nsx5c57c974[/key]
      [country]91[/country]
      [route]4[/route]
      [sender]LONTAP[/sender]
      [balance_url]https://control.msg91.com/api/balance.php[/balance_url]
    [/msg91]
    [kookoo]
      [key]KK7ee3766a9efa61b60a2940d0aa935779[/key]
    [/kookoo]
  [/sms_provider]
  [email]
  	[from_email_id]application@help.loantap.in[/from_email_id]
  	[reply_to_domain]@help.loantap.in[/reply_to_domain]
  [/email]
  [notification_sets]
    [notification_application_created post_type='notify_templates' slug='application-created']
    	[email send='yes' /]
    [/notification_application_created]   
    [notification_mobile_verified post_type='notify_templates' slug='mobile-verified']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_mobile_verified]
    [notification_loan_availed post_type='notify_templates' slug='loan-availed']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_loan_availed]
    [notification_kyc_completed post_type='notify_templates' slug='kyc-completed']
    	[email send='yes' /]
    [/notification_kyc_completed]
    [notification_docs_uploaded post_type='notify_templates' slug='docs-uploaded']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_docs_uploaded]
    [notification_employment_details post_type='notify_templates' slug='employment-details-filled']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_employment_details]
    [notification_dropout post_type='notify_templates' slug='dropout']
    	[email send='yes' /]
    	[sms send='yes' /]
    [/notification_dropout]   
    //*****processing notifications****//
    [notification_received  post_type='notify_templates' slug='mail-after-status-received']
    	[email send='yes'/]
        [whatsapp send='yes'/]
    [/notification_received]
    [notification_ca_to_cd post_type='notify_templates' slug='dropout']
    	[email send='yes'/]
    	[whatsapp send='yes'/]
    [/notification_ca_to_cd] 
    [notification_paytm_mobile_verified post_type='notify_templates' slug='test']
    	[email send='yes'/]
    	[whatsapp send='yes'/]
    [/notification_paytm_mobile_verified]  
    
    [notification_tran_disbursal post_type='notify_templates' slug='transaction-disbursal']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_disbursal]

    [notification_tran_instalment_post post_type='notify_templates' slug='transaction-instalment-post']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_instalment_post]

    [notification_tran_nach_update post_type='notify_templates' slug='transaction-nach-update']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_nach_update]

    [notification_tran_principal_dues_receipt post_type='notify_templates' slug='transaction-principal-dues-receipt']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_principal_dues_receipt]

    [notification_tran_closure_details post_type='notify_templates' slug='transaction-closure-details']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_closure_details]

    [notification_tran_close post_type='notify_templates' slug='transaction-close']
        [email send='yes' /]
        [sms send='yes' /]
    [/notification_tran_close]

    [notification_tran_restructure_rejected post_type='notify_templates' slug='transaction-restructure-rejected']
        [email send='yes' /]
        [sms send='no' /]
    [/notification_tran_restructure_rejected]

    [notification_tran_restructure post_type='notify_templates' slug='transaction-restructure']
        [email send='yes' /]
        [sms send='no' /]
    [/notification_tran_restructure]
    
  [/notification_sets]
  [methods]
  	//**This method will have all the events present in notification sets**//
    [mostly-all]
        [notification_application_created /]
    	[notification_mobile_verified /]
        [notification_loan_availed /]
        [notification_kyc_completed /]
        [notification_docs_uploaded /]
        [notification_end_of_flow /]
        [notification_dropout /]
        [notification_received /]
        [notification_ca_to_cd /]
        
        [notification_tran_disbursal /]
        [notification_tran_instalment_post /] 
        [notification_tran_nach_update /]
        [notification_tran_principal_dues_receipt /] 
        [notification_tran_closure_details /] 
        [notification_tran_close /]
        [notification_tran_restructure_rejected /]
        [notification_tran_restructure /]
    [/mostly-all]  
   [/methods]
[/cnotify_customer.config.set_array]