instagram-private-api icon indicating copy to clipboard operation
instagram-private-api copied to clipboard

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

Open dingrins opened this issue 1 year ago • 6 comments

Form

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

  • [ X ] I've searched the Issues
  • [ X] I've read the basic concepts
  • [ X] I'm using the latest version

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.

dingrins avatar Sep 02 '23 13:09 dingrins

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

matankila avatar Nov 06 '23 19:11 matankila

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

wpadilla avatar Nov 21 '23 20:11 wpadilla

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

vult22896 avatar Dec 12 '23 09:12 vult22896

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

bsakizli avatar May 03 '24 18:05 bsakizli

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

Kulunkulu avatar May 14 '24 02:05 Kulunkulu