# Install and configure Instagram-Meta-Business-API-Handler

Follow the source instructions for **Instagram-Meta-Business-API-Handler**. Read the prerequisites and configuration steps before running an example.

## Prerequisites

1. **Meta Business Account** - Sign up at [business.facebook.com](https://business.facebook.com)
2. **Facebook App** - Create at [developers.facebook.com](https://developers.facebook.com)
3. **Instagram Business Account** - Convert your Instagram account to Business
4. **Access Token** - Generate long-lived access token
5. **Required Permissions**:
   - `instagram_basic`
   - `instagram_content_publish`
   - `instagram_manage_comments`
   - `instagram_manage_insights`
   - `instagram_manage_messages`

## Installation

```bash
npm install instagram-meta-handler
```

## Quick Start

```typescript
import InstagramHandler from 'instagram-meta-handler';

const instagram = new InstagramHandler({
  accessToken: 'YOUR_ACCESS_TOKEN',
  instagramBusinessAccountId: 'YOUR_IG_BUSINESS_ACCOUNT_ID',
  version: 'v21.0' // optional, defaults to v21.0
});

// Post an image
const mediaId = await instagram.postImage(
  'https://example.com/image.jpg',
  'Amazing photo! #instagram'
);
```

## Media Requirements

### Images
- Format: JPEG, PNG
- Max size: 8MB
- Min resolution: 320px
- Aspect ratio: 1.91:1 to 4:5

### Videos
- Format: MP4, MOV
- Max size: 100MB
- Max length: 60 seconds (feed), 15 seconds (stories)
- Frame rate: 30fps max
- Audio: AAC, 128kbps

### Stories
- Format: JPEG, PNG (image), MP4 (video)
- Max size: 100MB
- Duration: 15 seconds max (video)
- Aspect ratio: 9:16

## Check the installation

After setup, continue with the [first example](/docs/up-to-code-instagram-meta-business-api-handler/quick-start-guide). If a command fails, compare the runtime version, working directory, and required configuration with the original README before changing dependencies.

## Source and help

- [GitHub repository](https://github.com/Up-to-code/Instagram-Meta-Business-API-Handler)
- [Original README](https://github.com/Up-to-code/Instagram-Meta-Business-API-Handler/blob/main/README.md)
- [Issues and existing reports](https://github.com/Up-to-code/Instagram-Meta-Business-API-Handler/issues)
