The customer cabinet is a section of your site where a client sees their orders, bonuses, bookings and tariffs and talks to the store. Mavi, the project's AI employee, can set the cabinet up and build automations on its events without opening the bot builder.

What Mavi can do

  • See the cabinet. Which modules are on, which events the cabinet sends to the bot, tariffs, services, registration fields.
  • Set the cabinet up from scratch. Give the site a short subdomain, switch the cabinet and the modules on, create the cabinet chat and the login button in the site header.
  • Switch events on and off for the bot scenario.
  • Build automations in one request. A block in the scenario that reacts to a cabinet event: writes to the client, creates a task for an employee, adds bonuses.
  • Create a store. An online store with a storefront, products and a cabinet.

Create an online shop with Mavi

If there is no site yet, a store takes one request. Example:

Create the online store «Demo Clothes» with two products: a T-shirt for $15 and a hoodie for $35

Mavi creates the shop with a storefront, a catalog and a footer, adds the products with prices and picks photos, gives the site a short subdomain and prepares the cabinet settings. The answer contains the store address. Then you can ask for descriptions, photos or delivery.

Mavi creates a store

How to switch the cabinet on

Text Mavi what cabinet you need. Example:

Switch on the customer cabinet in the store with orders, bonuses, abandoned cart and chat

Mavi gives the site a subdomain when it has no domain, switches the cabinet and the modules on, creates the cabinet chat and adds the login button to the header. The answer contains the cabinet address.

If there is no site yet, ask Mavi to create a store: it comes with a storefront, products and a cabinet.

Mavi switches the cabinet on

Cabinet events

The cabinet sends events to the bot: the client registered, logged in, placed an order, paid, spent or earned bonuses, abandoned the cart, delivery status changed, order cancelled, profile updated and more. Each event belongs to a module and arrives only when the module is on.

Events reach the scenario only when their toggle is on. The toggles live in the site settings, the «Customer cabinet» tab, «General» section, the «Events» card. Seil switches the needed events on itself when it builds an automation.

Event toggles

Main events:

Event When it arrives
cabinet_registered the client registered
cabinet_login the client logged in
cabinet_messenger_linked the client linked a messenger
cabinet_order_created the client placed an order
cabinet_order_paid the order is paid
cabinet_bonus_spent the client spent bonuses at checkout
cabinet_bonus_earned the client earned bonuses for an order
cabinet_order_stage delivery status changed
cabinet_order_cancelled the client cancelled the order
cabinet_cart_abandoned the cart was abandoned
cabinet_profile_updated the client changed the profile
cabinet_access_expiring tariff access is about to end
cabinet_request_stage a service request moved to another stage

Automations in one request

Describe what should happen on the event. Examples:

On registration in the cabinet add 200 bonuses and send a greeting with the balance

On an abandoned cart remind about the items with a link to the cart

On a paid order thank the client and create a task for the responsible employee to check the payment

On login add the label «Active» to the client

Mavi switches the event on and creates a block in the scenario with the event as its condition. The block carries the text for the client, the task or the bonuses, whatever you asked for. Several automations can go in one message.

Mavi builds automations

The block appears in the builder and can be edited like any other.

The block in the builder

What the client receives

The block's text goes to the client's linked messenger: Telegram, WhatsApp. Without a linked messenger the text arrives in the cabinet chat when the «Chat» module is on. Tasks, bonuses and labels work in any case.

Messages in the cabinet chat

Variables and functions in texts

Values you can insert into a block's text:

Variable Contents
#{callback_order_id} the number of the order or request the event is about
#{cabinet_bonus} the client's current bonus balance
#{bonus_applied} the balance after bonuses added in the same block
#{cabinet_cart_url} the link that restores the abandoned cart

Calculator functions for the cabinet

The functions work in any block of the scenario, in the calculator and in block conditions. Mavi picks them itself when it builds an automation, and you can write them by hand.

General rules:

  • Functions with a client_id parameter work with the client of the current dialog when it is empty. client_id looks at another client of the project, for example in a mailing.
  • Functions that change data (adding, spending, discount, journal) always work with the client of the current dialog.
  • When the client is not registered in the cabinet, numeric functions return 0 and text functions return an empty string.
  • Seil sees tariff and service ids in the cabinet. By hand they are in the site settings, the «Customer cabinet» tab.

Registration

Check whether the client has a cabinet

cabinet_registered(client_id) returns 1 if the client is registered in the site's cabinet, else 0.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog is checked

Example: the block condition cabinet_registered() == 0 lets through only clients without a cabinet, so the bot can offer to register.

Bonuses

Get the bonus balance

cabinet_bonus_balance(client_id) returns the client's bonus balance.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Example: balance = cabinet_bonus_balance(), then in the text You have #{balance} bonuses.

Add or spend bonuses

cabinet_bonus_add(amount, comment) adds bonuses to the client of the current dialog. A negative amount spends. The balance never goes below zero, so the function returns the amount actually applied, and spending more than the balance takes only what is there.

