User Tools

Site Tools


send_messages_to_clients_upon_batch_submissions

Send Messages to Clients Upon Batch Submissions

Our recurring payment system makes use of the idea of “batches of payments” in order to simplify payment processing and help catch mistakes before your clients bank accounts are debited.

The system is quite simple and rather well explained on our Manage Debit Batches section.

This is part of a series of example Rules to help explain what is possible with the rule editor.

In this example we want to send a notification text message to every client whenever a batch they are on is submitted. Since some clients are not happy receiving these messages, we are also going to add an extra custom field to each client with an option to not receive the messages.

1. The first thing we’re going to do is add the custom field:

  1. From Setup > General > Custom Fields, choose Add Field,add a field called “Send batch notifications“.
  2. Configure this as a Drop-down list with the options: “Send notifications” and “Do not send” Note: The send option is listed first since that is what we want as the default value.
  3. Select the “Not visible on signup forms” option, and given the control a neat name of “send_batch_notifications”.

2. Now that the custom field is added, we’re ready to add our rule to send out the messages:

  1. Head to Setup > Rules.
  2. Choose to add a new rule on the event “Just after a batch changes state”.
  3. This rule will be run every time you add a new batch, as soon as you mark it as submit, and when it is submitted to the bank (along with a couple other changes.)

To be simple, right at the top we’re going to make sure our messages only get sent out as the batch is submitted to the bank.

Add a statement at the top “Check if a basic test is true” and for the condition enter “$to_state” “is not equal to” “submitted”.

Inside that add a new statement “Stop executing this rule”. These top two statements will ensure that the rest of the rule is only run when batches are marked as submitted (when we want to send out the messages.)

3. Now we’re ready to set up the messages. Add a new rule to the bottom choosing “For each payment”.

Inside that we want to check that the client hasn’t been put on “Do not send”, so add a “Check if a client custom field value”. In the test fill in “Send batch notifications” “is not equal to” “Do not send”.

Finally we’re ready to add our SMS message.

Inside the check block add a Send SMS control (note the statement is only available once you have enabled a message gateway under Setup > Messaging > Text Messages.

Here is an example template:

“Hi $client->firstname, your payment for $payment->amount($payment->currency) has been scheduled for $payment->date->neat. If you have any queries please contact us on 082-111-1111. Regards, SnapBill.”. Once templating has run the messages come out something like: “Hi Josh, your payment for $15.50 has been scheduled for March 3rd. If you have any queries please contact us on 082-111-1111. Regards, SnapBill.”.
send_messages_to_clients_upon_batch_submissions.txt · Last modified: 2014/11/05 13:50 by Lisa Adams