naystack - v1.9.9
    Preparing search index...

    Variable getInstagramDataConst

    getInstagramData: (
        token: string,
        path: string,
        options?: GraphRequestOptions,
    ) => Promise<T & GraphError | null> = client.request

    Calls the Instagram Graph API directly — the escape hatch for endpoints this module doesn't wrap. Despite the name it does POSTs too: Graph mutations take their arguments as query params, so pass method: "POST" with params.

    The base URL and API version stay pinned here, so callers never hardcode either. Pair it with readGraphID to unwrap an id and log the API's own error.

    Type Declaration

      • (
            token: string,
            path: string,
            options?: GraphRequestOptions,
        ): Promise<T & GraphError | null>
      • Parameters

        • token: string

          Instagram access token.

        • path: string

          API path, relative to the versioned root (e.g. "me/media").

        • Optionaloptions: GraphRequestOptions

          GraphRequestOptions — params (query), method, body.

        Returns Promise<T & GraphError | null>

        Promise of (T & GraphError) | null — check .error before reading T.

    import { getInstagramData, readGraphID } from "naystack/socials";

    // An endpoint with no dedicated helper.
    const id = readGraphID(
    "Instagram comment reply",
    await getInstagramData<{ id: string }>(token, `${commentID}/replies`, {
    params: { message: "thanks!" },
    method: "POST",
    }),
    );