Global Counter (Get Values) - CodelessBot

What Does This Plugin Do?

Get the most up-to-date value of the global counter(s) from CodelessBot.

Level of Difficulty: Medium

Compatibility: Chatfuel

Plugin Request URL
  • Chatfuel:{{cbot_accesskey}}&secretkey={{cbot_secretkey}}
  • ManyChat:

Example Use Cases


Poll Your Audience

Ask a question and let users “vote” for their favorite.

Limited Spots for a Webinar

Only allow a certain number of users to register for a webinar or event!

Limited Discount Codes

Reveal the discount code only to those who are quick action-takers.

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.

ManyChat Instructions

After you download and installed the Quick Start Template...

  1. From the ManyChat sidebar, click on the Flows"
  2. Open the folder "CodelessBot Templates"
  3. Find the flow containing the name of this plugin. 
  4. Create a copy by click on the three dots icon on the right
  5. Then click on duplicate
  6. Feel free to rename this new flow and move it to a different folder
  7. Open up the flow and click on the "Starting Step" to modify the information you'll be sending to CodelessBot

For more details, refer to the Getting Started Guide.

Step 2. Create Global Counter in CodelessBot

Login to the CodelessBot and create a new Global Counter. (Already created your counter? Skip this step!)

  1. Login to the Member Portal
  2. On the left-hand sidebar, click on “Global Counters”
  3. Up in the top right, click on the button “New Counter”
  4. Enter in a name for the counter and a starting value
  5. Click “Save”

Step 3. Send information to CodelessBot

You’ll need to send CodelessBot the following information:


A comma-separated list of your CodelessBot global counter names.

More Detail

To find your global counter names, login to the CodelessBot Member Portal and from the sidebar, click on Global Counter.

You can list up to 10 global counters.


A comma-separated list of attributes to save the values.

More Detail

For example: value1, value2, value3

You can list up to 10 attributes

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.

ManyChat Instructions

a. Click over to the "Body" tab in this external request 

b. Next, copy and paste the code from the Plugin Wizard into the "Request Body". (Or you can enter the correct value by referring to the descriptions above.)

c. If there are any "Replace With placeholder" in the code, you'll need to replace them with the correct matching custom field by clicking on "Add a Variable".

d. To check if you set this up correctly, click on "Test the Request" on the right and you should get a success "200 OK" response

e. Click on the blue "Save" button

Step 4. CodelessBot will reply with the "answer"

CodelessBot will reply back with the following information:

Values for Global Counter will be automatically saved

The current values for the CodelessBot global counters will be automatically saved to the attributes that you listed in cbot_return.

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.

ManyChat Instructions

Finally, to save and make use of the results, you'll need to save the answer(s) from the CodelessBot to ManyChat custom field(s). To do this:

a. Click over to the "Response mapping" tab.

b. All the answer(s) are already listed for you under the first column "JSONPath". (For more detail about each one, see description above).

For each answer, select the ManyChat custom field you want to use to store the value from CodelessBot. Feel free to delete any that you don't need.

c. Click on "Save" when you're done. After this external request step, you can add a next step where you're:

  • Sending a message to share the results with users
  • Add a new Condition step to redirect users to a different step or flow depending on the result

More Information


1. What's the maximum number of counter values I can return in 1 request?

You can return up to 10 counters.

2. Are CodelessBot counter names case-sensitive?

Yes. CodelessBot counter names are always case-sensitive.

3. Can I return the counter value as any attribute name?

Do not use any attribute that starts with “cbot_rsp”. (e.g. cbot_rsp, cbot_rsp_counter1…etc)

4. How do I know which cbot_return attribute corresponds to which counter value?

The attributes will be paired with the counters in the exact same order in which they were listed for cbot_counters and cbot_return. For example:

  • If you set cbot_counters=counter1,counter2 and set cbot_return=attributeA,attributeB
  • Then attributeA contains the value for counter1…and attributeB contains the value for counter2.

5. What if I have spaces in my counter name?

For Chatfuel – Just enter in your counter name with the appropriates spaces.

For ManyChat – If you have spaces, we recommend that you use the plugin wizard to help you generate the code for the request body and JSON Path.

Enhance Your Bot with CodelessBot

CodelessBot plans start from $18/month