Skip to main content

-> Create a Listener

We're going to make the simplest possible listener - one that listens for movedCard event and logs out the name of the card that moved.

Adding a New Listener#

Navigate to the listeners page and click the "+" in the bottom right of the browser window.

Add a Listener

Name Your Listener#

Call this listener "myFirstListener". We know it's a bit weird that the first letter is lowercase and you can't have any spaces but it's just one of those things.

Give it a name

Choose "Trello" as the Listener Type#

You can also make a Listener that is a simple webhook but that's not what we're doing.

Choose the Trello type

Choose "Moved" as the Event Type#

We're going to be listening for cards being moved so we choose the "moved" event first.

Pick "moved" as the type of event

Choose "Card" as the Event Object#

Since cards are the only thing that can move on a Trello board, that's the only option.

Choose "card" the object for the event

We Generate Code for the Event#

To save you looking up the docs, we write the code to listen for the movedCard event. DO NOT include this code in your code again - we're just showing you so you know what to reference in your own code - the card object in this case.

Generated code

Log Out The Name of The Card#

We could do anything here - literally anything you can do in Trello or with javascript on the web - but instead we're just going to log out the name of the card we just moved.

Adding a console.log statement to log out the name of the moved card.

Choose Which Board to Listen To#

The boards your bot's Trello account is invited to will show up in this list. If the board you're looking for isn't here, make sure you have invited your bot to the board and also that you've logged into BenkoBot wih the right account.

Choose which board to listen to

Save It#

Save it.

Open the Detail View#

It might not be clear if this is your fist Listener, but the page you a directed to when you save is the list view showing all your Listeners. If you only have one then it is a list of one. You need to click the little "watch" icon to open the detail view of the Listener.

View the details.

Turn on Logging#

Like we did with the Action, we will need to toggle on logging so we can see the console.log statement we wrote. You'll need to open the developer tools Console too.

Turn on logging.

Marvel At The Outputs#

iWith logging already toggled on, go to the board your Listener is listening to and move a card from one list to another. After a short delay, you should see the name of the card logged to the console.

Marvel at the outputs.