Jump to content

Recommended Posts

Trello Workflow for Alfred App v.1.6

Source code: https://github.com/MikoMagni/Trello-Workflow-for-Alfred

39227510-2f4f80b8-4898-11e8-8e7f-89f5340

Install

  1. Double click on the "Trello Worklfow for Alfred v.1.6" workflow that you have just downloaded.
    More info: https://www.alfredapp.com/help/workflows/

Note: if you have version 1.5 installed, remove it before installing the new version.

Setup

  1. Generate your Trello Developer API Key
    Use the keyword "get trello key" to generate your Trello Developer API Key.
    More information: https://developers.trello.com/docs/api-introduction.

Note: Make sure to be logged in Trello in your default browser before generating your API Key.
39163817-68b8092a-47bb-11e8-939e-62cdfff

  1. Copy your API Key

  2. Authorize Trello Workflow
    Use the keyword "get trello token" plus your "API Key" to authorize the Trello Workflow to use your Trello account

Example: get trello token 00000000000000000000
More information: https://developers.trello.com/docs/api-introduction
39163856-985ceaba-47bb-11e8-8746-7025738

  1. Allow Trello Workflow to use your account

39164571-364a56b0-47bf-11e8-92f3-3c2a08f

  1. Copy your Token

  2. Your Trello board id
    Choose the Trello board that you wish to use with Trello Workflow and copy the board id
    You can get the board id by simply going to your board and add .json at the end of the URL.

Example: Go to the Trello developmemt Roadmap Board https://trello.com/b/nC8QJJoZ/trello-development-roadmap. To view the board id add .json at the end of the URL https://trello.com/b/nC8QJJoZ/trello-development-roadmap.json. You should now see the full JSON

{"id":"4d5ea62fd76aa1136000000c","name":"Trello Development Roadmap","desc":"","descData"

The board id in the example is: 4d5ea62fd76aa1136000000c

  1. Open the Trello Workflow for Alfred in Alfred app. Use the Keyword Alfred to Show Alfred Preferences. Navigate to Workflows and select Trello Workflow for Alfred v1.6 from the side column.

    39165421-86508e96-47c3-11e8-8f90-f06bc0a

  2. Double click on the /bin/bash script and enter your API Key, Your Token and your board id here:

    key='{YourAPIKey}'
    token='{YourPersonalToken}'
    boardid='{YourBoardId}'

    Click Save

    39165568-388c8448-47c4-11e8-9864-fc32d2e

Usage

  1. General usage trello {field} separate fields using ;

You can choose to have spaces or not between fields. For example {field1}; {field2} and {field1};{field2} will work.

Available fields: {Card Title}; {Card Description}; {Labels}; {Due Date}; {List Name}; {Card Position} 39163922-f2d0f252-47bb-11e8-9bba-4b53752

Basic Usage

Card Title

trello make dinner reservation

will create a card on your board on the first list with the title "make dinner reservation"

sdsd

sdsd

Card Description

trello make dinner reservation; table for 10 people at around 7:30pm

will create a card on your board on the first list with the title "make dinner reservation" and description "table for 10 people at around 7:30pm"

39225192-166199c8-488a-11e8-8f38-015befd

39226879-638a9a1a-4894-11e8-8449-2ae9f97

Labels

trello make dinner reservation; table for 10 people at around 7:30pm; blue

will create a card on your board on the first list with the title "make dinner reservation" and description "table for 10 people at around 7:30pm" with a "blue" label

Available Labels

  • all (will add green, yellow, orange, red, purple and blue)
  • green
  • yellow
  • orange
  • red
  • purple
  • blue

You can add more than one label by comma separating them.

trello make dinner reservation; table for 10 people at around 7:30pm; blue,red,yellow

Please note: Make sure not to have spaces between comma separated labels.
Custom labels are not supported. If you find a way let me know :)

39225416-6a59e25a-488b-11e8-8d0e-e7b6c2f

39226897-84c4c976-4894-11e8-84d2-c11daa3

39226930-b52e97ae-4894-11e8-92e3-37052ea

Due Date

