Skip to content

Content publishing

maka9938 requested to merge content-publishing into main

This MR implements Instagram sharing functionality using the Instagram Graph API's Content Publishing endpoints. Here's a breakdown of the implementation:

  1. Backend Service:

    • InstagramService handles the two-step publishing process: a) Creates a media container with image URL and caption b) Publishes the container to Instagram
  2. Authentication:

    • Uses Facebook Page Access Token for authentication
    • Requires specific permissions: instagram_basic, instagram_content_publish
    • Token configured via application.properties

API Endpoints Used

  • Media Container Creation: POST /v18.0/{ig-user-id}/media
  • Media Publishing: POST /v18.0/{ig-user-id}/media_publish

Right now we use directly a permanent page access token, generated through Graph Explorer. Facebook's token refresh API isn't meant to be used programmatically in a backend service. It's designed to be used in the OAuth flow where a user is actively involved in the authentication process. That's why getting a permanent token manually through the Graph API Explorer worked better - it properly handles the user authentication and permission granting steps.

Future Improvements

  • Add image upload functionality
  • Write text on your own instead of our placeholder text currently
Edited by maka9938

Merge request reports

Loading