Skip to content

An AI image ​

An image generated in the composer's Imagine flow: the conversation's openImagine() opens DirectImagineCreationScreen, its generate(prompt) submits the prompt (six generations at once, then the edit suggestions), and send({ file }) uploads the chosen image and broadcasts it as a photo with imagine_type=imagine.

The Imagine consent sheetThe Imagine consent sheet opened from the composer: openImagine().

Imagine’s generated imagesThe generated images in the flow: generate(prompt).

The generated image previewedThe generated image previewed before sending.

The AI image in the conversationThe Imagine image shown in the conversation after send({ file }).

ts
import { AndroidIgpapi, FeedTimelineScreen } from '@igpapi/android';
import { Effect } from 'effect';
import { readFile } from 'node:fs/promises';

// A checkpoint read back from your storage (see "Keep a session").
const saved = JSON.parse(await readFile('session.json', 'utf8'));

// An AI image: the composer's Imagine flow generates it, and the chosen image is sent.
const generated = await readFile('generated.jpg');
const sent = await AndroidIgpapi.launch({
  checkpoint: saved,
  screen: FeedTimelineScreen,
  main: feed =>
    Effect.gen(function* () {
      const tab = yield* feed.openDirectTab();
      const item = tab.threads[0];
      if (item === undefined) return undefined;
      const thread = yield* item.open();
      const imagine = yield* thread.openImagine();
      yield* imagine.generate('A storm cloud made of cotton candy');
      return yield* imagine.send({ file: generated });
    }),
});
console.log(sent);

The pages of this site are the README files of the repository. The API reference is generated from the source.