@Mention Chatter Users using Trigger
- For Apex class Click here
Note: If you are installing into a sandbox organization you must replace the initial portion of the URL with http://test.salesforce.com - set Up -> Security Controls -> remote Site settings and edit remote settings, change XXXX => na12/na11 , not sure where to get? check your browser for URL it may be like ap1, eu1 etc 
feedMention.addMention(<Record Id>, <Chatter Text Post>, <User Id to @metnion>, <Session ID>);
Total four parameters to pass,
- Record Id => record which to want to post chatter post
- Chatter Text => Chatter Text which want to appear in chatter post
- User Id => User Id to @mention in chatter post
- session Id => userinfo.getSessionId() (this is default method to get session id suing Apex)
NOTE: you can use this in Before update, after Update, after Insert, Apex Classes also