Using placeholders for event handlers

The following table includes the list of events and corresponding placeholders that can be used in the Query parameter of an event handler (see Creating an event handler).

The following operations with placeholders are available for the query:

  • >

  • <

  • >=

  • <=

  • =

  • !=

  • 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 certain entities (using an id, key, or name) from the massive of entities. For example, to exclude sending messages about the order creation for a plan with the id = 2000000, use the following rule: order.plans_ids exclude? 2000000)
  • and

  • or. For several or after and, 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)
EventPlaceholderDescriptionTypeExample

For all events

owner.status

The status of the Owner of an accountstringowner.status = "active"

owner.country

The Owner's address: the two-letter ISO code ISO 3166-1 alpha-2 of the countrystringowner.country = "BY"

owner.city

The Owner's address: citystringowner.city = "Minsk"
current_dateThe current datedatecurrent_date

Account credit hold is coming


Account changed


Account created


Financial blocking threshold was changed


Account manager changed

Low balance


Closing documents generated

Create instance

Reset instance password

account.balance

The current value of the account balance (see Viewing the list of charges)

numberaccount.balance = 1000
account.balance.was

The previous value of the account balance (see Viewing the list of charges)

Can be used only for the Low balance event.

numberaccount.balance.was = 100
account.cityThe account address: citystringaccount.city = "Minsk"
account.class_idThe account class ID (see Account classes)integeraccount.class_id = 1
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "manual"
account.countryThe account address: the two-letter ISO code ISO 3166-1 alpha-2 of the countrystringaccount.country = "BY"
account.financial_blocking_threshold

The limit within which the account balance can be negative without moving the account to the Credit hold status during the subzero period

numberaccount.financial_blocking_threshold = 100
account.has_endless_trial_subscriptions

Indicates whether an account has at least one commercial subscription with the endless period

booleanaccount.has_endless_trial_subscriptions = true
account.has_managerIndicates whether an account is linked to a managerbooleanaccount.has_manager = true
account.regular_sending
  • If account.regular_sending = true, the notification is sent only during the billing process.
  • If account.regular_sending = false, the notification is sent only when the balance changes.
  • If not specified, the notification is sent in all cases: during the billing processes and when the balance changes.
booleanaccount.regular_sending = true
account.statusThe current status of an accountstringaccount.status = "inactive"
account.status.was

The previous status of an account

Can be used only for the Account changed event.

stringaccount.status.was = "inactive"
account.subscription_credit_limitThe value of the subscription credit limit of an accountnumberaccount.subscription_credit_limit = 100
account.type_idThe account type IDintegeraccount.type_id = 1
account.type_keyThe account type keystringaccount.type_key = "business"
account.owner_reset_password_url

A one-time link to set the Owner's password

Can be used only for the Account created event.

stringaccount.owner_reset_password_url = "http://example.com/password/edit?reset_password_token=1q2w3e"

Invoice closed


The Invoice was approved

invoice.statusThe status of an invoicestringinvoice.status = "open"
invoice.has_attachedIndicates whether a third-party invoice is attached to a payment for an approved postpaid invoice with external management (see Managing invoices for the Postpay model by a third-party ERP system)booleaninvoice.has_attached = true
account.type.keyThe account type keystringaccount.type_key = "business"

Manual Operation

operation.idThe manual operation ID (see Manual operations)integeroperation.id = 1
operation.statusThe manual operationstring

operation.status = "approval_required"

operation.status = "declined"

operation.type

The manual operation type. For example, when a subscription stops:

  • operation.type = "manual_provisioning_plugin_application_stop" — for a subscription based on the Manual Provisioning plugin.
  • operation.type = "subscription_stop" — for any other subscriptions.


string

operation.type = "postpay_subscription_verify"


operation.type = "manual_provisioning_plugin_application_install"


operation.type = "subscription_stop"

