There is not a way to do this within the OSTicket interface. However if you know PHP/MySQL you could mod the source to add this in.
The messageId is stored in the ost_ticket_message table.
Base variables are dealt with in \include\class.ticket.php in the replaceTemplateVars function which starts circa line 417. I'm not sure if you can just add it there and have it work or if you would have to change a SQL query somewhere.
I hope this helps. Good luck.