Send a reply to a message thread in Toloka.
Connect the Toloka-Kit library to your script.
import toloka.client as toloka
Replace the sample API key with your own one.
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION');
Find out the ID of the message thread you want to reply to. Then compose a reply using the MessageThreadReply class object for that.
message_reply = toloka.message_thread.MessageThreadReply(text={'EN': 'Thank you!'})response_to_thread = toloka_client.reply_message_thread( message_thread_id='63c15cfd757a4a1adad1d633', reply=message_reply)
The reply_message_thread()
request will return the MessageThread class object. You can use its attributes to print the information you need.
print(response_to_thread.id, response_to_thread.created)
You should get an output with the message ID and creation time which looks like this.
63c15cfd757a4a1adad1d633 2023-01-13 13:36:13.894000+00:00
import toloka.client as tolokatoloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')message_reply = toloka.message_thread.MessageThreadReply(text={'EN': 'Thank you!'})response_to_thread = toloka_client.reply_message_thread( message_thread_id='63c15cfd757a4a1adad1d633', reply=message_reply)print(response_to_thread.id, response_to_thread.created)
Last updated: February 7, 2023