There are is an examples, the first one is the sendingmessage plugin, it is a very basic easy to understand plugin.

The second example is a full blown example on the DUI. Comments and suggestions are very welcome.
-------------------------------------