https://github.com/4techsadiq/whatsapp-invoice
https://github.com/4techsadiq/whatsapp-invoice
invoice-generator python
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/4techsadiq/whatsapp-invoice
- Owner: 4TechSadiq
- License: gpl-3.0
- Created: 2024-06-24T10:01:15.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T06:10:29.000Z (about 2 years ago)
- Last Synced: 2025-02-02T05:42:45.711Z (over 1 year ago)
- Topics: invoice-generator, python
- Language: Python
- Homepage:
- Size: 515 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Invoice Automation System
## Overview
The Invoice Automation System is designed to automate the process of generating, uploading, and sending invoices via WhatsApp. This project utilizes several tools and libraries including PIL for image handling, Cloudinary for image uploading, Twilio for messaging, and docxtpl for document generation and manipulation.
## Project Structure
The project consists of three main modules:
1. **Invoice Manager**: Handles the creation and formatting of invoices.
2. **URL Generator**: Uploads the invoice images to Cloudinary and retrieves the URL.
3. **Message Manager**: Sends the invoice URL to clients via WhatsApp using Twilio.
## Modules
### 1. Invoice Manager
This module generates an invoice in `.docx` format, converts it to `.pdf`, and finally converts the `.pdf` to an image (`.png`).
#### Dependencies
- `docxtpl`
- `docx2pdf`
- `fitz`
- `os`
#### Function
```python
def invoice(template, name, logo, date, invoice_number, company_address, invoice_to, amount):
# Implementation details here
pass
```
### 2. URL Generator
This module uploads the generated invoice image to Cloudinary and retrieves the secure URL of the uploaded image.
#### Dependencies
- `cloudinary`
- `os`
#### Function
```python
def get_url(image):
# Function implementation here
pass
```
### 3. Message Manager
This module sends a WhatsApp message to the client with the invoice URL using Twilio.
#### Dependencies
- `twilio`
- `os`
#### Function
```python
def message(url, name, date):
# Function implementation here
pass
```
## Configuration
#### Cloudinary Configuration
Set up your Cloudinary credentials in the cloudinary.config:
```python
cloudinary.config(
cloud_name = 'your_cloud_name',
api_key = 'your_api_key',
api_secret = 'your_api_secret',
secure = True
)
```
#### Twilio Configuration
```python
account_sid = 'your_account_sid'
auth_token = 'your_auth_token'
from_number = 'whatsapp:your_twilio_number_here'
to_number = 'whatsapp:client_number_here'
```
## Usage
### Main Script
The main script integrates all modules to generate the invoice, upload it to Cloudinary, and send it via WhatsApp
#### Dependencies
- `invoiceManager`
- `urlGenerator`
- `messageManager`
```python
from invoiceManager import invoice
from urlGen import get_url
from messageManager import message
# Invoice Generation
#Example Data
image = invoice('invoice.docx', 'demo', 'image.png', 'July 8, 2019', '1234', 'company address', 'invoice to address', '1000.00')
# Invoice image to URL
url = get_url(image)
# Send Invoice
message(url=url, name='demo', date='July 8, 2019')
```
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/your_username/your_repository.git
```
2. **Install the required packages:**
Ensure you have Python and pip installed. Then, install the necessary Python packages by running:
```bash
pip install -r requirements.txt
```
Alternatively, install them individually:
```bash
pip install pillow cloudinary twilio docxtpl docx2pdf pymupdf
```
Replace https://github.com/your_username/your_repository.git with the actual URL of your Git repository. If you have a requirements.txt file listing all dependencies, use pip install -r requirements.txt to install them in one go. If not, install each package individually as shown.
## Contributing
Feel free to open issues or submit pull requests. Contributions are welcome!
## License
This project is licensed under the GPL-3.0 license.