Mover of the moment:

Now online:

1stMovers on Twitter

AutoTweet Community 4ik has updated user data - more...
AutoTweet Community Angola has updated user data - more...
AutoTweet Community promocjaaygge has updated user data - more...

Create PDF Email Print

Instructions to enhance AutoTweet / Write your own AutoTweet extension plugin

Hits:
2477
Rating:
 
Vote for this:
Good - Bad

Answer

There are two ways to extend AutoTweet:

  1. Develop an extension plugin for AutoTweet.
  2. Post a message with the AutoTweet API.

The recommended way is to develop an extension plugin.


Write an extension plugin for AutoTweet

Your plugin must derive form the base class plgAutotweetBase (for Joomla standard system plugins) or implement the interface iAutotweetPlugin for special plugins. As a sample for a Joomla standard plugin you should have a look in one of the existing plugins, e. g. the free Content-Extension plugin or one of the other plugins.

The plugin does the work in 2 steps:

  1. Within the first step the article/item to post for is inserted into the message queue. For this the plugin catches the event when the article is saved. There are two ways to do this: If the component raises a special event (like onAfterContentSave) you can do it this way. If not, you must catch the onAfterRoute event and you have to analyze the request data.
  2. The second step is triggered by the Automator-Plugin (see also the FAQ entry "How does AutoTweet message sending work?"). Within this step you have to implement the "getData" function in the plugin. This function returns the data for message generation and is called when the message is send.

If you are developing a plugin you have to consider some conditions. If you follow any conditions/instructions, the plugin integrates into AutoTweet, works together with the rules engine and will appear in the plugin list in the AutoTweet backend .


Conditions and additional instructions

It is recommended to develop the plugin as a Joomla system plugin (Of course also other plugin types are working together with AutoTweet).

The element id of the plugin must begin with "autotweet" (AutoTweet is using this ID to detect the plugins). The element id is specified in the plugin xml manifest file. In the following sample the element id is "autotweetcontent":

filename plugin="autotweetcontent"

The classname of the plugin must follow the standard Joomla naming convention for plugins: Prefix "plg", plugin type and element id. In our example the plugin is of type "system" and the element id is "autotweetcontent" what results in the classname "plgSystemAutotweetContent".

Plugins for AutoTweet NG 5.x for Joomla 1.6/1.7 only: In your language file you should specify a name string for the plugin. If you don't do this, in some cases a technical name is displayed in AutoTweet backend. The key for the string must follow the naming conventen PLG_AUTOTWEETELEMENTID_NAME. In our example the entry in the language file should look like PLG_AUTOTWEETCONTENT_NAME="AutoTweet NG Content-Extension".

 

Return values of the function getData

The function returns an array with the data for message generation (see also the coding of one of the plugins):

  • title: used as title for the message in media mode (e. g. with Facebook attachment)
  • text: the message to post (e. g. with Twitter or Facebook in message mode)
  • hashtags: for use with Twitter
  • url: The url for the link in the message (not routed with JRoute; the routing is done later by the AutoTweet component).
  • image_url: If you will post an image with the message in media mode.
  • fulltext: A longer text with more information (e. g. used in media mode for Facebook attachment).
  • catids: Array with category IDs or something like this ofr use with the rules engine (If you have nested categories, you should return the full category path...).
  • author: The username of the author (or editor) for use with the rules engine.

The field "text" is mandatory. Other fields can be empty but of course it makes sense to fill most.

If your plugin does handle events, you can fill some more fields (see the coding of the Eventlist plugin to have a closer look).

 

Plugin certification

If you send me the following information about the plugin, I will add a link to your page in the download area of 1st-movers.com and add additional information about the plugin to the plugin list in AutoTweet backend to promote your plugin: element id, classname, plugin type, download link, requirements, Joomla compatibility (1.5, 1.6 1.7). Complementary you can send me the plugin xml manifest file.

 

If you send me the full plugin package, I will do some tests and verifications. If they are succesful, you can use our "Certified Plugin" logo to promote your plugin:

 

 

 

 

Post a message with the AutoTweet API

With the API function "AutotweetAPI::postMessage" (see the folder API and the instruction in the class file) you can send a message over AutoTweet without the need to write a plugin. So you can call this function directly from your component. This functions send the message directly (The queue is not used).