Helper function parameters

Plan change helper

Plan change helper allows you to trigger custom Deluge functions whenever a client performs any of the following actions:

  • Upgrades plan
  • Downgrades plan
  • Renews plan
  • Upgrades user add-ons
  • Downgrades user add-ons
  • Changes subscription cycle from monthly to yearly
  • Cancels subscription

For example, you can configure plan change helper to automatically update your Zoho CRM (using Deluge's Zoho CRM integration task) whenever clients upgrade their pricing plan.

Note:
  • Deluge function that you've configured will be executed immediately after the client alters his plan.
  • Five input parameters will be supplied to the Deluge function among which three parameters (client, plan, and subscription) are applicable for all the above-specified actions and two parameters (old_plan and subscription) vary according to the type of action performed. If you try to fetch values of parameters that are not applicable for the particular action, null value will be returned.
  • All the parameters are of  KEY-VALUE datatype and hold details of the action performed by the client as values against the appropriate keys. You can use get() function to fetch the required values to use them in your Deluge scripts. For example, "client" is the parameter that holds the details of the client and "mail_id" is the key that holds the email address of the client. In order to fetch the email address of the client, you can use the following Deluge script:

    emailclient.get("mail_id");

General Parameters

The following table lists the parameters and their keys applicable for all the actions of the Plan Change helper:

ParameterDescriptionKeyDatatype of the value Value

client

 Details of the client

mail_id

TEXT

Email address of the client
first_name

TEXT

First name of the client

plan

 Details of the current plan

name

TEXT

Name of the current plan
base_price

DECIMAL

Base price of the current plan
markup_price

DECIMAL

Markup price of the current plan
minimum_users

NUMBER

Minimum number of users to be purchased with the current plan
annual_discount

DECIMAL

Discount applied to the current plan (in dollars per month)

solution

 Details of the solution

name

TEXT

Name of the solution
developer_mail_id

TEXT

Email address of the developer

Plan upgrade

The following table lists the parameters that are applicable if a plan has been upgraded in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

old_plan

Details of the old plan that the client had subscribed to before upgrading

name

TEXT

Name of the old plan
base_price

DECIMAL

Base price of the old plan
markup_price

DECIMAL

Markup price of the old plan
minimum_users

NUMBER

Minimum number of users to be purchased with the old plan
annual_discount

DECIMAL

Discount applied to the old plan (in dollars per month)
trial

BOOLEAN

This key holds true if the old plan is the trial plan, and false otherwise.

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "plan_change" if the client has upgraded/downgraded his plan. Other possible values for this key are renewal, user_upgrade, user_downgrade, frequency_change, and cancellation.

frequency

TEXT

Subscription billing cycle.
Possible values: monthly and yearly

expiry_date

DATE-TIME

Expiry date of client's subscription
paid_amount

DECIMAL

Amount paid by the client for the upgrading
no_of_users

NUMBER

Number of users that the client has purchased
plan_name

TEXT

Name of the current plan
old_plan_name

TEXT

Name of the old plan

Plan downgrade

The following table lists the parameters that are applicable if a plan has been downgraded in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

old_plan

Details of the old plan that the client had subscribed to before downgrading

name

TEXT

Name of the old plan
base_price

DECIMAL

Base price of the old plan
markup_price

DECIMAL

Markup price of the old plan
minimum_users

NUMBER

Minimum number of users to be purchased with the old plan
annual_discount

DECIMAL

Discount applied to the old plan (in dollars per month)

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "plan_change" if the client has upgraded/downgraded his plan. Other possible values for this key are renewal, user_upgrade, user_downgrade, frequency_change, and cancellation.

frequency

TEXT

Subscription billing cycle.
Possible values: monthly and yearly

expiry_date

DATE-TIME

Expiry date of client's subscription
no_of_users

NUMBER

Number of users that the client has purchased
plan_name

TEXT

Name of the current plan
old_plan_name

TEXT

Name of the old plan

Plan renewal

The following table lists the parameters that are applicable if the plan has been renewed in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value"renewal" if the client has renewed his plan. Other possible values for this key are plan_change, user_upgrade, user_downgrade, frequency_change, and cancellation.

frequency

TEXT

Subscription billing cycle.
Possible values: monthly and yearly

expiry_date

DATE-TIME

Expiry date of client's subscription
paid_amount

DECIMAL

Amount paid by the client for renewal
no_of_users

NUMBER

Number of users that the client has purchased
plan_name

TEXT

Name of the current plan

User add-on upgrade

The following table lists the parameters that are applicable if user add-ons has been upgraded in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "user_upgrade" if the client has upgraded user add-ons. Other possible values for this key are plan_change, renewal, user_downgrade, frequency_change, and cancellation.

frequency

TEXT

Subscription billing cycle.
Possible values: monthly and yearly

expiry_date

DATE-TIME

Expiry date of client's subscription
paid_amount

DECIMAL

Amount paid by the client
plan_name

TEXT

Name of the current plan
no_of_users_added

NUMBER

Number of additional users that the client has purchased

User add-on downgrade

The following table lists the parameters that are applicable if the user add-ons has been downgraded in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "user_downgrade" if the client has downgraded user add-ons. Other possible values for this key are plan_change, renewal, user_upgrade, frequency_change, and cancellation.

frequency

TEXT

Subscription billing cycle.
Possible values: monthly and yearly

expiry_date

DATE-TIME

Expiry date of client's subscription
plan_name

TEXT

Name of the current plan
no_of_users_downgraded

NUMBER

Number of users that the client has laid off

Change subscription cycle from monthly to yearly

The following table lists the parameters that are applicable if the subscription cycle has been changed from monthly to yearly in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "frequency_change" if the client has changed the billing cycle. Other possible values for this key are plan_change, user_upgrade, renewal, user_downgrade, and cancellation.

frequency

TEXT

Subscription billing cycle. This key holds the value "monthly" in the subscription cycle change from monthly to yearly​ trigger.

expiry_date

DATE-TIME

Expiry date of client's subscription
no_of_users

NUMBER

Number of users that the client has purchased
plan_name

TEXT

Name of the current plan

Cancel subscription

The following table lists the parameters that are applicable if the subscription has been canceled in addition to the general parameters.

ParameterDescriptionKeyDatatype of the value Value

subscription

 Details of the subscription

type

TEXT

Type of action that the client has performed. This key holds the value "cancellation" if the client has canceled the subscription. Other possible values for this key are plan_change, user_upgrade, renewal, user_downgrade, and frequency_change.

plan_name

TEXT

Name of the canceled plan
cancellation_type

TEXT

Possible values:

  • manual
  • auto_expiry

Example

You can use the following Deluge snippet to perform different actions for different types of activities that the client performs with respect to plan:

type = subscription.get("type");
if(type == "plan_change")
{
// Write Deluge script to perform required actions whenever a client upgrades/ degrades his plan
}
else if(type == "user_upgrade")
{
// Write Deluge script to perform required actions whenever a client upgrades his user addons
}
else if(type == "user_downgrade")
{
// Write Deluge script to perform required actions whenever a client downgrades his user addons
}
else if(type == "renewal")
{
// Write Deluge script to perform required actions whenever a client renews his subscription
}
else if(type == "frequency_change")
{
// Write Deluge script to perform required actions whenever a client changes his billing cycle
}
else if(type == "cancellation")
{
// Write Deluge script to perform required actions whenever a client cancels his subscription
}