This might do the job but unsure
https://autohotkey.com/ - Others on these forums will have more knowledge
Autohotkey is what I would use. It's easy enough to bind keys into functions.
For example using the P key as your first message;
Code:
p::sendraw, This is an automated message
In the above, "p" is the trigger key, "::" tells the script to rebind the key into a command, and "sendraw, <text>" tells the script to send the following keys as a simulated keyboard input. Autohotkey is fairly forgiving with it's syntax, and that first comma after "sendraw" is optional.
You can then add more lines as needed;
Code:
^p::sendraw, Yarr, this be a stickup, matey
^o::sendraw, Cut yer engines and deploy landing gear, or you'll be soon talkin' with Davy Jones
In this section, I've added a caret to each trigger, which tells the script to wait for ctrl+p or ctrl+o. This is useful because otherwise
all presses of the p and o keys would get replaced (which makes text chat a pain).
To run this, place it into a notepad file and save it with a .ahk extension. With Autohotkey installed, you should be able to run the script from there. The script will then work in all applications, and can be stopped when needed by right-clicking the green square icon in your system tray and clicking exit.
Note that lines I wrote above require you to open the chat window beforehand, and then press enter afterwards to send it. You can simulate just about any keyboard (or mouse) input, and it's easily possible to make a line also handle opening and sending.