Compare Number - CodelessBot

What Does This Plugin Do?

BETA
 
Compares the numeric value of an attribute against another attribute. You can check to see if an attribute is less than, equal to, or greater than another attribute.
 

Level of Difficulty: Medium

Compatibility: Chatfuel

 
Plugin Request URL
  • Chatfuel: https://api.codelessbot.com/v1/chatfuel/number/compare?accesskey={{cbot_accesskey}}&secretkey={{cbot_secretkey}}
  • ManyChat: https://api.codelessbot.com/v1/manychat/number/compare?accesskey=YOURACCESSKEY&secretkey=YOURACCESSKEY
Other Related Plugins

How-To Setup the Plugin

Follow the 3 Simple Steps...or Login to CodelessBot to access the Plugin Wizard!

Step 1. Download & Install the Quick-Start Plugin Template

Login to CodelessBot, navigate to Templates on the sidebar and download the Quick-Start Template. Follow the prompt to install the Template. Next, you'll need to create a copy of the template for this specific plugin. See and follow the instructions below.

(If you've already install the Quick Start Template and created a copy of the plugin template - skip this step!

Chatfuel Instructions

a. From your Chatfuel dashboard, open the new bot called "JSON API Tutorial & CodelessBot Template" 

b. Find the group containing the name of this plugin.

c. Click on the arrow next to the plugin name to clone this group and blocks from the template into your own Chatfuel Bot.

d. Navigate back to the Chatfuel Dashboard

e. Open your Bot and find the new plugin group that you just cloned. 

f. Open the new Plugin block and enter in your CodelessBot access key and secret key.

Tip: Rename the plugin block to something more meaningful. For more details, refer to the Getting Started Guide.

Step 2. Send information to CodelessBot

To quickly do this, use the Plugin Wizard to answer a few questions. It'll then generate the code with the information below for you to copy and paste into your bot.

cbot_item1

The first number you want to compare.

cbot_operator

The type of number comparison you want to perform.

More Detail

Valid values are: =, >, >=, <, <=

cbot_item2

The second number you want to compare.

Chatfuel Instructions
  1. In this plugin block, scroll down to the "JSON API" card
  2. Copy and paste the code from the Plugin Wizard into the textbox. (Or you can enter the correct value by referring to the descriptions above.)

Tip: Make sure the "Send as" is set to JSON. Not URL encoded or Full JSON Profile.

Step 3. CodelessBot will reply with the "answer"

CodelessBot will reply back with the following information:

cbot_rsp

The value true or false depending on the result of the comparison.

Chatfuel Instructions

After the JSON API card, you can add additional Chatfuel cards to:

  1. Send a message to the user with the result
  2. Add a new card "Go To Block" with a condition to redirect users to a different blocks depending on the result

Note: These are just some ideas. You are not limited by the 2 ideas above.

More Information

FAQs

1. How should the relationship between cbot_item1, cbot_item2, and operator be interpreted?

Read it as item1 [operator] item2. So for example, item1 = item2 — is this statement true or false?

2. What is the min/max number that can be compared?

This comparison was NOT designed for scientific purposes and should be limited to common, every day comparisons. Whole numbers can safely be compared with a min/max value of +/- 9,007,199,254,740,991. When comparing numbers with decimals, do not use numbers with more than 5 decimal places and more than 12 significant digits otherwise the results may be unexpected. Here’s some very specific examples:

  • The plugin can determine that 99999999999999999.99999 is greater than 5
  • But it CANNOT determine that 99999999999999999.99999 is greater than 99999999999999999.99998

CodelessBot can reliably determine that 9999999.99999 is greater than 9999999.99998

Enhance Your Bot with CodelessBot

CodelessBot plans start from $18/month