{"id":43,"date":"2014-05-03T15:22:10","date_gmt":"2014-05-03T15:22:10","guid":{"rendered":"http:\/\/localhost\/syllogic\/wp\/?p=43"},"modified":"2024-02-01T15:41:24","modified_gmt":"2024-02-01T15:41:24","slug":"integrating-wp-project-management-plugin-with-gmail-tasks","status":"publish","type":"post","link":"http:\/\/localhost:10008\/integrating-wp-project-management-plugin-with-gmail-tasks\/","title":{"rendered":"Integrating WP Project Management plugin with Gmail Tasks"},"content":{"rendered":"\n

One of our favourite Project Management plugins for WordPress is the excellent WP Project Management<\/a> by Tareq Hasan.  The free version of the plugin gives the user a reasonable start and there are some neat commercial addons as well as a pro version of the plugin which offer more functionality.<\/p>\n\n\n\n

However, as a small developer team we have also been looking at improving its functionality within our working environment, and if, like us, you have a Google hosted email service for your domain, and rely on Google Drive for sharing documents then you will find our little integration with the Google Tasks<\/a> quite handy.<\/p>\n\n\n\n

Our Google Apps Script integrates into your Drive account, scanning your Gmail to look out for mails sent by the WP Project plugin when a new task or comment has been assigned to you.  The mail is scanned for the link to your worpress dashboard where you can view the details of the task or the comment.  The link is embeded (as a goo.ly shortened URL) into your Task title, allowing you to quickly see your latest tasks and loading them up in your browser with a single click.<\/p>\n\n\n\n

Here is what you need to do to get it to work…<\/p>\n\n\n\n

Get the Google Script<\/summary>\n
\"\"<\/a><\/figure>\n\n\n\n

Copy the following spreadsheet (Open the linked Google Spreadsheet, and go to the menu File->Make Copy in Google Drive). Once you have copy, you can save it (menu File->Move to Folder) under a specific folder in your Google Drive (Some place safe where it unlikely to get deleted by mistake). You can also rename it if you want.<\/p>\n<\/details>\n\n\n\n

Open the Script Editor<\/summary>\n

Open the new copy and select the menu Tools->Script Editor, \u201cCopy of Gmail Task Integration\u201d and note the following lines at the top of the Code.gs script file:<\/p>\n\n\n\n

TASKLIST = \u201cProjects\u201d;\nTASKPROJECT = \u201cOthers\u201d;\nLABEL_PENDING = \u201cProjects\/Tasks\u201d;\nLABEL_DONE = \u201cProjects\/Tasks\/Done\u201d;<\/code><\/pre>\n\n\n\n

The first line is the name to the task list under which your Google tasks links will be filed.<\/p>\n\n\n\n

The send line is the Project name in case it it not defined in the email (this is rarely the case\u2026).<\/p>\n\n\n\n

The third line is the gmail label under which the email will archived when they reach your inbox, and finally the fourth line is the gmail label to which the script will move the mails that have been converted into tasks.<\/p>\n\n\n\n

Feel free to change any of the above.<\/p>\n<\/details>\n\n\n\n

Accept Google API terms<\/summary>\n

There is a lot of freebies given by Google to use their services, but usually restrained with some quotas.  You need to accept these for the services uses in this script, namely the Tasks service and the URL Shortener service.<\/p>\n\n\n\n

In the Script Editor that you opened in the previous step, select the menu Resources -> Advance Google Services Switch and verify that the Tasks & URL Shortener serivces are \u2018ON\u2019 in the table that opens.<\/p>\n\n\n\n

At the bottom of the table open the link \u201cGoogle Developer Console\u201d, (you may be required to accept the terms of use of Google Apps Script in general if this is the first time you use it).\u00a0 Then find the Tasks API in the list make sure it is \u2018ON\u2019, if it \u2018OFF\u2019, click on the \u2018OFF\u2019 button to enable it, agree to all the terms. Repeat this for the URL Shortener API.<\/p>\n\n\n\n

\n

Note: you will now required to register a project with Google and setup a credit ard payment to access the APIs. Google still gives free access to a limited API calls each month, but requires you to setup a payment facility.<\/p>\n<\/div>\n<\/details>\n\n\n\n

Create a new version<\/summary>\n

Back to Script Editor screen, slect Menu File->Manage Versions and save a new version called \u201cMail Task Filter\u201d<\/p>\n<\/details>\n\n\n\n

Set Triggers for the script<\/summary>\n

Set up the triggers which will fire the script at regular intervals to check for new mails. In the Script Editor menu select Resources->Current Triggers<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

We set it up to run thrice-a-day, early morning in case we\u2019ve been working late into the night and want our office colleagues to see our new tasks when they get into office.<\/p>\n\n\n\n

Once at lunch time for morning session work, and finally one at the end of the day.  Again, it\u2019s quite self-explanatory so feel free to adjust it as per your needs.<\/p>\n<\/details>\n\n\n\n

Create Gmail filters & labels<\/summary>\n

Create filter & labels in your Gmail account.\u00a0 If you have changed the Script constants above in the script file Code.gs in the section \u201cOpen the Script Editor\u201d, then make sure you use those values.<\/p>\n\n\n\n

Create a labels:<\/p>\n\n\n\n