How to call a command inside a script?

How to call a command inside a script?

Most of the commands you can do in the game are typed like this in the console: chats.tell{to:"John Doe", msg:"Hello World!"}

How can I do something similar in one of my script?

Give me examples.