To enable WhatsApp messages for any domain, we follow the following process. For the explanation purposes, taking SI (Sales Invoice) and company Noorani – Al Kayenat Trading Co LLC as an example.

First, verify that the messages are enabled or not, via settings table.

  • Select the relevant database for the domain.
  • Use the following query to check the ‘txtValue’ of the relevant ‘txtKey’:

SELECT * FROM settings where category = ‘sendsms’

  • Check the value of ‘txtValue’ for the relevant ‘txtKey’. If it’s false, update it to true.
    In this case we’ll check the ‘txtValue’ for ‘txtCategory’ -> “sendSmsOnCreateOrder” that ends with ’89’. because 89 is the doctypeId of Sales Invoice.
    We can confirm the doctypeId of the relevant form by checking from m_flag table.
  • If WhatsApp is not enabled, the ‘txtValue’ for the ‘txtKey’ would be false.
  • To enable Whtaspp, set the ‘txtValue’ to “true”
  • Use the following query to update the ‘txtValue’ of the setting for Sales Invoice.

UPDATE settings SET txtValue = ‘”s:4:true”;’ WHERE txtKey = ‘sendSmsOnCreateOrder89’ AND category = ‘sendsms’

  • Create a test Sales Invoice so the settings for smsApiKey and smsApiPass are created in database.
  • Set the values of the smsApiKey and smsApiPass in database.
  • To find the value of smsApiKey and smsApiPass, use the following query:

SELECT customers_id, OutTranscationCharges, * FROM cl_cartzlink..customers WHERE customers_firstname LIKE ‘%Noorani%’

The value of the field ‘customers_id’ is your smsApiKey and the value for the field ‘OutTranscationCharges’ is your smsApiPass.
Make sure you’re picking the correct values for the company by double checking the company name in the field ‘customers_firstname ‘.

  • Add password to OutTransactionCharges, if not exists.

UPDATE cl_cartzlink..customers SET OutTranscationCharges = ‘wyXxpo’ where customers_id = 18507

where, 18507 is the value of the customers_id for the company Noorani – Al Kayenat Trading Co LLC, which is taken as an example here.

  • Use the following queries to update the values of smsApiKey and smsApiPass:

UPDATE settings SET txtValue = ‘s:5:”18507″;’ where txtKey = ‘smsApiKey ‘ AND category = ‘sendsms’

where, 18507 is the value of the customers_id for the company Noorani – Al Kayenat Trading Co LLC, which is taken as an example here.

UPDATE settings SET txtValue = ‘s:6:”wyXxpo”;’ where txtKey = ‘smsApiPass ‘ AND category = ‘sendsms’

where, wyXxpo is the value of the OutTranscationCharges for the company Noorani – Al Kayenat Trading Co LLC, which is taken as an example here.

  • Create a text file with the name ‘order_89’ and add the message text to this file.
    Naming it as order_89 because we are adding text for message for Sales Invoice. Replace 89 with the doctypeId of the form you’re enabling WhatsApp for.
  • Save the file at:
    ../custom/domain_name/content/messages/

Make sure, to Clear Cache after updating values in the database.

Test to verify your settings are working properly.

  • You can check the SMS log by using this query:

SELECT * FROM cl_cartzlink..Sms_Log WHERE clientId = 18507

where, clientId refers to the value of the customers_id for the company.

By following these steps, you’ll successfully enable WhatsApp messages.

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *