naystack - v1.5.10
    Preparing search index...

    Function getInstagramConversation

    • Fetches a single Instagram conversation by id with messages and participants. Supports pagination for messages via fetchMore.

      Parameters

      • token: string

        Instagram access token.

      • id: string

        Conversation id.

      • Optionalcursor: string

        Optional pagination cursor for messages.

      Returns Promise<
          {
              fetchMore: | (
                  () => Promise<{ messages: { id: string; created_time: string; }[] | undefined; participants: { id: string; username: string; }[] | undefined; fetchMore: (() => Promise<...>) | undefined; }>
              )
              | undefined;
              messages: { created_time: string; id: string }[]
              | undefined;
              participants: { id: string; username: string }[] | undefined;
          },
      >

      Promise of { messages, participants, fetchMore? }.

      import { getInstagramConversation } from "naystack/socials";

      const convo = await getInstagramConversation(accessToken, conversationId);
      for (const msg of convo.messages ?? []) {
      console.log(msg.id, msg.created_time);
      }
      if (convo.fetchMore) {
      const older = await convo.fetchMore();
      }