Reputation: 11
I'm working with the instagram-private-api to add followers to the close friends list using the setBesties
method. Everything works fine until I reach 9,999 followers, but as soon as I try to add more beyond this number, I receive the following error:
Retry failed: IgResponseError: POST /api/v1/friendships/set_besties/ - 400 Bad Request; max besties exceeded
at Request.handleResponseError (C:\Users\hamza\Desktop\instagram-close-friends-automation-ts\node_modules\instagram-private-api\src\core\request.ts:172:12)
at Request.send (C:\Users\hamza\Desktop\instagram-close-friends-automation-ts\node_modules\instagram-private-api\src\core\request.ts:83:24)
at async FriendshipRepository.setBesties (C:\Users\hamza\Desktop\instagram-close-friends-automation-ts\node_modules\instagram-private-api\src\repositories\friendship.repository.ts:76:22)
Here's the part of the code where the error occurs:
await ig.friendship.setBesties({ add: batch, remove: [] });
Below is the function I am using to add users to close friends list.
// Function to add followers to the close friends list
async function addToCloseFriends(ig: IgApiClient, followerIds: string[], batchSize: number, requestDelay: number, batchDelay: number) {
let totalAdded = 0;
console.log(`Adding ${followerIds.length} followers to close friends list...`);
for (let i = 0; i < followerIds.length; i += batchSize) {
const batch = followerIds.slice(i, i + batchSize);
try {
await ig.friendship.setBesties({ add: batch, remove: [] });
totalAdded += batch.length;
console.log(`Added batch ${Math.floor(i / batchSize) + 1} to close friends. Total added: ${totalAdded}`);
await new Promise(resolve => setTimeout(resolve, requestDelay))
} catch (error) {
if (error instanceof IgNotFoundError) {
console.error('An API endpoint was not found:', error.message);
} else {
console.error('An error occurred while adding to close friends:', error);
}
break;
}
await new Promise(resolve => setTimeout(resolve, batchDelay));
}
console.log('All followers have been added to the close friends list.');
Everything works without any issue until 9999 followers are added, but after that, I consistently get the 400 Bad Request error.
And there isnt any limit on how many close friends you can add to your list. I have seen peaople added over 50K followers.
I tested smaller batches and larger batches, but the error consistently appeared once I hit the 9,999 follower limit. I attempted to check the API documentation to see if this limit was mentioned but couldn't find anything explicit about a cap on the number of users in the close friends list.
If there's a hidden cap of 9,999, I'd like to know if it's possible to extend or bypass this limit, or if there’s any other solution that allows managing a larger number of users as "besties" on Instagram.
Upvotes: 1
Views: 723