Skip to content

Adding tasks

Adding tasks to a campaign is done through adding batches.

Batches are a collection of tasks that are added to a campaign. Each batch can contain multiple tasks. Let's start by creating a batch with 3 tasks to our newly created image classification campaign.

import { createBatch } from '@effectai/sdk'
 
const batch = await createBatch({
  client,
  // The campaign id to which the batch should be added
  campaignId : 1,
  // The number of times each task in the batch should be repeated
  repetitions: 1,
  // The reward for each task in the batch
  reward: 3,
  // The template placeholders for each task in the batch
  taskData : [
    {
      ipfs_url: 'https://example.com/image.jpg', //task 1 image placeholder
    },
    {
      ipfs_url: 'https://example.com/image2.jpg', //task 2 image placeholder
    },
    {
      ipfs_url: 'https://example.com/image3.jpg', // task 3 image placeholder
    }
  ],
})