Creating an Event Handler

The following operations must be performed before creating an Event Handler:

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:

  1. Sign in to the Operator Control Panel.
  2. On the Navigation Bar go to Event Handlers (see Navigation). The list of Event Handlers is displayed (see Viewing the List of Event Handlers).
  3. Click the Create button on the Toolbar.



    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.
  4. In the Event list of the New Event Handlers page, select the type of event, for which the notification will be sent. The List of Event Handlers includes the following Events:
    • Payment due date is coming occurs only when an Account is billed on the Postpay basis. Depending on the conditions specified in the Query (see Using Placeholders for Event Handlers), it occurs specified number of days prior to the end of Payment expiration period, 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). When no conditions are specified in Query, the Event occurs on the Payment due date.

      To send Notifications several days prior to Payment due date, use following condition in Query:


      payment.days_left = N,

      where N - number of days prior to the end of Payment expiration period.

      To send Notifications on the Payment due date, when the Payment receives the Expired status, and the related Subscriptions are blocked, use following condition in Query:


      payment.days_left = 0

      or leave Query empty.

    • 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);
    • 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);
    • Low balance occurs when the Account Balance is negative;
    • Manual operation occurs when:
    • Payment has been received occurs when the Payment changes its status:
      • to Cancelled (see Approving a Payment);
      • from Waiting for payment to Completed;
      • from Waiting for payment to Invoice creation;
      • from Invoice creation to Receipt sent;
      • from Receipt sent to Completed.
    • 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. Requires the 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 trial to paid period;
    • Subscription changed occurs when:
      • the Subscription status changes to:
        • Active;
        • Deleted, excluding the case of automatic or manual deletion of a Subscription with Waiting for payment status;
        • Stopped (excluding the case of the Administrative hold of the Account);
        • Graced;
        • Waiting for manual approve.
      • Subscriptions is switched from trial to paid period;
      • an active Subscription is renewed in the Operator Control Panel (see Manually Renewing a Subscription) or in the Customer Control Panel (see Renewing a Subscription);
      • a Subscription is auto-renewed (see Auto-Renewing a Subscription);
      • the number of additional Resources is changed (see Changing a number of Additional Resources).
    • Verify email occurs when a new User finishes 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:
    • Order created occurs when a new Order is created (Creating an Order);
    • 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 pressing the Receive a verification code button at the SMS Verification step during the Full Registration of an Account (see Full registration);
    • Update CSP price occurs daily for all the Subscriptions. Requires the configuration of the Query field;
    • Upload CSP price occurs when:
      • a new file with prices has been downloaded (see Updating of the Resource prices);
      • after a new file with prices has been approved, when the file with prices changes its status from Approval required to Current or Future;
      • when the file with prices changes its status from Future to Current.
    • 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 if the current financial period ended.
    • 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);
    • 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;
    • 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.

    • Billing day is coming occurs on a daily basis for each unique Billing day, when an Account uses Prepay charging model (see Creating an Account Class). 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. The email additionally contains the link to the Top-up Balance page (see Adding money to the Account Balance).
      This Event Handler requires the setting of the Query.

      If you don't set the Query, then the Event Handler is triggered in every possible situation.

      For example, if an Account has three Subscriptions with any billing type with three different Billing days, the Account Owner would receive three email Notifications a day.

      To avoid this situation, we strongly recommend to set the following parameters (see Using Placeholders for Event Handlers):

      • existence of the Subscriptions with the determined billing types. You can set this parameter using the monthly_billing Placeholder. To send Notifications only to the Owners of the Accounts that have the Subscriptions with the CSP monthly, G Suite, Pay in full and Non-refund billing types, add the following expression in the Query field:

        monthly_billing = "true"
      • a number of days left to the Billing day that caused the Notification event occurring. You can set this parameter by using the billing_day_left Placeholder. To send Notifications a defined amount of days prior to each unique Billing day, add the following expression in the Query field:

        billing_day_left = {an amount of days prior to each unique Billing day}

      You can additionally set the following parameters:

      • a date of the Billing day. You can set this parameter by using the billing_day Placeholder.
      • a sum of the amounts of opened Charges for the active (not deleted) Subscriptions with the G-Suite, CSP monthly, Pay in Full billing types that will be closed or blocked on the Billing day that caused the Notification event occurring. You can set this parameter by using the billing_day_open_charges_amount Placeholder.
      • IDs of the Plans of the Account active Subscriptions. You can set this parameter by using the plan_ids Placeholder.
      • IDs of the Products of the Account active Subscriptions. You can set this parameter by using the product_ids Placeholder.
      • Account type key. You can set this parameter by using the account.type_key Placeholder.
      • Account class key. You can set this parameter by using the account.class_key Placeholder.
      • available Account balance. You can set this parameter by using the account.balance Placeholder.
      • Financial blocking thresholdYou can set this parameter by using the account.financial_blocking_threshold Placeholder.


      For example:

      billing_day = 1 and billing_day_left = 28 and account.type_key = "personal" and account.class_key = "default" and account.financial_blocking_threshold = 0 and monthly_billing = true and (plan_ids include? 1420) and (product_ids include? 498)

      If you want to add several conditions that should be fulfilled simultaneously, use the and operator: billing_day = 1 and billing_day_left = 28. In this case the Notification is sent 28 days prior to the Billing day only for the Subscriptions, whose Billing day is set on 1st day of each month. In total, one Notification a month is sent to each unique Account Owner.

      If you want to add several conditions, only one of which should be fulfilled at a time, use the or operator: billing_day = 1 or billing_day = 5. In this example, one notification for each Subscription with the unique Billing day is sent each day of the Billing period for Subscriptions, if the Billing day is set on the 1st or the 5th day of each month. In total, two Notifications a day are sent to each unique Account Owner.

      Use parentheses () to group and to combine conditions: (billing_day = 1 or billing_day = 2) and (billing_day_left = 3 or billing_day_left = 4). In this case:

      one Notification is sent 23 days prior to the Billing day for the Subscriptions, whose Billing day is set on 1st day of each month;

      one Notification is sent 24 days prior to the Billing day for the Subscriptions, whose Billing day is set on 1st day of each month;

      one Notification is sent 23 days prior to the Billing day for the Subscriptions, whose Billing day is set on 2nd day of each month;

      one Notification is sent 24 days prior to the Billing day for the Subscriptions, whose Billing day is set on 2nd day of each month;

      In total, four Notifications a month are sent to each unique Account Owner.

      Also, you can use math operators + and -, comparison operators > <, or to invert a Placeholder and its value (1 = billing_day).

    • Billing day has come occurs after running the billing process and closing Charges for every Manager in the following cases:

      1. The Manager has at least one Account with a Subscription in any status except Deleted, and the Subscription billing day is the day of running the billing process.
      2. The conditions specified in the Query field are satisfied.

        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.

        PlaceholderDescriptionData typeExample
        billing_dayThe date of the billing day when the Event occursintegerbilling_day = 5
        subscriptions_plan_category_keys

        Plan category keys that are used for the check whether the Manager has at least one Account with a Subscription in any status except Deleted within the specified Plan categories

        arraysubscriptions_plan_category_keys include? "azure"
        subscriptions_statusesSubscription statuses that are used for the check whether the Manager has at least one Account with a Subscription in any specified statusarraysubscriptions_statuses include? "active"

        You can also use any other placeholders (see Using Placeholders for Event Handlers) except owner.

    • 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.

      For example, the Account credit hold is coming event will occur when the Account balance becomes less than 35% of the Financial blocking threshold:

      account.financial_blocking_threshold % 35 < -account.balance

    • Credit hold threshold was changed occurs when the Financial blocking threshold was set for a new Account (see Creating an Account) or changed in an Account Class (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.

    • Credit limit for postpaid subscription was changed occurs for Accounts with postpaid Subscriptions that are not deleted in the following cases:

    • Credit limit for postpaid subscription is approaching occurs when the Current debt becomes equal to or less than the defined part (1~99%) of the Subscription credit limit but not less than the Subscription credit limit. Requires the proper Query. Occurs only once.

  5. In the Notification template type list, choose one of the following ways to send a notification message: SMSEmail or Client Panel.
  6. In the Notification template list, select a template that will be used to create a notification message (see Creating a Notification Template).
  7. In order to configure sending messages in the certain time:
    • Clear the checkbox. The 
    • In the
  8. In the Query field, type a 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

    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.
  9. Click Create. New Event Handler will be created and displayed on the List of Event Handler of the current Reseller and all its downstream Resellers (see Viewing the List of Event Handlers).