Import Evernote notes into Drupal with the Devernote module

Tags: 

Following is an introduction to the Devernote (Drupal Evernote) module and how to use it. The module is available on github at: https://github.com/akempler/devernote

A lot of journalists and bloggers I work with use Evernote, myself included. My current workflow has been to write posts in Evernote and copy and paste them into Drupal.

I wanted an easy way to import specific notes. After a bit of googling I found two potential modules:

The Evernote module:https://www.drupal.org/project/evernote. Unfortunately this never got past a beta 6.x version.

There was also the Feeds Evernote module:https://www.drupal.org/project/feeds_evernote. This never got past a dev version, last updated in 2013.

Even though this was initially for myself, I wanted it to be multi-user since many of the tools I build are for newsrooms. It needed to allow each user to work with their own accounts and notebooks. Thus was born the Devernote module (Drupal Evernote). This module makes it super easy to tag notes for import in Evernote and bring them into Drupal, including any images that were embedded.

Using the Devernote module

Evernote API Key:

First you'll need to get an Evernote API key to use the module on your site. You need this to allow the module to read your Evernote notes. Go to:https://dev.evernote.com/doc/ and click "GET AN API KEY". This is a two step process. Once you get your api key, you will need to request that it be made available for production use. Initially, the keys are just for use on their sandbox site.

Composer:

The Devernote module uses some third party libraries such as the Evernote SDK and Guzzle. These are installed and managed via Composer. Labeled as a dependency management tool for PHP, you can think of Composer as a much improved version of the Pear package library. It gives you access to a wide variety of libraries and tools to include in your Drupal modules.

Composer Installation:

You can install Composer locally per project or globally. I prefer globally: CD into your home directory and run:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

This will download the composer.phar file to your home directory and then move it to your bin to make it globally accessible. Now you can just run the command:

composer [command]

For more information on Composer see:https://getcomposer.org/doc/00-intro.md

Composer Manager Module:

One of the best ways I've found to use Composer in Drupal 7 is with Composer Manager: https://www.drupal.org/project/composer_manager

This module will combine all the composer.json files from any modules using Composer into a single file in your files directory. You would then run composer install from you sites/default/files/composer (or whatever path your files directory is). See the module page for more information.

Encrypting the oauth token:

When you import Evernote notes via the module, you will first be redirected to Evernote to authenticate and authorize the connection. An oauth token will be returned, saved to the database and used for subsequent connections. If either the aes or encrypt Drupal modules are installed, the token will be stored encrypted. This is recommended but not required. I use the aes module but if you already have the encrypt module enabled you can use that instead.

https://www.drupal.org/project/aes

https://www.drupal.org/project/encrypt

Install the Devernote module:

https://github.com/akempler/devernote

The Composer Manager module recommends enabling modules containing composer.json files using drush:

drush en devernote

This will automatically generate the consolidated composer.json file and run the appropriate Composer commands. You can also manually enable them by cd'ing to the composer directory containing the composer.json file. For example: /sites/default/files/composer/composer.json. You can check what it is set to by going to: /admin/config/system/composer-manager/settings. By default it is public://composer. Once in that directory you can run composer install --no-dev. Change install to update to update the dependencies. See this page for more info on Composer Manager: https://www.drupal.org/node/2405805

Configuration:

Configure the module at: /admin/config/content/devernote

Here you can specify some defaults for importing notes including the ability to specify a image style to automatically apply to imported images. You'll also need to enter the Consumer Key and Secret Key you received when registering for an Evernote API Key.

Importing:

To import notes, tag them with "drupalimport" in Evernote (you can also use your own custom tag and specify it during the import process). Then go to the import form at /devernote_import and click "import". Any notes with that tag will be imported. You can specify what content type to create during the import process.

Once a note is imported, it will be ignored during future imports. To re-import a note, Delete the node that was created. It will then be imported the next time you run the import.

Server Requirements

The Evernote PHP SDK requires the XSLTProcessor Class so you'll need the php xsl extension installed and enabled if it isn't already. On Ubuntu:

sudo apt-get install php5-xsl

The aes module requires the mcrypt extension. For Ubuntu:

sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service php5-fpm restart
sudo service nginx restart

NOTE: the multi-user functionality still needs to be implemented.

Comments

Will you port to D8?

Is this module still usable today? Will it be ported to d8?

thanks
Lee

I haven't tested it since the past few Evernote updates. I will make sure everything still works this weekend. As for d8, yes I do intend to port it but I don't have a specific timeline yet. It will likely be a couple of months until I get to that.

I've just tested it on a clean Drupal 7 deploy with the most current evernote sdk and pushed a few fixes to github (as well as updates to the documentation). Everything seems to work fine. As for d8, I hope to give it a try in the next couple of weeks.

Add new comment

By submitting this form, you accept the Mollom privacy policy.