UserBonus

toloka.client.user_bonus.UserBonus | Source code

UserBonus(
self,
*,
user_id: Optional[str] = None,
amount: Optional[Decimal] = None,
private_comment: Optional[str] = None,
public_title: Optional[Dict[str, str]] = None,
public_message: Optional[Dict[str, str]] = None,
without_message: Optional[bool] = None,
assignment_id: Optional[str] = None,
id: Optional[str] = None,
created: Optional[datetime] = None
)

Issuing a bonus to a specific Toloker.

It's addition to payment for completed tasks.

Parameters Description

ParametersTypeDescription
user_idOptional[str]

Toloker's ID to whom the bonus will be issued.

amountOptional[Decimal]

The bonus amount in dollars. Can be from 0.01 to 100 dollars per Toloker per time.

private_commentOptional[str]

Comments that are only visible to the requester.

public_titleOptional[Dict[str, str]]

Message header for the Toloker. You can provide a title in several languages (the message will come in the Toloker's language). Format {'language': 'title', ... }. The language can be RU/EN/TR/ID/FR.

public_messageOptional[Dict[str, str]]

Message text for the Toloker. You can provide text in several languages (the message will come in the Toloker's language). Format {'language': 'message', ... }. The language can be RU/EN/TR/ID/FR.

without_messageOptional[bool]

Do not send a bonus message to the Toloker. To award a bonus without a message, specify null for public_title and public_message and True for without_message.

assignment_idOptional[str]

ID of the Toloker's response to the task a reward is issued for.

idOptional[str]

Internal ID of the issued bonus. Read-only field.

createdOptional[datetime]

Date the bonus was awarded, in UTC. Read-only field.

Examples:

How to create bonus with message for specific assignment.

new_bonus = toloka_client.create_user_bonus(
UserBonus(
user_id='1',
amount='0.50',
public_title={
'EN': 'Perfect job!',
},
public_message={
'EN': 'You are the best Toloker',
},
assignment_id='012345'
)
)

How to create bonus with message in several languages.

new_bonus = toloka_client.create_user_bonus(
UserBonus(
user_id='1',
amount='0.10',
public_title={
'EN': 'Good Job!',
'RU': 'Молодец!',
},
public_message={
'EN': 'Ten tasks completed',
'RU': 'Выполнено 10 заданий',
}
)
)
Toloka-Kit
OverviewGetting OAuth tokenQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming