Countdown - CodelessBot

What Does This Plugin Do?

This plugin will send back the time remaining until a specified date and time.

Level of Difficulty: Medium-Hard

Compatibility: Chatfuel, ManyChat

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

Example Use Cases

Until End of Promotion

Remind users about the time remaining until the end of a promotion.

Until an Event

Remind users about the time remaining until an event (such as a webinar) starts!

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. 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_timezone (Option 1)

A specific timezone from the list of IANA timezones.

More Detail

You’ll need to send CodelessBot the IANA timezone. Which can be found on Wikipedia at Use the values from column TZ. Example values are Africa/Abidjan, America/New_York, Europe/London.


The target date you want to countdown to.

More Detail

The format of the date must be YYYY-MM-DD hh:mm:ss
e.g. 2019-12-30 13:30:00 for Dec 30th, 2019 at 1:30 PM

You must provide the leading zero for all dates and times that are a single digit. For example this is incorrect:
2019-1-1 0:0:0

timezone (Option 2)

The user’s timezone as set by the bot platform.

More Detail

You’ll need to send CodelessBot the user’s timezone. For Chatfuel, you can use the system attribute “timezone”.
For ManyChat, you’ll need to send the timezone custom field.

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 3. CodelessBot will reply with the "answer"

CodelessBot will reply back with the following information:


The text representation of the complete countdown. e.g. 45 days, 2 hours, 30 minutes, 7 seconds


The numeric value representing the hours. e.g. 2


The numeric value representing the seconds. e.g. 7


Numeric value representing the number of days. e.g. 45


The numeric value representing minutes. e.g. 30

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. Can I get the count down as a single specific unit of time such as seconds?

Unfortunately, no. The days, hours, minutes, and seconds all work together to represent the combined time until a certain date and time.

If you only wanted the total countdown represented by a specific time unit such as seconds, you would need to calculate that yourself using all the information provided to you.

2. How do I set a value like "2020-03-28" in Chatfuel without the time?

Unfortunately you can’t. If you try, Chatfuel will perform the math operation of 2020 minus 3 minus 28 which is not what you want.

With Chatfuel you must include the the hours, minutes, and seconds (each separated with colons) to ensure that it’s properly formatted. eg. “2020-03-28 00:00:00”.

3. What happens after the target date has passed?

The countdown will reach zero and all units of time will return the value 0. It will remain at this value indefinitely.

You will NEVER get a negative number as a countdown.

4. Does this plugin take daylight savings into account?

It depends. CodelessBot needs to know the exact city in order to determine whether they observe daylight savings or not!

If you are using IANA timezone (Option 1), then yes. The calculation will take daylight savings into account since the city is provided to CodelessBot.

If you are using the timezone as set by ManyChat or Chatfuel (Option 2), then no. This is because a generic time is provided and the city is unknown. As mentioned previously, to accurately calculate the countdown, CodelessBot needs to know the exact location to determine whether to take daylight savings into account!

For example, someone in Utah or Arizona will share the same Chatfuel and ManyChat timezone (UTC -6) (Option 2). Meaning, at a various points throughout the year, they share the exact same time of day. However, Arizona does not observe daylight savings so the countdown might be different depending on the time of year!

5. How accurate is the countdown?

The countdown using IANA timezone (Option 1) will always be accurate.

The accuracy of User timezone (Option 2) will depend on the information provided by Chatfuel/ManyChat and whether a change in daylight savings occurs from the time you call CodelessBot and the target date.

Whenever possible, we strongly recommend that you use an IANA timezone (Option 1).

Enhance Your Bot with CodelessBot

CodelessBot plans start from $18/month