trello make dinner reservation; table for 10 people at around 7:30pm; blue; 04/26/2018

will create a card on your board on the first list with the title "make dinner reservation" and description "table for 10 people at around 7:30pm" with a "blue" label. The due date will be set for 04/26/2018

39225889-2a305bf2-488e-11e8-82e2-4da85e9

39226946-e22d4368-4894-11e8-8071-f7b7874

List Name

trello make dinner reservation; table for 10 people at around 7:30pm; blue; 04/26/2018; Today

will create a card on your board on the list Today with the title "make dinner reservation" and description "table for 10 people at around 7:30pm" with a "blue" label. The due date will be set as 04/26/2018.

Please note: List name are case sensitive today will not work if your list is named Today.

The example will only work if you have a list named Today, otherwise, the card will be created on your first list.

39226075-44f065e4-488f-11e8-900c-b2474b7

39226084-57dd980c-488f-11e8-93a5-ebdf397

Card Position

trello make dinner reservation; table for 10 people at around 7:30pm; blue; 04/26/2018; Today; top

will create a card on your board on the list Today with the title "make dinner reservation" and description "table for 10 people at around 7:30pm" with a "blue" label. The due date will be set as 04/26/2018.

Note: If you don't specify a card position, your new card will automatically be placed at the end of the list.

Available options (case sensitive)

  • top
  • bottom

39225889-2a305bf2-488e-11e8-82e2-4da85e9

bottom

39226984-280ab73a-4895-11e8-9892-541213e

top

39226985-283cb2bc-4895-11e8-9939-1a4bcdb

Advanced Usage

You can skip any of the available fields by simply adding ;

{Card Title}; {Card Description}; {Labels}; {Due Date}; {List Name}; {Card Position}

For example if I wanted to post a card with Title, Label and a Due date i would use this syntax

{Card Title}; ; {Labels}; {Due Date}

trello Clean my car; ; red; 04/29/2018

39227249-c4188d86-4896-11e8-9697-eff3576

39227247-bef258aa-4896-11e8-8f2b-52e8e7d

Or a card with title only but on a different list

{Card Title}; ; ; ; {List Name}

trello Clean my car; ; ; ; Upcoming

39227342-4c118abc-4897-11e8-9486-4f008fd

39227333-3f9a37a2-4897-11e8-81ae-7089f22

 

Edited by Miko
New Version 1.6

Share this post


Link to post

Stopped by to say thanks, works great and how awesome the documentation is :)

 

 

Awesome!

 

Is there a way to choose to which Board the card is created to?

 

Yes, check the documentation (pdf in download) for installation and config details.

Share this post


Link to post

Stopped by to say thanks, works great and how awesome the documentation is :)

 

 

 

Yes, check the documentation (pdf in download) for installation and config details.

 

Excellent, thanks!

Share this post


Link to post

I really like this, but have a question about the board to which it posts. I have many different boards for different projects. Is it possible to link my overall Trello account and post to a particular board in that account? As of now I can only see how to post to a single board of many, although I do see how to send to a particular list in that board. Like it a lot, but it would be even more useful to select a board and a list name. (Of course, that may be impossible based on Trello's settings!)

 

Thanks.

Share this post


Link to post

This is super helpful, and appreciate the time and energy! If you're taking feature requests...it would be awesome to be able to add to a ToDo list, on a card, on a board. Not sure if Trello's API allows for that much?  Taking it even further...I have a board I use as a template, and it would be awesome to be able to create a new board from 'Copy Board' in Trello, and start adding to the To Do list I have associated with the template's first card. I know I'm asking a lot for nothing ;)

 

Thanks again for useful workflow!

Share this post


Link to post

Hello,

I can't make it work.

When I create a new card, I have the notification error "Warning : Invalid argument supplied for foreach(in) in Users/[myname]/Library/Appli..."

 

Is it due to the fact that my board is is not a number but a name?

 

Please help

Stephane

 

icon.png
Alfred for Trello (v1.0) - Download here (Github)
 
Use keyword "trello" to create a card in Trello.
 
Require a free account with Trello.com  <-- Recommend link or go to Trello.com
 
 
Usage

trello card name; description
 
Example:  trello Do work!; seriously, do work
 
Do work! Will be the Card title
seriously, do work Will be the Card description
 
Alternatively you can select any text and press "Option + Command + t" (or your custom hotkey) to create a card in Trello with the selected text.
 
 
Setup
 
Please refer to the included step by step instructions.
 
 
Credits
 
Tom Longo
Miko Magni
 
 
Screenshots 
 
workflow.png
 
alfred.png
 
notification.png
 
trello.png
 
description.png
 
 
Selected text to Trello card
 
select.png
 
 
notification2.png
 
trello2.png

 

Share this post


Link to post

Awesome workflow! I changed my shortcut in the workflow to show Alfred instead of passing through, so I can add a description to the selected text, if needed

Share this post


Link to post

Awesome workflow! I changed my shortcut in the workflow to show Alfred instead of passing through, so I can add a description to the selected text, if needed

Can you share it please? :)

Share this post


Link to post

Awesome Workflow!

 

I duplicated it several times for different boards. I have e.g: "prello" (private) and "wrello" (board I share with my co-worker).

Share this post


Link to post

Is there any way to switch the order of the variables? For example trello <title>; <desc>; <list>; <date>;

 

It's a small thing but it'd really speed me up.

Share this post


Link to post

Is there any way to switch the order of the variables? For example trello <title>; <desc>; <list>; <date>;

 

It's a small thing but it'd really speed me up.

 

I just did that.

 

You need to change numbers in square brackets in lines 25 and 27 in the 'script.php' file.

 

Something like that: http://bit.ly/1xQsmds

 

Works great.

Share this post


Link to post
Unable to make the list selection work. My message always goes to the first list of the board.

 

Please remember about the upper-/lower-case and don't put any spaces after the semicolon.

 

e.g.: trello A New Card;With Description;Today

 

Works for me.

Edited by Jacek

Share this post


Link to post

@Jacek Thanks a lot!

 

You are right. Apparently, spaces after semicolons were the problem.

 

Github documentation should mention spaces prevent the workflow to work correctly.

Share this post


Link to post

I am new to Alfred and this site. I have the 'Alfred' v2 and' Alfred for Trello' v1.5 releases running on Mac OS X Yosemite. I created a public Trello workflow and then installed 'Alfred for Trello'as instructed. The instructions currently state that one should select the "jello" button to setup the connection and receive the "token". Unfortunately that didn't work as expected. In fact, nothing was reported in the Notification window or elsewhere. I thought I saw a notice of an incompatibility with Notification (although it was partially blocked when I looked again), so I installed Growl and changed the preferences accordingly. Still nothing was reported when I again selected the "jello" button. Without the token I am unable to proceed with the configuration of 'Alfred for Trello' so now I am here.

 

Any suggestions as to how I should proceed?

Edited by jfeemster

Share this post


Link to post

Hello Miko, great workflow!

 

I'm with a problem on autorization.

 

When I type "jello" i go to the Trello website and don't give me the code.

 

What's wrong?

 

Tnks so much!

Share this post


Link to post

If both of you are getting the same issue, the Trello API may have changed?

 

