Sending messages requires knowing the channel name and having an actual message you wish to send. There is no specific mechanism to create new channels - they are created automatically by simply subscribing, or publishing to a new channel name.
The publish
function lets you specify all of the above, and then send the message. After sending a message, PubNub servers return a message timetoken, which lets you do further actions like retrieving/auditing messages at a later date.
You can publish the same thing with this curl
command.