Tutorial: Alerts
Let's learn how to create alerts.
Usecase: Send New Card Alert
Sometimes you'll want to know when a new card is created, especially when it's related to a topic you're interested in.
Let's walk through how to send alerts when a new card has a trigger word in its name. We'll be using:
- Event triggers
- The Gmail app connector
First, we'll paste in the following code:
import gmail_app
import trello_app
# SETUP 1: Sign in with Gmail.
# SETUP 2: Replace the interesting term with what you want to monitor.
# SETUP 3: Enter an email address to send alerts to.
interesting_term = "cats"
email = "ENTER_EMAIL_TO_SEND_ALERT_TO"
# when a new card is added...
def on_create_card():
# get the current card
card = trello_app.get_current_card()
# if term is in the name, send an alert
if interesting_term in card.get_name().lower():
gmail_app.send_message("Someone mentioned %s in %s" %
(interesting_term,
card.get_field("url")), email, "Trello Alert")
Follow the setup steps, as outlined in the script:
- Sign in with Gmail.
- Replace "cats" with your own interesting term.
- Enter you email address.
You can see in the script, on each new card, we'll get that card's information, check if the term is in the name, and if so, send an email using our Gmail account.
Need Help?
If you run into any issues, or what to chat with others, connect to the Blockspring community right from the Scripts editor.
Updated less than a minute ago