Parameter Description
! amount the amount. Positive adds, negative spends
comment the operation's caption in the client's bonus history. When empty, «By the bot scenario» is written

Returns the amount applied. 0 when the client is not registered or the amount is zero.

Examples:

  • cabinet_bonus_add(100, 'Welcome bonus') adds 100.
  • cabinet_bonus_add(-50, 'Spent on the order') spends 50.

Subscription visits

Get the visits left

cabinet_visits_balance(client_id) returns how many visits are left in the client's subscription pack.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Add or spend visits

cabinet_visits_add(amount, comment) adds subscription visits to the client of the current dialog. A negative number spends. Fractions are rounded to a whole number.

Parameter Description
! amount the number of visits. Positive adds, negative spends
comment the operation's caption in the visits history

Returns the amount applied.

Example: cabinet_visits_add(-1, 'Class attended') spends one visit after a booking.

Personal discount

Get the discount

cabinet_discount(client_id) returns the client's personal discount in percent. 0 when there is none.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Set the discount

cabinet_discount_set(percent) sets a personal discount for the client of the current dialog. The discount applies at checkout in the store.

Parameter Description
! percent the resulting discount in percent. 0 removes the discount

Returns the value set.

Example: cabinet_discount_set(10) gives a permanent 10 % discount.

Tariffs

Check a tariff

cabinet_has_tariff(tariff_id, client_id) returns 1 if the client has the tariff with this id active, else 0. A tariff whose access has expired counts as inactive.

Parameter Description
! tariff_id id of a cabinet tariff
client_id id of a project client. When empty, the client of the current dialog

Example: the condition cabinet_has_tariff(12) == 1 lets through only clients with tariff 12.

Get the active tariff

cabinet_tariff(client_id) returns the id of the client's active tariff. Empty when there is none.

cabinet_tariff_name(client_id) returns the name of the active tariff.

cabinet_tariff_until(client_id) returns the date and time when access by the tariff ends, as «YYYY-MM-DD HH:MM:SS». Empty when the tariff is unlimited or there is none.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Example: Your tariff «#{cabinet_tariff_name()}» is valid until #{cabinet_tariff_until()}.

Monthly operations quota

The quota is a monthly limit of operations set on a cabinet tariff.

Get the quota left

cabinet_quota_left(client_id) returns how many operations are left this month.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Returns what is left. −1 when the tariff is unlimited. 0 when there is no tariff or the limit is spent.

Consume quota operations

cabinet_quota_use(amount, client_id) consumes operations from the quota.

Parameter Description
amount how many operations to consume, a whole number. When empty, 1
client_id id of a project client. When empty, the client of the current dialog

Returns what is left after consuming. −1 when unlimited. 0 when there is no tariff or the limit is spent, in which case nothing was consumed.

Example: left = cabinet_quota_use(1), and when left == 0 the bot offers to renew the tariff.

Service requests

A request is a deal the client created in the cabinet through the «Services» module. Store orders and bookings are not counted.

How many requests are open

cabinet_requests_open(client_id) returns the number of the client's open requests.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Is there an unpaid request

cabinet_request_waiting(client_id) returns 1 if the client has an open request with a price that is not paid yet, else 0.

Parameter Description
client_id id of a project client. When empty, the client of the current dialog

Request status

cabinet_request_state(request_id, client_id) returns the status of a request: the funnel stage name, done for one closed successfully or cancelled.

Parameter Description
request_id the request number. When empty, the client's latest request
client_id id of a project client. When empty, the client of the current dialog

Returns an empty string when there is no request or no stage yet.

Example: in a block on the cabinet_request_stage event, state = cabinet_request_state(callback_order_id).

Client journal

Write an entry into the cabinet

cabinet_notify(title, text, url, var) adds an entry to the client's journal, the «Results» section of the cabinet. This is how the bot leaves the client a result, an instruction or a link that stays in the cabinet.

Parameter Description
! title the entry's title, up to 120 characters
text the entry's text, up to 4000 characters
url a link. Addresses with http, https or relative ones starting with «/» are accepted
var a custom journal variable. When empty, the entry goes to the cabinet's main journal

Returns 1 when the entry is written. 0 when the client is not registered or all three fields are empty. HTML is stripped from the title and the text.

Example: cabinet_notify('Request accepted', 'A manager will contact you today', 'https://example.com/faq').

Where to see what Mavi did

Changes to the cabinet and site settings are listed in «Assistant actions», where they can be reverted. Created blocks are visible in the builder and in the scenario's «Change history».

Good to know

  • An event arrives only when its module is on and its toggle is on.
  • «Mark as paid» in the order card gives the client the same events and bonuses as an online payment.
  • The block's text does not reach a client without a linked messenger and without the «Chat» module. Seil warns about it.

Example requests

  • Switch on the cabinet in the store with bonuses and chat
  • Which cabinet events are on?
  • Switch off the login event
  • On registration add 100 bonuses and say hello
  • On a paid order create a task for the manager to call the client tomorrow
  • When tariff access is about to end remind the client to renew
  • Create the store «Name» with products and switch on its cabinet