Skip to content

harrylowkey/instagram-coding-easily-api

Repository files navigation

Instagram Coding Easily API

  • Automatically generate post with OpenAI and upload to Instagram (random language, topic, or set manually)
  • Upload posts with embed codes to Instagram
  • Set up posts with images & captions and upload them to Instagram
  • Integrate with Discord Bot
  • Automatically generate posts and upload them to Instagram at intervals.

Check more the generated posts at Instagram page coding.easily

Demo

Random generated post in C language

Show case

Discord Bot Commands

Show case

Discord Bot Interactions

Show case

Generate random post with OpenAI

Auto.Generate.Post.1.mov

Create post with image and caption

create-post-with-image.mov

Create post with embed code

Create.Post.with.Code.1.mov

Setup

  • Facebook Developer App
  • Instagram Page
  • Facebook Page to get access token
  • AWS S3 Bucket to upload image
  • OpenAI to generate posts
  • Discord Server

Create Facebook Developer App

  • App type: Business

  • FACEBOOK_ACCESS_TOKEN: We should use Long-Lived User Access Token because it never expires. Read more here

The documents said it must be Long-Live Page Access Token that is now wrong - expired time is only 2 hours

  • Shorted-Lived access token: 1 hour
  • Page Long-Lived access token: 2 hours
  • User Long-Lived access token: never expired

Installation

$ pnpm install

Copy secret env

cp .env.example .env

We need these env to start the app

FACEBOOK_ACCESS_TOKEN=
INSTAGRAM_ACCOUNT_ID=

AWS_S3_BUCKET_NAME=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=

OPENAPI_API_KEY=

DISCORD_APP_ID=
DISCORD_TOKEN=
DISCORD_PUBLIC_KEY=
DISCORD_CHANNEL_ID=
DISCORD_BUG_REPORT_CHANNEL_ID=

Update the run scripts

Add the copy-code2image-public script in package.json to copy the code2image public director to your build folder. Update the build/start:dev/start:debug script to use the copy-code2image-public script.

"scripts": {
    "copy-code2image-public": "mkdirp dist/public && ncp node_modules/@harrylowkey/code2image/public dist/public",
    "build": "npm run copy-code2image-public && nest build",
    "start:dev": "npm run copy-code2image-public && nest start --watch",
    "start:debug": "npm run copy-code2image-public && nest start --debug --watch",
}

Running the app

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published