Jump to content

Trello Workflow 1.6.1 [Updated 16/07/18]


Recommended Posts

Trello Workflow for Alfred App v.1.6.1

Create cards in Trello using Alfred App https://www.alfredapp.com/

Download Trello WorkFlow 1.6.1

Install

  1. Double click on the "Trello Workflow for Alfred v.1.6.1" 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

  2. Copy your API Key

  3. 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
    39280550-2a5bdb0e-493f-11e8-96de-81a64ce

  4. Allow Trello Workflow to use your account

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

  5. Copy your Token

  6. 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

  7. 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

  8. 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}'

    Make sure that each preference in the bash file is within single quotes:

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

    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 as 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

Environment Variables by @gamell

Given that some might want always to create the cards on the same list, or with the same label, or same due date, or same position by default, I added the ability to set those defaults via the environment variables trello.list_name, trello.label, trello.due and trello.position.

One can conveniently add or edit those environment variables without programming knowledge through the Alfred Workflow editor, clicking on the [x] button on the top right (see screenshot below).

Note: If you don't set the variable, the workflow will behave as it did before.

44072791-96f57f66-9f45-11e8-9dbc-399744c

44072799-9d4107b4-9f45-11e8-9444-4d71f7f

FAQ

Coming soon

License

MIT © Miko Magni

Edited by Miko
New Version 1.6.1
Link to comment

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.

Link to comment

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!

Link to comment
  • 4 months later...

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

 

Link to comment
  • 3 months later...
  • 3 months later...
  • 3 months later...
  • 6 months later...
  • 3 weeks later...
  • 1 month later...

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
Link to comment
  • 1 year later...
  • 9 months later...


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?

Link to comment
  • 1 year later...
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

Link to comment
  • 4 weeks later...

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'
 

 

Link to comment
  • 2 months later...

First of all, thanks to @Miko and co. for this amazing workflow.

Just wanted lo let you all know that I made a small change to it to allow users to set defaults via environment variables for List, Label, Due date and Position. So, for example, if you want to always create your cards in the same list as I do, you can set it once and forget it. If you pass any list via the query, that will override the default as expected.

You can find this version here.

And I also opened a Pull Request to get this functionality in the original workflow by @Miko , which also has some instructions as to how to set the defaults.
 

Thanks!!

Link to comment

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
×
×
  • Create New...