Alexa Shopping list items to TickTick

Update: IFTTT has native TickTick support now.
Just visit https://ifttt.com/ticktick

Since Wunderlist is shutting down it's service a lot of users might search for a new shopping list app. For us TickTick was the best fit....but it doesn't offer an Alexa skill for every language - only english.

While I'm writing this blogpost in English my Alexa at home is talking in German.

In theory it should be possible to use the Wunderlist IFTTT applets and just send the email to TickTick instead of Wunderlist. I didn't have success with Gmail on IFTTT at all. No matter what I did, IFTTT always said "There was a problem with the Gmail service". So there seems to be a problem between IFTTT and Gmail which isn't Applet related.

So I looked for an alternative which could be: Alexa => Google Spreadsheet => TickTick

The technical view on this is: Alexa => IFTTT => Google Spreadsheet => Google Apps Script => Gmail => TickTick

In order to configure this you need to setup the IFTTT applet called "Add new items on Alexa Shopping List to Google Drive spreadsheet". The applet settings can all stay default. It needs permissions for Alexa and Google Spreadsheets.

After that add a new item to the Alexa shopping list. This should create a new spreadsheet in your Google Drive called "Alexa Shopping list".

Go to Google Drive and open the spreadsheet. Go to Tools => Scripteditor and insert the following Google Apps Script.
Set the ticktick_address to your individual address you can find in your TickTick settings.
If you want the new items to be added to a specific list then set ticktick_list accordingly. The names must match exactly. Otherwise leave it empty to add new items to the Inbox.

function sendToTickTick() {
  ticktick_address = 'todo+abc@mail.ticktick.com';
  ticktick_list = 'Shopping';
  
  var lock = LockService.getScriptLock();
  doc = SpreadsheetApp.getActiveSpreadsheet();
  rows = doc.getDataRange().getValues();  
  for (var i = rows.length; i>=1; i--) {
    var item = rows[i - 1][2];
    if (ticktick_list) {
      subject = item + ' ^' + ticktick_list;
    } else {
      subject = item;
    }
    var body = '';
    GmailApp.sendEmail(ticktick_address, subject, body);
    Logger.log('Added item: ' + item);
    doc.deleteRow(i);
  }
  lock.releaseLock();
}

function createSpreadsheetChangeTrigger() {
  var doc = SpreadsheetApp.getActiveSpreadsheet();
  ScriptApp.newTrigger('sendToTickTick')
      .forSpreadsheet(doc)
      .onChange()
      .create();
}

Once the script is edited save it and give it a name. The name doesn't matter. After that click on Execute => function => createSpreadsheetChangeTrigger

This will install an App trigger which fires whenever a new item gets added.

Now add another item to the Alexa shopping list. It should get added to the TickTick list and get automatically removed from the spreadsheet as well. You can see the script logs in the Apps Script Console.

You will get a copy of every email. It's possible to delete those automatically with an Gmail filter for the To: address which is your TickTick email address.

Future

TickTick is currently working on it's public API and also native integration for IFTTT and other services. Once it's ready workarounds like this or email based integrations in general are not needed anymore. Hopefully this will be ready soon, even though it's kind of fun to build stuff like that ;)

Schreibe einen Kommentar