Callback Notifications

When you create a bucket you are required to set a callback URL. This is the URL that will receive notifications when one of your microtasks has been completed. If you need to edit your callback URL, you can do so by editing the bucket from within your account.

When a Microtask is completed, your callback URL will receive a POST request with these two variables set in the form body.

  • task_complete: This boolean will be 1 if the microtask was completed successfully. If you have set this microtask to require a consensus and there are no more helpers available to work on the microtask, then this will be 0 to indicate that the task cannot be completed.
  • id: Will be set to the ID number given to the microtask when you created it.

You can use the ID number of the microtask to make an authenticated request to fetch the microtask with all of it's details. You can then take any appropriate action on your website.

PHP Example
if(isset($_POST['task_complete'])) {
	$id = intval($_POST['id']);
	$response = do_curl('https://www.t4sk.dev/api/task/'.$id,"GET",$api_token);

	if($_POST['task_complete']) {
		$answer = json_decode($response->data->final_answer);

		//Process $answer within your project
	} else {
		//Microtask was unable to be completed because consensus was not reached

	}
}