Posts tagged with instagram-graph-api

I am using Facebook graph API Facebook graph API, to update my Instagram page's post create/ update. the endpoint I am using is like

https://graph.facebook.com/{media_id}?caption={new_caption}&access_token={access_token} 

Neither using insomnia nor using JAVA code do I receive the successful message, and the caption remains unchanged.

    private static CompletableFuture<PostFB> updatePostInstagramMessageAsync(String hostname, PostFB ig, HttpClient client) {     JSONObject jsonPayload = new JSONObject();     if (ig.text != null && !ig.text.isEmpty()) {         jsonPayload.put("caption", ig.text);           jsonPayload.put("comment_enabled", true);           System.out.println("jsonPayload is " + jsonPayload.toString());         String url = "https://graph.facebook.com/v19.0/" + "my postID";         HttpRequest request = HttpRequest.newBuilder()                 .uri(URI.create(url + "?access_token=" + ig.page_access_token))                 .header("Content-Type", "application/json")                 .method("POST", BodyPublishers.ofString(jsonPayload.toString(), StandardCharsets.UTF_8))                 .build();         return client.sendAsync(request, HttpResponse.BodyHandlers.ofString())                 .thenApply(response -> {                     System.out.println("Response for updating post is " + response.body());                     if (response.statusCode() == 200) {                                                       System.out.println("Updated post successfully.");                         } else {                             System.out.println("Failed to update post: " + response.body());                                                     }                     } else {                         System.out.println("Failed to update post. Status code: " + response.statusCode());                                             }                     return ig;                 })                 .exceptionally(ex -> {                     ex.printStackTrace();                                         return ig;                 });     } else {         return CompletableFuture.completedFuture(null);     } } 

Despite receiving a successful response, the caption does not change. I have created the application and assigned the necessary permissions:

  • pages_show_list,
  • instagram_basic,
  • instagram_manage_comments,
  • instagram_manage_insights,
  • instagram_content_publish,
  • instagram_manage_messages,
  • pages_read_engagement,
  • instagram_manage_events,
  • public_profile

I am able to create new posts but I cannot modify them. Why? any help would be appriciated.

I am trying out the Instagram Graph API for the first time to get the user page ID, aiming to retrieve the Instagram business account ID. However, when I use the Graph tool for my app and enter me/accounts, it returns nothing. I read that me/accounts should return various data, including what I need, but it comes up empty despite fetching the access token properly.

I've had trouble finding updated documentation on the correct permissions needed for me/accounts. Some permissions don't seem to be available anymore. I've tried many permissions, but nothing works. Currently, I have the following permissions: pages_show_list, instagram_basic, instagram_manage_comments, instagram_manage_insights, pages_read_engagement, pages_manage_metadata, and pages_read_user_content. I also have a business Instagram account linked to my Facebook account.

Any advice on how to sort it?

I tried using graph apis and even in meta explore tools as well, but getting data as empty string on fteching me/accounts. I had linked instagram and facebook page and even turned instagram account into business account. Expecting to get all the accounts linked, so that i can use id for content publishing.

i wish to find a solution to this issue i have been facing for a long while, trying to publish a reel on instagram. It keeps returning this error: Media upload has failed with error code 2207026 which means its not in the required format, i have tried with countless videos, uploaded them to my google drive and input the link to the video but still the same error, i came across this: Facebook Graph API - Getting error 2207026 when trying to upload video

And also implemented the last suggesstion in my code as shown below:

public String uploadFile(MultipartFile file) {         String extension = StringUtils.getFilenameExtension(file.getOriginalFilename());         var key = UUID.randomUUID() + "." + extension;         String directory = this.fileStorageLocation;         Path newPath = Paths.get(directory).toAbsolutePath().normalize();         try {             Files.createDirectories(newPath);             Path inputFilePath = newPath.resolve(StringUtils.cleanPath(key));             Path outputFilePath = newPath.resolve("output.mp4");             Files.copy(file.getInputStream(), inputFilePath, StandardCopyOption.REPLACE_EXISTING);             executeFFmpegCommand(inputFilePath.toString(), outputFilePath.toString());         } catch (IOException ex) {             Logger.getLogger(FileService.class.getName()).log(Level.SEVERE, null, ex);         }         return key;     }     private void executeFFmpegCommand(String inputFilePath, String outputFilePath) throws IOException {         String ffmpegPath = "C:\\ffmpeg\\bin\\ffmpeg.exe";         String[] ffmpegCommand = {                 ffmpegPath,                 "-i", inputFilePath,                 "-c:v", "libx264",                 "-aspect", "16:9",                 "-crf", "18",                 "-vf", "scale=iw*min(1280/iw\\,720/ih):ih*min(1280/iw\\,720/ih),pad=1280:720:(1280-iw)/2:(720-ih)/2",                 "-fpsmax", "60",                 "-preset", "ultrafast",                 "-c:a", "aac",                 "-b:a", "128k",                 "-ac", "1",                 "-pix_fmt", "yuv420p",                 "-movflags", "+faststart",                 "-t", "59",                 "-y", outputFilePath         };         ProcessBuilder processBuilder = new ProcessBuilder(ffmpegCommand);         processBuilder.inheritIO();         Process process = processBuilder.start();         try {             process.waitFor();             System.out.println("FFmpeg command executed successfully.");         } catch (InterruptedException e) {             throw new IOException("Error executing FFmpeg command: " + e.getMessage(), e);         }     } 

And uploaded the video to my drive and put in the link again, but still the same error, i dont know could be the issue, could someone provide a suggestion or a link to a video that has been tested with, because i dont see what am doing wrong, thanks.

I'm currently working on an automated system that gathers Instagram profile insight data and sends it to an endpoint. However, I'm facing a challenge due to the large number of Instagram accounts I need to manage—more than 100 in total.

As a beginner in this area, I understand that utilizing the Instagram Graph API would be the most efficient approach. However, manually setting up access for each of the accounts seems like a time-consuming task.

Could anyone provide guidance on how to streamline this process? I'm looking for a clear explanation or a step-by-step guide on how to automate access to the Instagram Graph API for multiple accounts.

Any help or insights would be greatly appreciated!