product.idThe product IDintegerproduct.id = 1
product.nameThe product namestringproduct.name = "ESET"
product_category.idThe product category IDintegerproduct_category.id = 1
plan.idThe plan IDintegerplan.id = 1
plan_category.keyThe plan category IDstringplan_category.key = "default"
subscription.idThe subscription IDintegersubscription.id = 1
subscription.status.wasThe previous status of a subscriptionstringsubscription.status.was="installing"
subscription.statusThe current status of a subscriptionstringsubscription.status.was="active"
account.type_keyThe account type key (see Account types)stringaccount.type_key = "personal"
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "default"
Payment due date has comepayment.due_date_passedThe number of days after a payment gets the Expired statusintegerpayment.due_date_passed = 1
User invitation----

Payment has been changed (previously — Payment has been received)

account.type_keyThe account type key (see Account types)stringaccount.type_key = "business"
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "manual"
account.billing_day

The billing day (see Managing service terms).

integeraccount.billing_day = 30
account.financial_blocking_threshold

integeraccount.financial_blocking_threshold = 100
account.balanceThe current value of the account balance (see Viewing the list of charges)integeraccount.balance = 1000
account.statusThe current status of an accountstringaccount.status = "inactive"
account.countryThe account address: the two-letter ISO code ISO 3166-1 alpha-2 of the countrystringaccount.country = "BY"
account.cityThe account address: citystringaccount.city = "Minsk"
payment.totalThe payment amountintegerpayment.total = 100
payment.status

The payment status

stringpayment.status = "completed"

Password reset request

Verify email

user.idThe user IDintegeruser.id = 1
Manager password reset requestmanager.idThe manager IDintegermanager.id = 1

Before subscription expiration

After subscription expiration

After subscription switched from trial to no-trial

Subscription changed


Credit limit for postpaid subscription was changed


Credit limit for postpaid subscription is approaching

account.balanceThe current value of the account balance (see Viewing the list of charges)numberaccount.balance = 1000
account.statusThe current status of an accountstringaccount.status = "inactive"

account.type_key

The account type key (see Account types)

stringaccount.type_key = "business"
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "manual"
account.financial_blocking_threshold

The limit within which the account balance can be negative without moving the account to the Credit hold status during the subzero period

numberaccount.financial_blocking_threshold = 100
account.subscription_credit_limitThe value of the subscription credit limit of an accountnumberaccount.subscription_credit_limit = 100
account.countryThe account address: the two-letter ISO code ISO 3166-1 alpha-2 of the countrystringaccount.country = "BY"
account.cityThe account address: citystringaccount.city = "Minsk"
plan.auto_renewal_disabledIndicates whether the Disable the Auto-renew option option of the linked plan is activebooleanplan.auto_renewal_disabled = false
plan.idThe plan IDintegerplan.id = 1
plan.status

The plan status

stringplan.status = "completed"
plan_period.duration_value

The plan period duration

integerplan_period.duration_value = 30
plan_period.duration_typeThe units of the plan period (year, month, day)stringplan_period.duration_type = "months"
plan_period.trial

Indicated whether the plan period is trial

The true and false values require quotation marks.

string ("boolean")plan_period.trial = "false"
plan_period.setup_fee

The setup fee of the plan period

numberplan_period.setup_fee = 100
plan_period.recurring_feeThe recurring fee of the plan periodnumberplan_period.recurring_fee = 100
plan_period.renewal_feeThe renewal fee of the plan periodnumberplan_period.renewal_fee = 100
plan_category.key

The plan category key (see Managing plan categories)

stringplan_category.key = "streaming"
plan_category.id

The plan category ID

integerplan_category.id= 1
subscription.idThe subscription IDintegersubscription.id = 1
subscription.cspIndicated whether a subscription belongs to the Microsoft CSP programbooleansubscription.csp = true
subscription.individual_priceIndicated whether a subscription is ordered at the individual prices (see Ordering a subscription at the individual prices)booleansubscription.individual_price = true
subscription.status

The current status of a subscription

stringsubscription.status = "active"
subscription.status.was

The previous status of a subscription

The placeholder is not supported by the Credit limit for postpaid subscription was changed and Credit limit for postpaid subscription is approaching events.

stringsubscription.status.was="installing"
subscription.auto_renewalIndicated whether the Auto-renew option of a subscription is activebooleansubscription.auto_renewal = true
subscription.auto_renewal_disabledIndicated whether the Disable the Auto-renew option option of a subscription is activebooleansubscription.auto_renewal_disabled = false
subscription.auto_renewal.was

The previous status of the Auto-renew option of a subscription

For the Subscription changed event only — regarding a created manual operation. For details, see Manual operations.

booleansubscription.auto_renewal.was = true
subscription.days_leftThe number of days before the expiration day of a subscriptionintegersubscription.days_left = 7
subscription.days_passedThe number of days after the creation day of a subscriptionintegersubscription.days_passed = 15
subscription.plan_class

The name of a service term (see Managing service terms)

stringsubscription.plan_class = "default"
subscription.payment_model

The payment model: prepay or postpay

stringsubscription.payment_model = "postpay"
subscription_postpay.current_debtThe subscription debt as the total amount of all blocked charges for a subscription for the current billing periodnumbersubscription_postpay.current_debt = 100
subscription_postpay.credit_limitThe value of the subscription debt above which a postpaid subscription will be blockednumbersubscription_postpay.credit_limit = 100
product.id

The product ID (see Editing general information about the plan)

integerproduct.id = 1
product.nameThe product name (see Editing general information about the plan)integerproduct.name = "Default"
order.type

The order type

The placeholder is not supported by the Credit limit for postpaid subscription was changed and Credit limit for postpaid subscription is approaching events.

stringorder.type = "RenewalOrder"

Order changed


Order created


Resend the order

order.id

The order ID

The placeholder is not supported by the Order changed and Order created events.

integerorder.id = 1
order.plans_idsThe IDs of the ordered plansintegerorder.type = "SalesOrder" and (order.plans_ids include? 2000030)
order.status

The current status of an order

stringorder.status = "waiting_for_payment"
order.status.was

The previous status of an order

The placeholder is not supported by the Order created event.

stringorder.status.was = "provisioning"
order.totalThe total amount of an orderintegerorder.total = 100
order.type

The order type

stringorder.type = "RenewalOrder"
order.renewal_point

The placeholder is deprecated. In the current version of the platform, order.renewal_point = "true" in any case.

See also order.renewal_is_positive.

