DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autotweet

AutoTweet Plugin

Compatible with DokuWiki

2011-05-25, 2012-01-25, 2013-12-08, 2014-05-05

plugin The autotweet plugin automatically posts tweets to your Twitter App when specific pages are changed.

Last updated on
2011-10-06
Provides
Syntax, Action
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with changelog, feed, twitter

This plugin automatically posts Tweets to your Twitter via the oAuth authentication protocol when specific pages are changed.

You can specify which page updates are sent, by including the ~~AUTOTWEET:~~ syntax in these specific pages.

The plugin uses the Abraham Williams abraham [at] abrah [dot] am OAuth for Twitter PHP Library.

Requirements

cURL Extension

:!: Important :!:
It is mandatory that you have installed the cURL Extension for PHP.

You can check if the extension is installed using the following code:

<PHP>
if ( function_exists('curl_init') ) {
  echo 'cURL is installed';
}
else {
  echo 'cURL is NOT installed';
}
</PHP>

Twitter App

The plugin communicates with Twitter using the oAuth authentication protocol. This protocol requires authentication keys that you will get by setting up a Twitter App.

Step 1: Setup Twitter App

Head to Twitter and set up an application.

:!: Important :!: Make sure you selected “Read & Write” acces.

Step 2: Get the security parameters

Once you've created your Twitter application get the parameters for authentication.

Parameter Comments
'Consumer key' This is displayed in the section oAuth.
'Consumer secret' This is displayed in the section oAuth.
'Access token' This is displayed in the section Your access token.
'Access token secret' This is displayed in the section Your access token.


These parameters must be used in the configuration of the plugin, so that the plugin can communicate with Twitter. Optionally, you can use syntax parameters to specify alternate Twitter Apps for specific pages. This, however, is optional.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

How it works

If you wish to track changes for a specific page, add the ~~AUTOTWEET:~~ syntax to that page.

If a page containing the ~~AUTOTWEET:~~ syntax is edited, the change_log information is used to assemble a message, which is then forwarded to the configured Twitter App as a Tweet.

Examples/Usage

~~AUTOTWEET:~~

If you wish to use alternate Twitter Apps for specific pages, you can optionally add syntax parameters.

~~AUTOTWEET:consumer_key=<consumer_key>&consumer_secret=<consumer_secret>&access_token=<access_token>&access_token_secret=<access_token_secret>~~

Syntax

You can use the parameters to overwrite the configuration settings for specific pages. This is not normally necessary.

~~AUTOTWEET:key=value&..key=value~~

key the parameter key to set optional
value the parameter value to set optional

You can set more than one element at once by using an & delimiter.

Available parameters:

Key Type Comments
consumer_key string Consumer Key of the Twitter App. Overwrites configuration parameter 'consumer_key'. optional
consumer_secret string Consumer Secret of the Twitter App. Overwrites configuration parameter 'consumer_secret'. optional
access_token string Access Token of the Twitter App. Overwrites configuration parameter 'access_token'. optional
access_token_secret string Access Token Secret of the Twitter App. Overwrites configuration parameter 'access_token_secret'. optional

Note: Normally you would use the same settings for all pages, in which case the syntax ~~AUTOTWEET:~~ is sufficient.

Default usage:

~~AUTOTWEET:~~

Configuration and Settings

Key Type Comments
consumer_key string Consumer Key of the Twitter App. required
consumer_secret string Consumer Secret of the Twitter App. required
access_token string Access Token of the Twitter App. required
access_token_secret string Access Token Secret of the Twitter App. required
message_template string Message template that will be filled out and used to send a Tweet to the Twitter App. required
date_format string Date format of the {date} field used in the message template. required


Message Template

For convenience you can change the formatting of the tweet sent to Twitter via the 'message_template' configuration parameter. The fields in the message will be replaced by the plugin.

Default:

{type} {page} - {summary} {user}

Example (including link to the page):

{date} {type} http://www.dokuwiki.org/{page} - {summary} @{user}

Template fields

Tag Comments
{type} Type of edit (Create, Edit, Minor Edit, Delete or Revert)
{date} Date of the last change. The format can be setup via Configuration and Settings
{page} ID of the page
{summary} Summary of the editor.
{user} User name of the user editing.
{extra} Extra data, used for storing the revision (timestamp) in the case of a revert.

Development

Change Log

Known Bugs and Issues

  • 2014-05-27: Change twitteroauth.php from 1 to 1.1 and it works with latest dokuwiki-release 2014-05-05 “Ponder Stibbons”
    public $host = "https://api.twitter.com/1.1/";
  • 2013-12-28: Change twitteroauth.php from 1 to 1.1 and it works with latest dokuwiki-release 2013-12-08 “Binky”
    public $host = "https://api.twitter.com/1.1/";
  • I tried step by step, double check but doesnot work, is there a debug mode somehere?
    • It works now (just had to wait a couple of days)

ToDo/Wish List

  • I am considering adding a configuration parameter 'track_all_changes'. If the parameter is set, all pages will be regarded by the plugin and tweets will be sent for all page changes, regardless of an ~~AUTOTWEET:~~ syntax being present or not.
    • + 1
  • Thanks for this plugin! I am wondering whether it would be possible to set it up so that rather than tweet from a particular page it tweets from a particular NS. I imagine this would not be too hard to add in…I may try to do it myself but would probably bumble quite a bit.
  • It were great, if tweets only sent, when the checkbox “small changes” is unchecked.

FAQ

Discussion

Hello… ¿how can I launch a tweet each time a new page is created? (I'm configuring a blog, and I need to comunicate new entries in the blog) (www.laterriblecorduradelidiota.es)

plugin/autotweet.txt · Last modified: 2015-10-28 14:02 by jdt