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 downline 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, click Settings > Notification > Event Handlers. The Workspace displays the List of Event Handlers (see Viewing the List of Event Handlers).
  3. Click the Create button on the Toolbar.



    Since the Event Handler is delegated to all downline 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 downline 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:
    • 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 Financialhold (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 or cancelling 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);
    • 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 subscription created occurs when a Subscription for a Plan delegated from Vendor Portal changes its status to Active;
    • 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;
    • 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 occurringYou 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.
      • Credit limit of the AccountYou can set this parameter by using the account.credit_limit Placeholder.


      For example:

      billing_day = 1 and billing_day_left = 28 and account.type_key = "personal" and account.class_key = "default" and account.credit_limit = 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).


  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 downline Resellers (see Viewing the List of Event Handlers).