Search code examples
angularjsapitrello

Show alert on card,list or board created in trello


I have an trello api which retrives the card, list & board detail which is available on my trello using angularjs.

What my requirement is whenever i create or delete a card, list or board from trello account then a alert message should be shown with the particular name.

I have no idea what should i do.

  • Is there any trello api which shows the updated details for card, list or board?

  • If no then what whould be the solution for this query?


Solution

  • There are 2 main approaches you can do to achieve what you are hoping.

    1 - The Pull Method - Requests to the API You can pull a list of all the actions on all of the objects in the Trello API (lists, cards, boards, etc). You can then use this list to make decisions in your app to display alert messages based on the type of actions you are concerned about.

    The Trello API even has a handy "since" parameter that you can send through to only get any actions since a certain time, or even since your last check, to make the decision on what to show a little easier.

    You can send the requests as often as you wish to get potential data to create alerts. The time frame you do this can be anywhere from every 5 or 10 minutes, down to every 5 seconds for more real time notification.

    This is a rather clunky way to do things, and means you have to do a lot of calls to the API that result in no notifications. This is a sub-optimal way of doing things.

    But, this was the only method for accomplishing your goal until late 2013...

    2 - The Push Method - Using Webhooks In August 2013, Trello added the ability to create webhooks to their API. Webhooks allow you to create little triggers inside Trello that will let you know every time things change on their servers.

    Now instead of checking and checking and checking the API to see if anything has changed, you can create a webhook, then let your application sit back and relax until something changes. Trello will send out a request when it needs to, and you can trigger the appropriate alert in your application.

    Trello has some good documentation on how to create and manage your webhooks. Here are a few links I would suggest starting with:

    The announcement of the release of webhooks, along with a bit better description about what they are - http://blog.trello.com/webhooks-are-here/

    A nice getting started document on how to use Trello's webhooks - https://trello.com/docs/gettingstarted/webhooks.html

    The nitty gritty API doc on how to actually implement the specific calls with the API - https://trello.com/docs/api/webhook/index.html