Skip to content

A GIF ​

A GIF sent from the composer's sticker tray: the conversation's openStickerTray() opens the tray (DirectStickerTabTrayScreen), its openGifTab() the GIF tab (DirectGifTrayScreen), and the GIF's own row in the tab's list (gifs) sends itself with send(), an animated_media broadcast (AnimatedMediaMessage).

The sticker trayThe tray opened from the composer: openStickerTray().

The tray’s GIF tabThe GIF tab with its results: openGifTab() lists them as gifs.

The GIF in the conversationThe GIF message in the conversation after the GIF row's send().

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'));

// Send a GIF: the tray, its GIF tab, and the GIF the person taps.
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 tray = yield* thread.openStickerTray();
      const gifs = yield* tray.openGifTab();
      // The GIF the person taps is one row of the tab's list: the row sends itself.
      const gif = gifs.gifs[0];
      if (gif === undefined) return undefined;
      return yield* gif.send();
    }),
});
console.log(sent);

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