Indicates whether the value in the Auto-renew point (days) field is set on the subscription details page (see Viewing and updating subscription's details)

booleanorder.renewal_point = true
order.renewal_is_positive

Indicates whether Auto-renew point (days) > 0 for a subscription (see Viewing and updating subscription's details)

booleanorder.renewal_is_positive = true
subscription.status

The status of a subscription 

stringsubscription.status = "active"
product.idThe product ID included in an order (see Viewing order details)integerproduct.id = 1
product.nameThe product name included in an order (see Viewing order details)integerproduct.name = "Default"
subscription.payment_modelThe payment model: prepay or postpaystringsubscription.payment_model = "postpay"
plan_category.keyThe plan category keystringplan_category.key = "Default"
Resend the orderorder.days_passedThe number of days passed after creating an orderintegerorder.days_passed = 5

Guaranteed payment created


Guaranteed payment changed


Guaranteed payment will expire
account.type_idThe account type ID (see Account types)integeraccount.type_id = 1
account.type_keyThe account type keystringaccount.type_key = "business"
account.class_idThe account class ID (see Account classes)integeraccount.class_id = 1
account.class_key

The account class key

stringaccount.class_key = "manual"
guaranteed_payment.status.was

The previous status of a guaranteed payment (see Managing Guaranteed Payments)

Can be used only for the Guaranteed payment changed event.

stringguaranteed_payment.status.was = "provided"
guaranteed_payment.statusThe current status of a guaranteed paymentstringguaranteed_payment.status = "revoked"
guaranteed_payment.days_leftThe number of days before the expiration date of a guaranteed paymentintegerguaranteed_payment.days_left = 1
Billing day is comingbilling_dayThe billing day date (see Creating a service term)integerbilling_day = 5
billing_day_left

The number of days left to the billing day caused the event to occur (see Creating an event handler)

On the billing day caused the event to occur, the placeholder returns the number of days left to the next billing day

integerbilling_day_left = 7
billing_day_open_charges_amountThe total amount of charges in the Open status that will be closed or blocked on the billing day caused the event to occur. Only subscriptions with Auto-renew point (days) = 0 are counted. If there are no open charges, preliminary charge generation for the next billing period is used for the calculationnumberbilling_day_open_charges_amount = 120.1
plan_idsA list of the plan IDs with active subscriptions of an accountarray(int)plan_ids include? 200023
product_idsA list of the product IDs with active subscriptions of an accountarray(int)product_ids include? 100022
product_names

A list of the product names with active subscriptions of an account

array(str)product_names include? "Default"
monthly_billingIndicates whether an account has active subscriptions with any monthly billing type and the billing day caused the event to occurbooleanmonthly_billing = true
account.type_keyThe account type key (see Account types)stringaccount.type_key = "personal"
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "default"
account.balanceThe available account balancenumberaccount.balance = 58.5
account.financial_blocking_thresholdThe limit within which the account balance can be negative without moving an account to the Credit hold status during the subzero periodnumberaccount.financial_blocking_threshold = 10000
subscription.expiration_dateThe subscription expiration datedate DD.MM.YYYY01.01.2019
subscription.payment_modelThe payment model: prepay or postpaystringsubscription.payment_model = "postpay"
Payment due date is coming

payment.days_left

The number of days before the latest date for completing a payment (see Due date in Viewing payment details) when a notification is sentinteger

payment.days_left = 5

Billing day for manager's subscriptions has come (former Billing day has come)billing_dayThe date of the billing day when the event occursintegerbilling_day = 5
subscriptions_plan_category_keys

The plan category keys to check whether a manager has at least one account with a subscription in any status, except for Deleted, within the specified plan categories

arraysubscriptions_plan_category_keys include? "azure"
subscriptions_statusesThe subscription statuses to check whether a manager has at least one account with a subscription in any specified statusarraysubscriptions_statuses include? "active"

Joined payment created


Resend the joined payment

account.class_idThe account class ID (see Account classes)integeraccount.class_id = 1
account.class_keyThe account class key (see Account classes)stringaccount.class_key = "manual"
payment.days_passed

The number of days passed after creating the joined payment

Can be used only for the Resend the joined payment event.

integerpayment.days_passed = 5
Billing day for account's subscription has comebilling_day_passed

The number of days passed after the billing day to trigger the event for the previous billing period

The billing_day_passed placeholder is required:

  • For subscriptions to the Microsoft Azure Plan service (see Microsoft Azure Plan. Operator Guide) — to postpone the event because the charges are closed after the billing day.
  • For other subscriptions — if there is no need to postpone the event, specify billing_day_passed = 0.
integerbilling_day_passed = 5
plan_category_keyThe key of a plan category of a subscription to trigger the eventstringplan_category_key = "azure"
subscription_statusThe status of a subscription to trigger the eventstringsubscription_status = "active'
account_class_keyThe key of an account class required for an account to trigger the eventstringaccount_class_key = "default"
Correction approvedcorrection.approved_manager_idThe list of IDs of managers who approved a correction to trigger the eventintegercorrection.approved_manager_id = 221
Before account's postpaid subscriptions expirationbefore_subscriptions_expirationsA list of days before a subscription expiration dateintegerbefore_subscriptions_expirations include? 1
Paid amount has been received from external system



payment_transaction.amountThe paid amount specified in a Complete payment by document ID request body numberpayment_transaction.amount = 15
payment.totalThe payment amount in the platformnumberpayment.total = 10
payment.status.wasThe previous status of the paymentstringpayment.status.was = "completed"
payment.statusThe current status of the paymentstringpayment.status = "completed"