Overview
Within Project, you need to give notifications for different events at various stages. User can configure to trigger time based events as well as operation based event notification.
Depending on the package, user has subscribed for, number of notifications available to user varies.
Notifications List
- Listing
- Notification Name : Name of the notification
- Trigger Type : Can be either Time or Operation
- Time Type: It means your notification will be send on the timely basis that you have decided for it
- Operation Type: It means your notification will be send on the operation based that you have set eg: Insert,Update,Delete
- Upload : If the subscription plan will be inclusive of these features then clicking on the option will upload it on server. If you have added any remote server details and marked it as “default” server (from project management → Remote Server List ) , then you will get option to upload code of all notifications directly on default remote server. If you don’t make any remote server as “default” server , then it will not show you this upload feature.
- Download : If the subscription plan will be inclusive of these features then clicking on the option will download from server.
- Update : Clicking on this will update the code related to Notification. It allows you to send notifications in your project.It allows 2 types of triggers.
- Time based (CRON)
- For example : if you want to send reminder to your patients for reminding today appointment once in a Day then it’s time based.
- Operation based
- For example : if you insert/add any coupon code , then it will send to your all customers by email / SMS , then it’s operation based.
- Time based (CRON)
- Event Configuration : This is explained in detail at “Edit API : Configuration” in API Configuration document Below is the snapshot of the screen which you will see as soon as you will be redirected on Next page of configuration.
Actions
- Edit : This will open the notification in edit mode.
- Delete : This will delete the particular notification.
- Add New : This will allow user to add new event notification.
- Delete : This will remove the selected notification.
- Show All : If filtered results are on the screen, this will show all the records at once.
- Copy Notifications : This will copy already configured notification from your existing project. A separate window will open where you need to select project and desired notification from the list of notifications.
- Update Code : This will update the code on the server after your confirmation.
- Documentation : This will redirect the user on documentation page for the Notification section, if available.
- Categories : It will redirect user on Event Categories window where default categories will be shown and new category can be added. Notifications can be switched from one category to another using this option.
- Searching : Any notification can be searched / filtered based on following criteria.
- Notification Name
- Trigger Type
- Category
- Sorting : Single click on the column head will sort the records in ascending and again clicking will sort records in descending.
Add New Notification
Anytime if you want to notify user about anything which is based on time or operation, new notification can be added.
It provides same interface like API does. It imparts flowchart structure and allows you to send “SMS notification” and “Desktop Notification”. (Its additional controllers comparatively WS).
- SMS notification
- Desktop Notification
- SMS notification : It allows you to send SMS to specific selected group of customers.Just select contact field and set message over there. It allows you to set variable in message.
Syntax : #variable# - Desktop Notification : It allows you to send “desktop notification” to specific selected group of customers. You need to select entity , receiver email , subject , content message. Just select contact field and set message over there. It allows you to set variable in message. Syntax : #variable#.
Here is the list of fields explained for easy understanding of users:
- Notification Name : Enter name of the notification.
- Notification Function : Though this will be auto-generated, it's editable too.
- Notification Category : Select Event Category from default categories like Misc, Tools and User or you can add new category too.
- Trigger Type : Trigger type can be either Time or Operation
When configuring notifications for your project, you have two primary trigger types to choose from: Time Trigger and Operation Trigger. The selection you make will determine when your notifications are dispatched.
-
Time Trigger : Determine the specific time or schedule when you want your notification to run. You can specify the time in cron format, which consists of five fields (minute, hour, day of the month, month, day of
the week).
Key Features of Time Trigger:
Custom Scheduling: Make the notification activation time to align with your unique business requirements. This flexibility empowers you to design notifications that coincide perfectly with your workflow.Common Setting:
You can choose any one the timing for your notification and your notification will run after that span of the timeYou can also customize the timing according to your business logic
You can set the crone tab according to youTo implement the Time Trigger option, you'll need to set up a cron job on your Linux system. This allows you to define precisely when a specific script or command should execute.
The format for a cron job entry consists of five fields: minute, hour, day of the month, month, and day of the week.
* * * * * USERNAME /path/to/command
Use the crontab command to set up the cron job on your Linux system. Replace /path/to/command with the actual path to the script or command you want to execute.
-
Example:
Running a Notification Every Sunday at 04:05 AM
To illustrate, let's say you want to trigger a notification every Sunday at 04:05 AM. In this case, you would configure the cron job as follows:
5 4 * * sun /path/to/command
-
Breaking this down:
5: This field represents the minute. In our example, it's set to 5, signifying that the notification will run at the 5th minute of the specified hour.
4: This field represents the hour. It's set to 4, indicating that the notification will be triggered at 4 AM.
*: The asterisk (*) in the day of the month field means that the notification will run on any day of the month.
*: Similarly, the asterisk (*) in the month field means that the notification can run in any month.
sun: This field specifies the day of the week. In our example, it's set to "sun," ensuring that the notification runs exclusively on Sundays.
/path/to/command: Here, you should replace "/path/to/command" with the actual path to the script or command you want to execute.
By configuring the cron job in this manner, you achieve the desired schedule, ensuring that the command specified at "/path/to/command" runs precisely at 04:05 AM every Sunday. This level of control over timing is a powerful tool for automating tasks and notifications in your project. -
Example:
-
Operation Trigger : The Operation Trigger is a powerful mechanism that allows you to activate notifications based on specific operations performed on a designated database table.
This feature brings precision and automation to your notification system, ensuring that notifications are triggered only when relevant database actions occur.Begin by selecting the database table upon which you want to trigger notifications. This choice forms the foundation for defining when your notifications should be initiated.
After selecting the target table, the next step is to specify the database operation that should act as the trigger for your notifications. These operations can include INSERT, UPDATE, DELETE actions, You can choose based on your project's requirements.
Once you've configured the trigger, your notifications will be automatically executed whenever the specified operation is performed on the chosen table. This ensures that notifications are seamlessly integrated into your workflow, delivering real-time updates as needed.
Cautionary Considerations
It's essential to exercise caution when setting up cron jobs for operation-based notifications, particularly when dealing with database operations. To avoid potential issues like infinite loops or excessive resource consumption.Example:
If you configure a notification to trigger upon an INSERT operation within the same table, it can lead to an infinite loop scenario, where each insert operation triggers another notification and so on.
-
Time Trigger : Determine the specific time or schedule when you want your notification to run. You can specify the time in cron format, which consists of five fields (minute, hour, day of the month, month, day of
the week).
- Description : Detailed description so new user/developer can understand why and in which condition it is to be used.
- Next : This will redirect user on Notification configuration page.
- Cancel : This cancel the add notification process and redirects user on previous page.
- Edit Notification Configuration : This is explained in detail at “Edit API : Configuration” in API Configuration document Below is the snapshot of the screen which you will see as soon as you will be redirected on Next page of configuration.
Settings for SMS Notification Controller
Configuring SMS Notification using Flow chart like screen, is shown in below screenshots:
-
QUERY :
The Query Tab offers a versatile platform for crafting SQL queries with ease. It supports a range of operations, including Select, Insert, Update, and Delete, all tailored precisely to meet your requirements.
Within the Notification, you have the flexibility to compose multiple queries within a single notification to suit your specific needs.-
Query Type:
In the query box, you can select the type of query you wish to perform. -
Main Table:
Choose the primary table on which you intend to execute the query -
Add Relation:
You have the option to establish relations with other tables to retrieve combined data as needed. -
Table Allies:
Customize table aliases to align with your preferences. -
Limit:
Specify data limits to control the amount of information returned after executing the query.
-
Query Type:
-
CONDITION :
The Condition Tab provides the functionality to apply conditions within your notifications, allowing you to precisely control the flow of your notification to meet your specific requirements.Within the Condition Tab, you'll find the following elements:
-
Operand 1:
This is the first part of your condition. It's where you specify what you want to apply the condition to. You have three options:-
variable :
You can choose a variable within your system to apply the condition to. -
Static :
You can provide a fixed/static value to this operand. This means the condition will always compare against this specific value. -
Flow :
You can select a flow from the notification condition. This means you can reference some predefined logic or workflow as part of your condition.
-
variable :
-
Type:
This is where you specify the data type of the variable or value you're working with.- Integer:Whole numbers, e.g., 5, -10, 42.
- String:Textual data, e.g., "Hello, World!", "User123".
- Float:Decimal numbers, e.g., 3.14, -0.5, 99.9.
- Date:A specific date, e.g., "2023-09-14".
- Datetime: Date and time combined, e.g., "2023-09-14 15:30:00".
- Time:A specific time of day, e.g., "15:30:00".
- Array:A collection of values, e.g., [1, 2, 3, 4, 5].
- Array Count:The number of elements in an array.
-
Operator:
This is where you choose the comparison operator to apply in your condition. -
Operand 2:
This is the second part of your condition. It's what you want to compare to Operand1. You have two options:-
Variable:
You can choose another variable to compare against Operand1. -
Static:
You can provide a fixed/static value to compare to Operand1.
-
Variable:
-
Operand 1:
-
VARIABLE :
By Using this Tab you can add extra variable in your Notification-
Variable Name:
Select a descriptive name for your variable. Ensure it reflects the purpose or content of the variable clearly. Use camelCase or underscores for multi-word variable names (e.g., orderNumber, customerName). -
Type:
You can choose the Type of the variable as per your requirement
1)Array(comma separated)
2)Array(Single Dimention)
-
Value:
You can add the value for the variable
-
Input Params :
You can choose the fields values that you are sending from the input params
-
Other :
-
Static : You can give the static value to your variable according to your wish
Enter Alpha Numeric Value with underscore in lowercase.
-
Expression :
Eg 1 : 1 + 2
Eg 2 : {%REQUEST.qty%} * 2
Eg 3 : {%SYSTEM.price%}
-
Function :
Function should be declared in
application
> libraries
> general.php
file as like below
function functionName($input_params='',$index_val= '')
{
// do your code
//Return value must be value or array.
}
-
Static : You can give the static value to your variable according to your wish
-
Input Params :
-
Variable Name:
-
Start Loop :
We can start the loop in the notification as per our business logic.
-
Select Data Source:
You can choose on which field you want to run the loop on -
Iteration Type:
You can choose the Iteration type for the Loop
- Array Iteration
- Number Iteration
- Custom Iteration
-
You must specify "Flow Label" of any of the above flows as Loop Name.
NOTE : Please do not specify the current or below flow label as Loop Name.
-
Select Data Source:
-
END LOOP :
By Clicking on this tab you can End the loop you have started.-
Select Loop Name :
Select the loop name you want to end here.
-
Select Loop Name :
-
BREAK/CONTINUE :
By clicking on this tab you can apply break and continue the logic of the notification as per the condition you have given here as per your logicType :
-
Break :
You can apply break in your notification as per your business logic by applying the condition here -
Continue :
You can Continue the logic of your notification by applying the right condition here.
Within the BREAK/CONTINUE Tab, you'll find the following elements:
-
Operand 1:
This is the first part of your condition. It's where you specify what you want to apply the condition to. You have three options:-
variable :
You can choose a variable within your system to apply the condition to. -
Static :
You can provide a fixed/static value to this operand. This means the condition will always compare against this specific value. -
Flow :
You can select a flow from the notification condition. This means you can reference some predefined logic or workflow as part of your condition.
-
variable :
-
Type:
This is where you specify the data type of the variable or value you're working with.- Integer:Whole numbers, e.g., 5, -10, 42.
- String:Textual data, e.g., "Hello, World!", "User123".
- Float:Decimal numbers, e.g., 3.14, -0.5, 99.9.
- Date:A specific date, e.g., "2023-09-14".
- Datetime: Date and time combined, e.g., "2023-09-14 15:30:00".
- Time:A specific time of day, e.g., "15:30:00".
- Array:A collection of values, e.g., [1, 2, 3, 4, 5].
- Array Count:The number of elements in an array.
-
Operator:
This is where you choose the comparison operator to apply in your condition. -
Operand 2:
This is the second part of your condition. It's what you want to compare to Operand1. You have two options:-
Variable:
You can choose another variable to compare against Operand1. -
Static:
You can provide a fixed/static value to compare to Operand1.
-
Variable:
-
Break :
-
CUSTOM FUNCTION :
By selecting this tab, you can employ a custom function to manipulate your notification data in accordance with your specific requirements.Return Type:
-
Multiple:
This option enables you to dispatch multiple return values from the custom function. -
Single:
Alternatively, you can choose to transmit a single return value from the custom function. -
function customFunctionName($input_params = '')
{
// Your custom code here
// If providing output parameters for a single return value:
$return_arr[0]['user_id'] = 1;
$return_arr[0]['email'] = "[email protected]";
$return_arr[0]['name'] = "John";
// If providing output parameters for multiple return values:
$return_arr[1]['user_id'] = 2;
$return_arr[1]['email'] = "[email protected]";
$return_arr[1]['name'] = "Janni";
return $return_arr; // Return the result
}
Function Name:
You can specify the desired function name in this location.Function Declaration Location:
Your custom function should be declared within your application's directory structure as follows:
application
libraries
> general.php -
Multiple:
-
Email:
By clicking on this tab you can send Emails to your clients as per your requirement-
To Emails:
In here you can write the mail of the person who you want to send the emails. -
Template:
You can choose in which te,plate design you wabt to send your Email from here. -
Attachments:
If there are any attachment that you want to send through the email then you can simply send them from here. -
Content:
Write the content for the email from here
-
To Emails:
-
PUSH NOTIFICATIONS :
By clicking on this tab you will be able to push other notifications from this existing notificationss-
Device Token:
Here you have to give the token for the device where you want to send the notification -
Template:
Select the template you want for your notification -
Code:
Give the code here -
Message:
Write the message you want to send from the notification through here. -
Additional Values:
You can provide additional values from here in the format of the key-value.
-
Device Token:
-
SMS :
By clicking on this tab you can send the SMS to the clients as per your requirements.-
Mobile Number :
Here you can give the mobile number for which you want to send this SMS.
You can choose you number from following.-
Input Params :
You can choose the fields values that you are sending from the input params
-
Other :
You can choose the parameter from Request, Server and System
- Request Parameter: table_name.eStatus = '{%REQUEST.status%}'
-
Server Parameter: table_name.vIP = '{%SERVER.REMOTE_ADDR%}'
Example : REMOTE_ADDR, HTTP_HOST -
System Parameter: table_name.vName = '{%SYSTEM.COMPANY_NAME%}'
Example : COMPANY_ADDRESS, COMPANY_NAME, COPYRIGHTED_TEXT, IMAGE_EXTENSION
-
Input Params :
-
Content:
You can write the content for the SMS from here.
Response parameters should be precede and followed by "#" symbol.
Example:- #variable_name#- You can use request, server, system parameters also :
- Request Parameter: table_name.eStatus = '{%REQUEST.status%}'
-
Server Parameter: table_name.vIP = '{%SERVER.REMOTE_ADDR%}'
Example : REMOTE_ADDR, HTTP_HOST -
System Parameter: table_name.vName = '{%SYSTEM.COMPANY_NAME%}'
Example : COMPANY_ADDRESS, COMPANY_NAME, COPYRIGHTED_TEXT, IMAGE_EXTENSION
-
Template :
Select the template you want for your SMS.
-
Mobile Number :
-
FINISH :
By Clicking on this tab you can finish your logic for the notification and then select the data you want to send after executing the notification.
-
Success :
You can give the success here true/false as per your business logic which will indicate the the notification is send successfully or not -
Message :
You can give the message for the success or the failure from here which you can use in displaying in the your project.
-
Success :
Settings for Desktop Notification Controller
Add New Screen (OPERATION based)
It allows you to send “desktop notification” to specific selected group of customers. You need to select entity , receiver email , subject , content message. Just select contact field and set message over there. It allows you to set variable in message.
Syntax : #variable#.
It allows you to set redirection link from desktop notification.You can also apply condition if any. It shows you variable like OLD_variablename (before update) and NEW_variablelname (After Update)
Detail Page
Configuration Page
Extended
In the Extended you have Controller and Model from which you can write the functions and the queries to get the data and manipulate the data as per your business logic.
-
Controller :
In the controller you can write the functions , You can also call the model from here and you can return the manipulated data from the function. -
Model :
In the model you can write the queries to get the data as per your requirement then you can return the data to the controller from ewhere the model is called.