# whatsapp-wrapper
Integration layer for WhatsApp Cloud API with Firestore for easy message storage and management.
# WhatsApp Cloud API Python Package
The WhatsAppAPI Python package provides a comprehensive and easy-to-use interface for interacting with WhatsApp's API.
This package enables developers to integrate WhatsApp messaging capabilities into their applications effortlessly.
From sending texts, images, videos, and documents to handling media files and managing message databases, this package
covers a wide range of functionalities to enhance communication solutions.
## Some Features
- **Send Messages**: Send text messages, images, videos, documents, audio, and stickers.
- **Media Management**: Upload and retrieve media files with support for temporary file caching.
- **Database Integration**: Optional [Firestore](https://firebase.google.com/docs/firestore) database integration to
save chats and messages.
- **Custom Error Handling**: Implement custom error handling for robust application performance.
- **Message Replies**: Reply to messages to maintain context in conversations.
- **URL Previews**: Generate previews for URLs in text messages.
- **Message Reactions**: Add emoji reactions to messages.
## Installation
To install WhatsAppAPI, use pip:
```bash
pip install whatsappapi
```
## Quick Start
### Setting Up
To get started, import the `WhatsAppAPI` class from the package and configure it with your mobile ID and API token.
```python
from whatsapp_wrapper import WhatsAppAPI
api = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token')
```
### Sending a Text Message
Sending a text message is straightforward:
```python
api.send_text(to='recipient_number', message='Hello, World!')
```
### Sending an Image
To send an image:
```python
api.send_image(to='recipient_number', image_id_or_url='image_url', caption='Check this out!')
```
### Saving Messages to Database
If you want to save messages to a [Firestore database](https://firebase.google.com/docs/firestore), you need to provide
a `DatabaseConfig` during initialization:
```python
from whatsapp_wrapper.whatsapp_db import DatabaseConfig
db_config: DatabaseConfig = {
'credential_path': 'path/to/your/firestore/credential.json',
'backup_folder': 'path/to/backup/folder'
}
api = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token', database_config=db_config)
```
Messages will then be automatically saved to the database.
## Handling Errors
You can provide a custom error handler function during initialization to handle API errors according to your
application's requirements.
```python
def custom_error_handler(response, data):
# Custom error handling logic
pass
api = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token', error_handler=custom_error_handler)
```
## References
### WhatsApp Documentation
- [API Endpoint References](https://developers.facebook.com/docs/whatsapp/cloud-api/reference)
- [Messages](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages)
- [API Error Codes](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes)
### Graph API Documentation
- [WhatsApp Business Account](https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account/)
## Support and Contributions
For support, please open an issue on the project's GitHub page.
Contributions are welcome!
If you'd like to contribute,
please fork the repository and submit a pull request.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/AntonioVentilii/whatsapp-wrapper",
"name": "whatsapp-wrapper",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "WhatsApp, Firestore, API, integration, messaging",
"author": "Antonio Ventilii",
"author_email": "antonioventilii@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a2/64/5b2517825af8c52996098da65a323c6f6f73da5ad1c4462c1ad652aac00f/whatsapp_wrapper-0.1.6.tar.gz",
"platform": null,
"description": "# whatsapp-wrapper\n\nIntegration layer for WhatsApp Cloud API with Firestore for easy message storage and management.\n\n# WhatsApp Cloud API Python Package\n\nThe WhatsAppAPI Python package provides a comprehensive and easy-to-use interface for interacting with WhatsApp's API.\nThis package enables developers to integrate WhatsApp messaging capabilities into their applications effortlessly.\nFrom sending texts, images, videos, and documents to handling media files and managing message databases, this package\ncovers a wide range of functionalities to enhance communication solutions.\n\n## Some Features\n\n- **Send Messages**: Send text messages, images, videos, documents, audio, and stickers.\n- **Media Management**: Upload and retrieve media files with support for temporary file caching.\n- **Database Integration**: Optional [Firestore](https://firebase.google.com/docs/firestore) database integration to\n save chats and messages.\n- **Custom Error Handling**: Implement custom error handling for robust application performance.\n- **Message Replies**: Reply to messages to maintain context in conversations.\n- **URL Previews**: Generate previews for URLs in text messages.\n- **Message Reactions**: Add emoji reactions to messages.\n\n## Installation\n\nTo install WhatsAppAPI, use pip:\n\n```bash\npip install whatsappapi\n```\n\n## Quick Start\n\n### Setting Up\n\nTo get started, import the `WhatsAppAPI` class from the package and configure it with your mobile ID and API token.\n\n```python\nfrom whatsapp_wrapper import WhatsAppAPI\n\napi = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token')\n```\n\n### Sending a Text Message\n\nSending a text message is straightforward:\n\n```python\napi.send_text(to='recipient_number', message='Hello, World!')\n```\n\n### Sending an Image\n\nTo send an image:\n\n```python\napi.send_image(to='recipient_number', image_id_or_url='image_url', caption='Check this out!')\n```\n\n### Saving Messages to Database\n\nIf you want to save messages to a [Firestore database](https://firebase.google.com/docs/firestore), you need to provide\na `DatabaseConfig` during initialization:\n\n```python\nfrom whatsapp_wrapper.whatsapp_db import DatabaseConfig\n\ndb_config: DatabaseConfig = {\n 'credential_path': 'path/to/your/firestore/credential.json',\n 'backup_folder': 'path/to/backup/folder'\n}\n\napi = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token', database_config=db_config)\n```\n\nMessages will then be automatically saved to the database.\n\n## Handling Errors\n\nYou can provide a custom error handler function during initialization to handle API errors according to your\napplication's requirements.\n\n```python\ndef custom_error_handler(response, data):\n # Custom error handling logic\n pass\n\n\napi = WhatsAppAPI(mobile_id='your_mobile_id', api_token='your_api_token', error_handler=custom_error_handler)\n```\n\n## References\n\n### WhatsApp Documentation\n\n- [API Endpoint References](https://developers.facebook.com/docs/whatsapp/cloud-api/reference)\n - [Messages](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages)\n- [API Error Codes](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes)\n\n### Graph API Documentation\n\n- [WhatsApp Business Account](https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account/)\n\n## Support and Contributions\n\nFor support, please open an issue on the project's GitHub page.\nContributions are welcome!\nIf you'd like to contribute,\nplease fork the repository and submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Integration layer for WhatsApp Cloud API with Firestore for easy message storage and management.",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/AntonioVentilii/whatsapp-wrapper",
"Issue Tracker": "https://github.com/AntonioVentilii/whatsapp-wrapper/issues",
"Source Code": "https://github.com/AntonioVentilii/whatsapp-wrapper"
},
"split_keywords": [
"whatsapp",
" firestore",
" api",
" integration",
" messaging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "445a58b2bfa1768bbf98edf51d79adb8b92d5d55bb53c71d3fe9a7aa38d816f6",
"md5": "db9eeffaaf17fc90f35489fe31c7839c",
"sha256": "4e52340fd1d62653ec3902191cf2de96536bc6eeeace638d1c7c34fd4ddbf878"
},
"downloads": -1,
"filename": "whatsapp_wrapper-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db9eeffaaf17fc90f35489fe31c7839c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13829,
"upload_time": "2024-04-09T16:10:47",
"upload_time_iso_8601": "2024-04-09T16:10:47.865081Z",
"url": "https://files.pythonhosted.org/packages/44/5a/58b2bfa1768bbf98edf51d79adb8b92d5d55bb53c71d3fe9a7aa38d816f6/whatsapp_wrapper-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a2645b2517825af8c52996098da65a323c6f6f73da5ad1c4462c1ad652aac00f",
"md5": "b47ddabe8c2527441e61ff44a66d9cf1",
"sha256": "e3f88e592dc6f3d90556508be7a5900379dd59cd37d94b8f51bd2c54acd16fbb"
},
"downloads": -1,
"filename": "whatsapp_wrapper-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "b47ddabe8c2527441e61ff44a66d9cf1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13446,
"upload_time": "2024-04-09T16:10:49",
"upload_time_iso_8601": "2024-04-09T16:10:49.468490Z",
"url": "https://files.pythonhosted.org/packages/a2/64/5b2517825af8c52996098da65a323c6f6f73da5ad1c4462c1ad652aac00f/whatsapp_wrapper-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-09 16:10:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AntonioVentilii",
"github_project": "whatsapp-wrapper",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "whatsapp-wrapper"
}