dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.83k stars 1.13k forks source link

Adding a link to an Instagram story using instagram-private-api #1724

Open dingrins opened 10 months ago

dingrins commented 10 months ago

Form

Put an [x] if you meet the condition, else leave [ ].

Question

A specific question, so it's understandable to anyone. You may add pictures.

I am trying to post a story with a link attached to it using the instagram-private-api library. I have been able to successfully post a story using the ig.publish.story method, but I am unsure how to attach a link to the story. Is it possible to add a link to a story using this library? If so, could you provide some guidance on how to achieve this?

Code

A meaningful section of your code (else delete this). If you are using TypeScript replace js with typescript.

const { IgApiClient } = require('instagram-private-api');
const ig = new IgApiClient();

async function login() {
  ig.state.generateDevice(process.env.IG_USERNAME);
  ig.state.proxyUrl = process.env.IG_PROXY;
  await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);
}

async function publishStory(imagePath, link) {
  await login();

  const publishedMedia = await ig.publish.story({
    file: fs.readFileSync(imagePath),
    stickerConfig: {
      link,
      linkType: 1,
      linkText: 'See More',
    },
  });

  await ig.media.configureStory({
    upload_id: publishedMedia.upload_id,
  });
}

publishStory('path/to/your/image.jpg', 'https://your-link.com');

Error and Output

There is no error, but the story is posted without the link.

matankila commented 8 months ago

hey i found that missing too!!! please add this feature!

wpadilla commented 7 months ago

This would be an incredible features for the library, react if you are waiting for it ❤️

vult22896 commented 7 months ago

i try add option link in PostingStoryOptions, so not working!

bsakizli commented 2 months ago

I'm waiting, will this be the process of adding links to the story side?

Kulunkulu commented 1 month ago

i'm also anticipating this feature Can i add links to stories via the Official Instagram API?