Creating an Event Handler
In this article:
Creating an Event Handler
The following operations must be performed before creating an Event Handler:
- Creating an SMS gate for the SMS notification (see Managing SMS Gates).
- Adding a Notification Template for the required Event (see Creating a Notification Template).
The new created Event Handler is automatically created for all downstream Resellers (see Delegating UI Templates, Notification Templates, Event Holders and Notification Categories).
To add an Event Handler:
- Sign in to the Operator Control Panel.
- On the Navigation Bar, go to Event Handlers (see Navigation). The list of Event Handlers is displayed (see Viewing the List of Event Handlers).
On the Toolbar, click Create. The New Event Handlers page is displayed.
Since the Event Handler is delegated to all downstream Resellers it should be unique. That means that the set of Event, Notification template type, Notification template and Query parameters must not match the corresponding set of parameters of any other Event Handler of current Reseller (Operator) and all its downstream Resellers.In the Event list, select the event for the notification. For the full list of events, see the table.
- In the Notification template type list, choose one of the following ways to send a notification message: SMS, Email or Client Panel.
- In the Notification template list, select a template that will be used to create a notification message (see Creating a Notification Template).
- In order to configure sending messages in the certain time:
- Clear the checkbox. The
- In the
In the Query field, enter the request and condition of the handler. Use Placeholders if necessary (see Using Placeholders for Event Handlers).
The following operation with Placeholders are possible during the query creation:
>
<
>=
<=
=
!=
include? (for example, order.type = "SalesOrder" and (order.plans_ids include? 2000030)) — the Event Handler works if the Plan with id =2000030 is included in the Order)
- exclude? (to exclude the certain entities (using an id, key or name) from the massive of entities. For example, in order to exclude sending messages about an order creation, which includes the Plan with the id = 2000000, use the following rule: order.plans_ids exclude? 2000000)
and
- or. For several
or
afterand
, use additional parentheses:order.type = "RenewalOrder" and order.renewal_is_positive = true and subscription.payment_model = "prepay" and ((order.plans_ids include? 293827) or (order.plans_ids include? 293824) or (order.plans_ids include? 294340))
- % (for example, 30% of the Financial blocking threshold:
account.financial_blocking_threshold % 30
)
You can use the Liquid language, which allows creating more complicated Notification. For more information see https://shopify.github.io/liquid/basics/introduction/.
subscription.days_left = 10 AND subscription.status = "active" This query is used for all active Subscriptions that expire after 10 days.
- Click Create. The new Event Handler will be created and displayed in the List of Event Handler of the current Reseller and all its downstream Resellers (see Viewing the List of Event Handlers).
List of events
Event | Description |
---|---|
Account credit hold is coming | Occurs when the Account balance becomes equal to or less than the defined part (1~99%) of the Financial blocking threshold but not less than the Financial blocking threshold. Requires the proper Query. |
Account changed | Occurs when an Account is moved to the Administrative or Financial hold (see Moving an Account to the Administrative hold and Moving an Account to the Credit hold) or when an Account is returned from the Administrative or Financial hold (see Returning an Account from Administrative hold). |
Account created | Occurs when a new Account was created (see Creating an Account). |
Financial blocking threshold was changed | Occurs when the Financial blocking threshold was set for a new Account (see Creating an Account) or changed in an AccountClass (see Viewing and updating Account Class's details) or at the Account level (see Viewing and updating an Account's details). When an Account gets another Account Class but the value of the Financial blocking threshold is not changed, the event does not occur. |
Account manager changed | Occurs when an Account Manager was set or changed (see Viewing and updating an Account's details). |
Invoice closed | Occurs on the Billing day, when an Invoice is generated (see Managing Invoices). |
The Invoice was approved | It is triggered by an API method (see Approve postpaid invoice) for a postpaid Invoice with external management (see Managing Invoices for the Postpay model by a third-party ERP system). The invoice.has_attached Placeholder is used to define whether a third-party invoice is attached to the linked Payment. |
Low balance | Occurs when the Account Balance is negative. |
Manager created | Occurs when a new Manager is created via the Operator Control Panel (see Adding a Manager) or API (see Create manager). Used for sending the credentials to the Manager (see Placeholders used in Notification Templates for specific Event Handlers). Requires no Query. |
Manual operation | Occurs when:
|
Payment has been received | Occurs when the Payment changes its status:
|
Payment due date is coming | Occurs only for Subscriptions within the Postpay model. Depending on the conditions specified in the Query (see Using Placeholders for Event Handlers), it occurs the specified number of days prior to the end of the Payment expiration period (see Viewing and updating Account Class's details), or on the Payment due date, when the Payment receives the Expired status, and the related Subscriptions are blocked (see Viewing details of the Invoice for the Postpay charging model). If no conditions are specified in Query, the Event occurs on the Payment due date. An Email Notification includes a PDF invoice attached. The PDF invoice is generated for a Payment linked to a postpaid Invoice in the platform. The PDF invoice is generated for Accounts with the default Payment method based on the CheckCash plugin only (see Viewing and updating Account Type's details). |
Postpay payment created | Occurs on the day after the Billing day, when the platform closes a postpaid Invoice and creates the related Payment. An Email Notification includes an attached PDF invoice for the postpaid Payment. The PDF invoice is generated for Accounts with the default Payment method based on the CheckCash plugin only (see Viewing and updating Account Type's details). |
Password reset request | Occurs when an email with instructions on how to reset the User's password for the Customer Control Panel is requested (see Resetting the password to the Customer Control Panel). |
Manager password reset request | Occurs when an email with instructions on how to reset the Manager's password for the Operator Control Panel is requested (see Reset the password for the Operator Control Panel). |
Before subscription expiration | Occurs daily for all the Subscriptions that are not linked to Renewal Orders in the Waiting for provisioning or Provisioning statuses. Requires the proper configuration of the Query field. |
After subscription expiration | Occurs daily for all the Subscriptions. Requires the configuration of the Query field. |
After subscription switched from trial to no-trial | Occurs when a Subscription is switched from a trial to a paid period. |
Subscription changed | Occurs when:
|
Verify email | Occurs when a new User completes the registration process in the Customer Control Panel by clicking the Sign Up button (see Short registration). |
User invitation | Occurs when an external user is invited by the Account Administrator or Account Owner (see Inviting External Users). |
Order changed | Occurs when the Order status changes to:
The receipt is not attached to a Notification. |
Order created | Occurs when a new Order is created (Creating an Order) including manual and automatic renewing of a Subscription. To avoid sending to customers invoices to pay for Prolong Orders created on the Billing day for automatic paying from the Account balance, see Prolonging a Subscription), it is necessary to exclude Subscriptions with the Auto-renew point (days) = 0 from the Order created and Order changed Events. To do that, for these Events, in the Query field, use the following expression: |
Guaranteed payment created | Occurs when
|
Guaranteed payment changed | Occurs when a Guaranteed Payment is revoked manually or automatically because of balance top up (see Manually Revoking a Guaranteed Payment). |
Guaranteed payment will expire | Occurs in the specified number of days before the expiration date of a Guaranteed Payment. |
Days left to pay | Occurs daily for all the Subscriptions. Requires the configuration of the Query field. |
Phone verification | Occurs after clicking the Receive a verification code button at the SMS Verification step during the Full Registration of an Account (see Full registration). |
Billing day is coming | Occurs on a daily basis for each unique Billing day. This event is used to inform the Account Owner by email about the sum that is required at the Account balance on the Billing day in order to prevent the Subscriptions stopping. If an Account has a Subscription with the Pay as you go billing type, the notification contains the information that the required sum may change (see Pay as you go. Charges generation). The email additionally contains the link to the Top-up Balance page (see Top up balance). Managers authorized in the Operator Control Panel with the System administrator and Salesperson roles (see Managers' Roles) can also follow the link and log in to the Customer Control Panel within the same Reseller if they do not have another session in their browser with authorization in the Customer Control Panel. Subscriptions in the following statuses only (see Viewing the list of Subscriptions) are taken into account by the Event Handler:
This Event Handler requires the setting of the Query. To make a table with Subscriptions that are about to expire, use the following Placeholders:
|
Billing day has come | Occurs after running the billing process and closing Charges for every Manager in the following cases:
On the New Notification Template page, in the Additional Settings group, in the To field, it is necessary to enter the {{manager.email}} placeholder to send the Notification to the proper Manager email. |
Net cost has been changed | Occurs when net cost has been changed at the current Reseller level (see Viewing the Price List). Leave the Query field empty when creating this Event Handler. Platform collects information about net cost changing once per 24 hours at night. Only the Plans, for which the net cost has been changed from 00:00:00 to 23:59:59 on the previous day, are included. For example, if information is collected at 2:00 a.m. on July, 30, only the Plans for which the net cost has been changed from 00:00:00 to 23:59:59 on July, 29, are included. |
Credit limit for postpaid subscription was changed | Occurs for Accounts with postpaid Subscriptions that are not deleted in the following cases:
The event occurs for changes via API and the Operator Control Panel. |
Credit limit for postpaid subscription is approaching | Occurs when the Current debt becomes greater than the defined part (1~99%) of the Subscription credit limit but still less than the Subscription credit limit. Requires the proper Query. Occurs only once. |
Closing documents generated | It is triggered by an API method (see Send notifications on closing documents). The event is used for sending notifications to Accounts of a Reseller on Closing documents for the selected period. The Closing documents are available for downloading via the link in the notification and viewing in the Customer Control Panel (see Closing documents). The Closing documents section of the Customer Control Panel is displayed for an Account if the corresponding system settings are applied (see General system settings). Notification are sent on Closing documents in the New status only. After notifications are set, the Closing documents get the Sent status. |
Joined payment created | Occurs when Payments have been joined automatically or manually to the joined Payment (see Joining Payments for the Prepay model). |
Resend the order | Occurs in the specified number of days after the day when the Order was created for Orders in the Waiting for payment status and Payments linked to one Order only (the Payments are not joined, see Joining Payments for the Prepay model). |
Resend the joined payment | Occurs in the specified number of days after the day when the joined Payment was created. For Payments in the Waiting for payment status only. |
Request to reset the password after the user creation | Occurs when the User's password has been reset, in the case when the User was created in the Operator Control Panel (see Creating a User). |
Update CSP net costs | Occurs daily for all the Subscriptions. Requires the configuration of the Query field. |
Upload CSP net costs | Occurs when:
|
Request for creating bill was sent | Occurs if the manual operation for receipt generating was created. |
Bill on balance replenishment is ready | Occurs if the receipt for balance top-up was created manually. |
The accounting period was closed | Occurs when 1C sends a request to ActivePlatform to reconcile the Account balance in 1C and ActivePlatform to close the accounting period. |
VSP resources changed | Occurs when a Subscription to a Plan received from Vendor Portal changes its status from Updating to Active, after the amount of Subscription Resources was changed. |
VSP subscription created | Occurs when a Subscription to a Plan received from Vendor Portal changes its status from Installing to Active (see also Synchronization of Products and Plans between Vendor Portal and ActivePlatform). |
Create instance | Occurs when a new CloudServer server is created (see Создание Сервера). |
Reset instance password | When a password for a CloudServer server is reset. Password reset is possible only using the user interface of the CloudServer control panel. |