Appearance
A story share
storyShareMessage({ mediaId, reelId?, text? }) builds the message; DirectBroadcast sends it to a conversation. Shares a story into the conversation.
Example
Share a story into a conversation. The example starts the app from a stored snapshot and sends over the layer, so its answer is the broadcast's: the server's response beside the client_context the request minted.
ts
import { AndroidApp } from '@igpapi/android';
import { DirectBroadcast, storyShareMessage, ThreadDirectTargetConfiguration } from '@igpapi/mobile';
import { Effect } from 'effect';
import { readFile } from 'node:fs/promises';
// A snapshot read back from your storage (see "Keep a session").
const snapshot = JSON.parse(await readFile('snapshot.json', 'utf8'));
// Share a story into a conversation (the plane button on a story): the story's media id.
const share = DirectBroadcast({
target: new ThreadDirectTargetConfiguration('340282366841710300949128000000000001'),
message: storyShareMessage({ mediaId: '3000000000000000001_1000000001' }),
});
// One build of the layer is one app process; the program runs over it.
const sent = await Effect.runPromise(Effect.provide(share, AndroidApp({ snapshot })));
console.log(sent.client_context);