Skip to content

The draw editor ​

What the person sees. A canvas placed over a message of the conversation: the person draws on it, and the finished drawing is sent into the conversation over that message.

What you do. The message's own draw() opens DirectDoodleEditorScreen — the drawing belongs to that message, so the action is the message's, never an argument. Its send({ file }) uploads the drawing and places it on the message.

What it sends. Opening the editor sends nothing; the recording's chain names no editor, so its navigation is unrecorded and the page writes no chain entry. send({ file }) uploads the picture (messenger_image, image/png) and sends IGDirectSetDragAndDropItemMutation with the recorded shape — DOODLE, the canvas's own placement floats and the target message's item and threading ids.

Failures. A message whose answer carries no client_context cannot name the mutation's required target_offline_threading_id, so message.draw() dies with DirectThreadMessageNotDrawableError before any request — the request's own requirement, not a rule about which messages may be drawn on. The upload failure is MessengerMediaUploadHttpError or MessengerMediaUploadMalformedError; the placement is a GraphQL mutation whose transport failure, challenge or rate limit is the library's typed error from @igpapi/core, answered as in Errors.

What is not modelled. The app's first-open notice (direct_doodles_information_nux) is in no recorded cut; the editor's own chain entry.

The draw editorThe editor opened over a message: message.draw().

The canvas with strokesThe canvas with the person's strokes, before the send.

The drawing in the conversationThe drawing placed over the message after the editor's send({ file }).

ts
// A drawing: the message's own draw() opens the editor, and the finished drawing is sent.
const drawingFile = await readFile('drawing.png');
const sentDrawing = 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: drawingFile });
    }),
});
console.log(sentDrawing);

The message type this screen sends has its own page: A drawing.

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