Socket
Socket
Sign inDemoInstall

instagram-apis

Package Overview
Dependencies
78
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    instagram-apis

Insatgram library filled with useful Instagram API's


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Install the package

npm install instagram-apis

Authinication with username and password

const lib = require("instagram-apis");
const client = new lib();
(async () => {
    await client.init({
        username: "USERNAME",
        password: "PASSWORD",
        // saveCookie: true
    });
})(); // saveCookie parameter used to save your cookie in session.json file;

Authinication with coookie

const lib = require("instagram-apis");
const client = new lib();
(async () => {
    await client.init({
        cookie: "COOKIE",
    });
})();

- Profile API's :

  • All functions returning a values ( no-void functions )
  • User ID is the identifier of any account in Instagram.
    FunctionParametersDo What ?Example
    getUsernameInfo()username [required]Returns account informationawait client.getUsernameInfo("afph")
    getInfoByUserId()UserID [required]Returns account informationawait client.getUsernameInfo("1443437479")
    followByUsername()username [required]To follow an accountawait client.followByUsername("afph")
    followByUserId()UserID [required]To follow an accountawait client.followByUserId("1443437479")
    blockByUsername()username [required]To block an accountawait client.blockByUsername("afph")
    blockByUserId()UserID [required]To block an accountawait client.blockByUserId("1443437479")
    unfollowByUsername()username [required]To unfollow an accountawait client.unfollowByUsername("afph")
    unfollowByUserId()UserID [required]To unfollow an accountawait client.unfollowByUserId("1443437479")
    getAccountStoriesDataByUserId()UserID [required]To get all stories data of accountawait client.getAccountStoriesDataByUserId("1443437479")
    changeUsername()username [required]To change account username to new username passed in parametersawait client.changeUsername("newusername")
    changeBiography()biography [required]To change account biography to new biography passed in parametersawait client.changeBiography("NEW_BIO")
    changeFirstName()firstName [required]To change account FirstName to new biography passed in parametersawait client.changeFirstName("NEW_FIRST_NAME")

Chatting API's :

A piece of information :
  • All functions returning a values ( no-void functions )
  • Thread ID is a code of the chat between you logged account and other account.
  • Cursor is an ID used to get old messages or chats.
  • Video URL should return video/mp4 as data mimeType
  • Photo URL should return image/jpeg as data mimeType
    FunctionParametersDo What ?Example
    sendMessageToUserIds(){ userIds [required] , message [required] }Send Messages To account with User IDsawait client.sendMessageToUserIds({userIds: ["1443437479"], message: "MESSAGE_TEXT"})
    getThreadIdByUserId()userid [required]Returns the thread id of chat that between logged account and other accountawait client.getThreadIdByUserId("1443437479")
    getChatMessages(){ thread_id [required], cursor }Returns last 20 messages in specific chat with cursor- await client.getChatMessages({thread_id: "THREAD_ID"})
    - await await client.getChatMessages({thread_id: "THREAD_ID", cursor: "CURSOR"})
    getChats()cursorReturns last 20 chats with or without cursor, also last 20 messages of each chat- await client.getChats()
    - await client.getChats("THE_CURSOR")
    getLastMessagingRequests()Returns last pending chats in request messagesawait client.getLastMessagingRequests()
    acceptMessageRequest()thread_id [required]Accept message request with specific thread IDawait client.acceptMessageRequest("THREAD_ID")
    restirectChatByUserId()UserID [required]restirect specific account with user IDawait client.restirectChatByUserId("1443437479")
    unRestirectChatByUserId()UserID [required]unrestirect specific account with user IDawait client.unRestirectChatByUserId("1443437479")
    deleteChat()thread_id [required]Delete a specific chat with thread IDawait client.deleteChat("THREAD_ID")
    unSendMessage(){ thread_id [required], item_id [required] }Unsend (Delete) a specific message in specific chat using thread ID and item IDawait client.unSendMessage({thread_id: "THREAD_ID", item_id: "ITEM_ID"})
    sendPhotoToChat(){ url [required], thread_id [required] }Send photo from URL to chat using thread ID and image[jpg] URL.await client.sendPhotoToChat({url: "https://i.imgur.com/H43LKYL.png", thread_id: "THREAD_ID"})
    sendVideoToChat(){ url [required], thread_id [required] }Send video from URL to chat using thread ID and video[mp4] URL.await client.sendVideoToChat({url: "https://i.imgur.com/3nn5VcM.mp4", thread_id: "THREAD_ID"})

Media API's :

A piece of information :
  • All functions returning a values ( no-void functions )
  • Media ID is an identifier for images, photos, posts, reels, stories and other. It used in API's .

    FunctionParametersDo What ?Example
    getMediaIdFromURL()URL [required]Returns the media ID of post or reelsawait client.getMediaIdFromURL("https://www.instagram.com/p/CfJn1AHAFdA/")
    getMediaInfoFromMediaId()media_id [required]Returns the media informationawait client.getMediaInfoFromMediaId("MEDIA_ID")
    getMediaInfoFromURL()URL [required]Returns the media informationawait client.getMediaInfoFromURL("https://www.instagram.com/p/CfJn1AHAFdA/")
    likePostByMediaId()media_id [required]Like a post with media IDawait client.likePostByMediaId("THE_MEDIA_ID")
    unLikePostByMediaId()media_id [required]Unlike a post with media IDawait client.unLikePostByMediaId("THE_MEDIA_ID")
    deletePost()media_id [required]Delete a post with speific media IDawait client.deletePost("THE_MEDIA_ID")
    getPostComments()media_id [required]Returns post comments with speific media IDawait client.getPostComments("THE_MEDIA_ID")

News Inbox API's :

  • All functions returning a values ( no-void functions )
FunctionParametersDo What ?Example
getLastFollowRequestsReturns last follow requestsawait client.getLastFollowRequests()
acceeptFollowRequest()UserID [required]Accepts follow requestawait client.acceeptFollowRequest("USER_ID")

Keywords

FAQs

Last updated on 11 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc