Support sending messages to threads

Add `threadMessage` for sending messages using the new thread API.