What is an operation block?
This block allows us to perform arithmetic operations and display the result during the chat session. Operation block can also be used to calculate the values retrieved from the block variable, local variable, and global variable.
For example, a user has placed an order in the Zylker Grocery store and has added various items. At the end of their purchase, they would expect to see the total bill amount. GC does this through the operation block by using mathematical operations such as addition, subtraction, multiplication, or division to calculate it.
For example, if a user places a bulk order at the Zylker Electronics online store, you can calculate and display the total cost based on the price of a single item. GC does this through the operation block by using mathematical operations such as addition, subtraction, multiplication, or division to calculate it.
Why use an operation block?
Streamline the process by automatically performing arithmetic operations, reducing the need for manual input or external tools in your bot.
Provides immediate results for operations like bill calculations, discounts, or conversions, improving user satisfaction to the end-user.
Speeds up interactions by handling complex arithmetic directly within the conversation, saving time for both users and support agents.
Minimizes the risk of human error in calculations, ensuring accurate and reliable data processing.
Steps to create an operation block
To add the Operation block to the flow:
1. Click the add block icon (+)
2. Choose Operation under the Action Cards section.
3. Add a unique name for the block in the Block name field.
If you input the name of a block that already exists, the following error message will appear.
4. Enter or choose the required combination of integers, variables, and functions in the Expression field.
You can either type or choose the arithmetic expression. You can also make arithmetic expressions using the created variables. 5. Enter an appropriate error message in the Error Message field, or proceed with the given error message.
You can either proceed with the given error message or change it, if required. This message will be showcased to the end-user if the given expression fails to give the solution for the added arithmetic expression during the end-user conversation.
The displayed variables for selection can involve block variables, local variables, global variables, and session variables that are in the form of numerals.
6. Click Save.
7. Publish the flow.
If you try to close the block listing without saving the text block, all the unsaved changes will be lost permanently. Steps to edit an operation block
You can edit an operation block whenever required, even after the flow is published or in the drafts section, by following these steps:
1. Open the flow and click Edit.
2. Click the Operation Block, which you may have named differently.
3. Choose Edit Block from the displayed options.
4. Make the required changes to the block and click Save.
5. Click Save.
6. Publish the flow.
To be noted while editing an operation block:
- If you edit a block while an end user is engaged in a live session with the bot, the previous version of the flow will be rendered until they restart the conversation.
- After making changes, you will need to publish the flow for those changes to be reflected in an end user's session.
- If a change is made to an input variable, it will be updated automatically across all flows where the variable is used.
Steps to copy the operation block
The copy block option can be used when you need to reuse a block that you previously created; you can copy that block and add it to your flow as it is or edit it according to the requirement.
1. Click the Operation Block you wish to copy.
2. Choose the Copy Block option. The block will be pasted on the clipboard.
3. When you require to paste that block, click the Add block icon (+).
The pasted block would appear on the block listing section and be stated as From Clipboard.
4. Make any required edits, then click Paste.
To be noted while copying an operation block:
- The copied operation block can be pasted multiple times. If you no longer need to paste it, you can clear the clipboard by clicking the close icon corresponding to the clipboard option.
- When copying an existing operation block, all of its content, including any variables, will be copied as is. You can edit it as needed before adding it to the flow. Since the names of each block must be unique, the word '_copy' will be added to the copied blocks automatically; this can be changed if required.
- If you have copied a block and it is in the clipboard, deleting the copied block later will also remove it from the clipboard.
Steps to delete an operation block
1. Open the flow and click Edit.
2. Click the Operation block, which you may have named differently.
3. Select Delete Block from the displayed options.
4. Click Yes, Delete it to confirm.
You can use the undo option to restore a deleted block as your following action, but not otherwise.
5. Click Save.
6. Publish the flow.
If the deleted block has dependencies, such as those given below, errors will be displayed.
Path below the block:
If the block was used to jump to a different flow:
Use case
A user is purchasing tickets for two people through a chat bot available on Zylker Cinemas website. They want to know the total price to pay and book the movie tickets.
Input given in GC:
Here, the variable, which is the number of the tickets, is supposed to multiply with the cost of one ticket, which is $20.
GC output:
Supported channels
The operation block is supported in the following channels:
- WhatsApp
- Telegram
- Facebook Messenger
- LINE
- Instagram
- Business Messaging
A total of 500 blocks can be added in a flow. If you reach that count, you can use the jump block to create a new flow or delete unnecessary flows.