Skip to content

Direct ​

What the person sees. Direct messages: the inbox, a conversation, the recipient picker for a new message or a group, a conversation's details with its shared media, the group name editor and a participant's nickname editor.

What you do. You open the inbox (DirectInboxScreen) and a conversation (DirectThreadScreen), write and react to messages, send a photo from the composer's gallery picker (DirectMediaPickerPhotosScreen), a voice message, a GIF or a sticker from the composer's tray (DirectStickerTabTrayScreen), start a one-to-one conversation or a group through the recipient picker (DirectRecipientPickerScreen), look at a conversation's details (DirectThreadDetailsScreen) and its shared media (DirectThreadSharedMediaScreen), rename a group (DirectGroupNameAndPhotoEditorScreen) and give a participant a nickname (DirectThreadNicknameChangeScreen).

The inbox is the feed's Direct tab; a conversation is also reached from a profile's "Message" button.

Every example starts from session.json, the session Your first program saved, and names the screen it expects (screen: FeedTimelineScreen). The examples show the success path: errors are answered as in Errors, and challenges by your otherwise constant (Challenges: answer them once with otherwise).

ts
import { AndroidIgpapi, DirectMediaPickerPhotosScreen, 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'));

The pages of this area ​

PageThe screen
The Direct inboxDirectInboxScreen, the feed's Direct tab
A conversationDirectThreadScreen, a conversation and its messages
The forwarding sheetDirectForwardingSheetScreen, a message forwarded
The Imagine flowDirectImagineCreationScreen, the composer's AI images
The draw editorDirectDoodleEditorScreen, a drawing over a message
The gallery pickerDirectMediaPickerPhotosScreen, the composer's "+" gallery
The sticker trayDirectStickerTabTrayScreen, its GIF and sticker tabs
"New message": the recipient pickerDirectRecipientPickerScreen, "New message" and the new group
A conversation's detailsDirectThreadDetailsScreen, a conversation's details hub
A conversation's shared mediaDirectThreadSharedMediaScreen, the thread's shared media
The group name and photo editorDirectGroupNameAndPhotoEditorScreen
A participant's nickname editorDirectThreadNicknameChangeScreen
The Direct share sheetDirectShareSheetScreen, the paper plane's conversations

The matrix ​

#The person...Starts onActionsResult
1Opens the Direct tabthe feedopenDirectTab(), threadsThe inbox with its thread previews
2Opens a conversationthe inboxthe thread item's open(), messages, participantsThe conversation and its messages
3Writes a messagea conversationsendMessage(text)The text broadcast to the conversation
4Sends a photo from the gallerya conversationopenMediaPicker(), sendPhoto({ file })The picker, then the photo message
5Sends a voice messagea conversationsendVoice({ file })The voice message, its waveform measured from the take
6Sends a GIFa conversationopenStickerTray(), openGifTab(), the GIF row's send()The tray and its GIF list, then the GIF message
7Sends a stickera conversationopenStickerTray(), openStickerTab(), the sticker row's send()The tray and its sticker grid, then the store sticker
8Uses a message's menua conversationthe message's react({ emoji }), reply(text), forward(), edit(text), unsend()The reaction, the reply, the forwarding sheet, the edit or the unsend
9Starts a one-to-one conversationthe inboxopenNewMessage(), search(query), the recipient's or the thread's openThread()The picker, its ranked recipients, then the conversation
10Creates a group chatthe inboxopenNewMessage(), startGroupChat(), search(query), createGroup(rows)The created group's conversation
11Writes to someone from their profilea profileopenDirectThread(), sendMessage(text)The one-to-one conversation with that user
12Looks at a conversation's details and mediaa conversationopenThreadDetails(), openSharedMedia()The details hub, then the shared media list
13Renames a groupa group conversationopenThreadDetails(), openSharedMedia(), openGroupNameEditor(), changeName(name)The group's new title
14Gives a participant a nicknamea conversationthe participant's openNicknameEditor(), changeNickname(nickname)The nickname changed
15Shares a post, a carousel, a reel or a profilea post, a carousel, a reel or a profileits share(), the sheet row's send()The item in that conversation
16Sends a video from the gallerya conversationopenMediaPicker(), sendVideo({ file })The picker, then the video message
17Sends an AI image from Imaginea conversationopenImagine(), generate(prompt), send({ file })The Imagine flow, then the generated image as a photo
18Draws over a messagea conversationthe message's draw(), the editor's send({ file })The draw editor, then the drawing as a message

Reading new messages ​

A conversation is a snapshot of what Instagram answered when you opened it. To read messages that arrived later, open the inbox and the conversation again.

The group name ​

The group name editor is opened from the shared media list (openGroupNameEditor()), which follows the conversation's details (scenario 13).

What these screens do not offer ​

Message requests (the inbox reads the main list only), the story camera and the picker's Imagine tile (the flow opens from the conversation's "+"), a voice message's recording (the take's file is the caller's), muting a conversation, deleting a chat, and leaving, hiding, restricting or blocking from a group's options. The app has them; the Simulator has no action for them.

Where the examples live ​

Each directory's README carries the examples of its own screen:

  1. Open the inbox — inbox/
  2. Open a conversation, write a message, use a message's menu, send a photo, a video or a voice message, draw over a message, open the Imagine flow, write from a profile — thread/, whose menu's own types have a page each: a reply, an edited message, an unsent message
  3. Forward a message — forwarding-sheet/
  4. The composer's gallery picker, its photo and its video — media-picker/
  5. The sticker tray, its GIF tab and its sticker grid — sticker-tray/
  6. The composer's AI images — imagine/
  7. A drawing over a message — doodle/
  8. Start a one-to-one conversation, create a group chat — recipient-picker/
  9. Look at the details and the shared media — details/, shared-media/
  10. Rename a group — group-editor/
  11. Give a participant a nickname — nickname/
  12. Share a post, a carousel, a reel or a profile — share-sheet/

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