Skip to content

A drawing ​

A drawing placed over a message: the message's own draw() opens DirectDoodleEditorScreen, and the finished drawing's send({ file }) uploads it (messenger_image, image/png) and places it with IGDirectSetDragAndDropItemMutation.

The draw editorThe draw editor opened from the composer: the message's draw().

The draw canvas with strokesThe canvas with strokes.

The drawing in the conversationThe drawing 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'));

// A drawing: a message's own draw() opens the editor, and the finished drawing is sent.
const drawing = await readFile('drawing.png');
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 message = thread.messages[0];
      if (message === undefined) return undefined;
      const editor = yield* message.draw();
      return yield* editor.send({ file: drawing });
    }),
});
console.log(sent);

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