Can anybody shed any light on this for these guys? (I don't use Trello)

Share this post


Link to post


I'm trying to use this workflow and yesterday I was using it just fine. However today I'm getting an error.
 

Quote

Warning: Invalid argument supplied for foreach() ...


The warning goes on to list a filepath but it's so long I can't see the actual end of the path, but my guess is it's pointing to the php file in the workflow folder. Here's that file's contents (see line 44 for the "foreach()"):
 

<?php
/* --------------------------------------------------------------------------------------
    Script:       Trello for Alfred
    Author:       Tom Longo
    Contributors: Miko Magni, cokeby190
    Usage:          trello <Card name>;<Card description>;<Label>;<Due Date>;<List Name>   
    Desc:          Adds card to trello
    Updated:      20/11/14
----------------------------------------------------------------------------------------- */
// API KEY: 1433c6977ccb78cd82e29a5455a24815
// https://trello.com/1/connect?key=[API_KEY]&name=[APP_NAME]&response_type=token&scope=read,write&expiration=never
// https://trello.com/1/connect?key=1433c6977ccb78cd82e29a5455a24815&name=Trello%20for%20Alfred&response_type=token&scope=read,write&expiration=never

$trello_key          = '1433c6977ccb78cd82e29a5455a24815';
$trello_api_endpoint = 'https://api.trello.com/1';
$trello_list_id      = false;
$data                 = explode( ";", $argv[1] );
$trello_member_token = $data[0];
$trello_board_id     = $data[1];
$name                  = (isset($data[2])) ? stripslashes(trim($data[2])) : 'Untitled card';
$desc                  = (isset($data[3])) ? stripslashes(trim($data[3])) : '';
$labels                 = (isset($data[4])) ? stripslashes(trim($data[4])) : '';
$due                  = (isset($data[5])) ? stripslashes(trim($data[5])) : '';
$list_name             = (isset($data[6])) ? stripslashes(trim($data[6])) : '';
$position             = (isset($data[7])) ? stripslashes(trim($data[7])) : 'bottom';    
$url                 = "{$trello_api_endpoint}/boards/{$trello_board_id}?lists=open&list_fields=name&fields=name,desc&key={$trello_key}&token={$trello_member_token}";
$ch = curl_init();
// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '25');
$content = trim(curl_exec($ch));
curl_close($ch);
$board = json_decode($content);
$lists = $board->lists;
$trello_list_id = $lists[0]->id;
    foreach($lists as $list) {
        if($list->name == $list_name) {
            $trello_list_id = $list->id;
        }
    }

    if($trello_list_id) {
    
        $ch = curl_init("$trello_api_endpoint/cards");
        curl_setopt_array($ch, array(
            CURLOPT_SSL_VERIFYPEER => false, // Probably won't work otherwise
            CURLOPT_RETURNTRANSFER => true, // So we can get the URL of the newly-created card
            CURLOPT_POST           => true,
            CURLOPT_POSTFIELDS => http_build_query(array( // if you use an array without being wrapped in http_build_query, the Trello API server won't recognize your POST variables
                'key'    => $trello_key,
                'token'  => $trello_member_token,
                'name'   => $name,
                'desc'   => $desc,
                'labels' => $labels,
                'due'     => $due,
                'idList' => $trello_list_id,
                'pos'     => $position
            )),
        ));
        
        $result = curl_exec($ch);
        $trello_card = json_decode($result);
        echo ($trello_card->url) ? '"'.$name.'" added.' : 'Error adding card.';
    
    } else {
        echo 'List not found';
    }

 
This morning I updated Mac OS with some small patch, and am currently on Sierra 10.12.4 ... my guess is something in this update broke something? Maybe? Any help here?

Share this post


Link to post
On 3/31/2017 at 12:51 AM, chcameron said:


I'm trying to use this workflow and yesterday I was using it just fine. However today I'm getting an error.
 

 

 

 

I have just posted an update that should fix your problem.

 

Please make sure to delete the old version before installing the new Trello Workflow. 

 

Follow the installation instructions and generate your API KEY and Token. 

 

Thanks, 

Miko

Share this post


Link to post

Hi there, 

Just letting you know I'm getting the error "Warning: Invalid argument supplied for foreach() in '{file path to my alfred preferences}'

I deleted the old version, and reinstalled and set up version 1.6 twice
Thanks for any help and all your hard work on this project, it looks super useful!

 

image.png.2289ab65225f898145a50581794022ca.png

Share this post


Link to post

Hi Gabrielle,

 

Did you generate your Trello Developer API Key and then authorised the workflow to work with Trello and entered the correct Board ID?

 

The only way that I was able to replicate the error was by entering the credential incorrectly. 

 

Make sure that each preference in the bash file is within '' example below 

 

key='00000000000'
token='0000000000000000000000000000000' 
boardid='0000000'
 

 

Share this post


Link to post

This is absolutely awesome! 
Juste something that would be nice to have is to be able to get back the whole instruction in case of error (it does happen a lot for me)...

 

What do you think of that @Miko?

 

Once again: nice job!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×