Editorial Workflows

Publish to ExpressionEngine

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: This workflow is based on the Post to WordPress workflow (linked below) and modified to work with the ExpressionEngine MetaWeblog API implementation.

It takes a Editorial document, allows you to customize/create a title (defaults to file name), choose a category (fetched from EE), and then publish your new entry to ExpressionEngine.

See the two Python scripts in the workflow and customize them with your API endpoint, including the ExpressionEngine Channel you want to publish to.

Shared by: http://eeinsider.com/blog/publishing-to-expressionengine-from-editorial

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
cats
Value
Check Title ?
Title
Double Check Title
Initial Text
File Name%cursor
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
postname
Value
Input
Document Text ?
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
doctext
Value
Input
Set Variable ?
Variable Name
content
Value
Input
Get ExpressionEngine Categories ?
Source Code
import xmlrpclib
import workflow
import pickle
import keychain
import console

categories = workflow.get_variable("cats")
ee_url = "" # Place the Metaweblog API URL here. You can find in EE in the Metaweblog API module settings.
ee_blogid = ""

# keychain.delete_password('expressionengine', 'editorial')
login = keychain.get_password('expressionengine', 'editorial')

if login is not None:
	ee_username, ee_password = pickle.loads(login)
else:
	ee_username, ee_password = console.login_alert('Please login', 'No login credentials found in keychain.')
	pickle_token = pickle.dumps((ee_username, ee_password))
	keychain.set_password('expressionengine', 'editorial', pickle_token)


console.show_activity('Fetching categories...')
 
server = xmlrpclib.ServerProxy(ee_url, allow_none=True)
 
cat = server.metaWeblog.getCategories(ee_blogid, ee_username, ee_password)

i = 0
for x in cat:
	categories += '\n' + x['categoryName'] + "	" + str(i)
	i = i+1
	workflow.set_variable("cats", categories)
console.hide_activity()
Generate Text ?
Text
cats
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Choose Category ?
Title
Categories
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
ON
Set Variable ?
Variable Name
catID
Value
Input
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Publish To ExpressionEngine ?
Source Code
import xmlrpclib
import workflow
import pickle
import keychain
import console

categories = workflow.get_variable("cats")
ee_url = "" # Place the Metaweblog API URL here. You can find in EE in the Metaweblog API module settings.
ee_blogid = "1"

#keychain.delete_password('expressionengine', 'editorial')
login = keychain.get_password('expressionengine', 'editorial')

if login is not None:
	ee_username, ee_password = pickle.loads(login)
else:
	ee_username, ee_password = console.login_alert('Please login', 'No login credentials found.')
	pickle_token = pickle.dumps((ee_username, ee_password))
	keychain.set_password('expressionengine', 'editorial', pickle_token)

status_draft = 0
status_published = 1

console.show_activity('Opening connection...')

server = xmlrpclib.ServerProxy(ee_url)
 
title = workflow.get_variable('postname')
content = workflow.get_variable('content')

cat = server.metaWeblog.getCategories(ee_blogid, ee_username, ee_password, 'category')

cat_nb = workflow.get_variable("catID")
 
categories = [cat[int(cat_nb)]['categoryName']]

data = {'title': title, 'description': content, 'post_type': 'post', 'categories': categories}

console.show_activity('Publishing...')
 
post_id = server.metaWeblog.newPost(ee_blogid, ee_username, ee_password, data, status_published)
 
post_infos = server.metaWeblog.getPost(post_id, ee_username, ee_password)

console.hide_activity()
 
# print post_infos['link']
# clipboard.set(post_infos['link'])

console.hud_alert('Post published', 'Success', 1.0)
workflow.set_output('Success')
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Success
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
http://yoursite.com
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON
…End If