Metadata-Version: 2.4
Name: hiinsta
Version: 0.7.1
Summary: A wrapper for Instagram's messaging API
Home-page: https://github.com/cervant-ai/hiinsta
Author: Tomas Santana
Author-email: Tomas Santana <tomas@cervant.chat>
License: MIT
Project-URL: Homepage, https://github.com/cervant-ai/hiinsta
Project-URL: Repository, https://github.com/cervant-ai/hiinsta.git
Project-URL: Issues, https://github.com/cervant-ai/hiinsta/issues
Keywords: hiinsta,python,package
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.11.7
Requires-Dist: httpx>=0.28.1
Requires-Dist: requests>=2.25.1
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.8.0; extra == "dev"
Requires-Dist: mypy>=0.800; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# hiinsta

A Python package for interacting with Instagram's messaging API.

## Installation

```bash
pip install hiinsta
```

## Usage

```python
from hiinsta import InstagramMessenger

messenger = InstagramMessenger(access_token="YOUR_ACCESS_TOKEN")

# Example usage
message_id = await messenger.send_text("Hello, World!", recipient_id="RECIPIENT_ID")

print(message_id)
```

## Webhook verification

Verify Meta's signature against the raw request body before parsing JSON:

```python
from hiinsta import verify_signature

raw_body = request.get_data()
if not verify_signature(
    app_secret="YOUR_APP_SECRET",
    raw_body=raw_body,
    header=request.headers.get("X-Hub-Signature-256", ""),
):
    abort(403)

payload = request.get_json()
```

Do not hash `json.dumps(request.get_json())`; parsing and re-serializing can
change whitespace or key ordering and will invalidate Meta's signature.

For Meta's webhook subscription handshake:

```python
from hiinsta import verify_subscription

challenge = verify_subscription(request.args, verify_token="YOUR_VERIFY_TOKEN")
if challenge is None:
    abort(403)
return challenge
```

## Development

To install in development mode:

```bash
git clone https://github.com/cervant-ai/hiinsta.git
cd hiinsta
pip install -e .
```

To install development dependencies:

```bash
pip install -e ".[dev]"
```

## Testing

```bash
pytest
```

```bash
pip install -e ".[dev]"
```

## Testing

```bash
pytest
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.
