Appearance
The Imagine flow
What the person sees. The composer's "+" on AI images opens the Imagine flow over the conversation: the app's consent sheet and its suggestions, a field for the prompt, six generated images, and the one the person chooses to send.
What you do. The conversation's openImagine() opens DirectImagineCreationScreen. Its generate(prompt) submits the prompt and returns the six generation answers; its send({ file }) leaves the flow and sends the chosen image into the conversation.
What it sends. Opening the flow asks the account's MEmu profile from the conversation, then shows the app's loading screen (chain entry 9) and asks the flow's suggestions from it (gzipped, naming the surface session minted at the open); the flow's own entry is 10. generate(prompt) submits six generations at once — one submission event, one mutation id each — and asks the edit suggestions of the first image once the six answers are in: the recording sends that request once, at +668.363 s, 13.0 s after the last answer (651.793–655.378 s) and 23.5 s after the submissions (644.833–644.844 s), with no other request between them, and the capture holds no UI event stream by which a tap on an image could show. send({ file }) uploads the picture through PhotoAttachmentMessage and broadcasts the composer's photo_attachment with imagine_type=imagine; the flow and its loading screen are popped first, so the broadcast's chain is the inbox and the conversation.
Failures. The flow's queries and generations are GraphQL requests: a transport failure, a challenge or a rate limit is the library's typed error from @igpapi/core, answered as in Errors. The send's upload failure is MessengerMediaUploadHttpError or MessengerMediaUploadMalformedError.
What is not modelled. The picker's own Imagine tile (the flow opens from the conversation's "+"); the taps inside the consent sheet.
The Imagine flow opened from the composer: thread.openImagine().
The six images of one prompt: generate('…').
The image previewed before the send.
ts
// An AI image: the flow generates it, and the chosen image is sent to the conversation.
const generatedImage = await readFile('generated.jpg');
const sentAiImage = 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: generatedImage });
}),
});
console.log(sentAiImage);The message type this screen sends has its own page: An AI image.