fastapi-whatsapp-api 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ import json
2
+ import urllib.request
3
+ import urllib.error
4
+
5
+ class FastAPIWhatsApp:
6
+ def __init__(self, api_key: str):
7
+ if not api_key:
8
+ raise ValueError("🛑 [5MinutesAPI]: API Key required! Register at https://5minutesapi.com")
9
+ self.api_key = api_key
10
+ self.base_url = "https://api.5minutesapi.com/v1/send-message"
11
+
12
+ def send_alert(self, to: str, template: str, variables: list = []):
13
+ clean_phone = ''.join(filter(str.isdigit, str(to)))
14
+ payload = {"to": clean_phone, "whatsapp_template": template, "variables": variables}
15
+
16
+ req = urllib.request.Request(self.base_url, data=json.dumps(payload).encode('utf-8'))
17
+ req.add_header('Authorization', f'Bearer {self.api_key}')
18
+ req.add_header('Content-Type', 'application/json')
19
+
20
+ try:
21
+ with urllib.request.urlopen(req) as res:
22
+ return json.loads(res.read().decode('utf-8'))
23
+ except urllib.error.HTTPError as e:
24
+ raise Exception(f"5MinutesAPI Error: {e.read().decode('utf-8')}")
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastapi-whatsapp-api
3
+ Version: 1.0.0
4
+ Summary: FastAPI WhatsApp integration via Official Meta API.
5
+ Home-page: https://5minutesapi.com
6
+ Author: 5MinutesAPI
7
+ Requires-Python: >=3.6
8
+ Description-Content-Type: text/markdown
9
+ Dynamic: author
10
+ Dynamic: description
11
+ Dynamic: description-content-type
12
+ Dynamic: home-page
13
+ Dynamic: requires-python
14
+ Dynamic: summary
15
+
16
+ # FastAPI WhatsApp Integration - 5MinutesAPI âš¡
17
+ Send instant WhatsApp alerts and OTPs from your FastAPI microservices using the Official Meta API. Zero Markup!
18
+
19
+ ## 🛑 Important: API Key Needed
20
+ Generate your API Key at [5minutesapi.com](https://5minutesapi.com).
21
+
22
+ ## Usage
23
+ ```python
24
+ from fastapi_whatsapp import FastAPIWhatsApp
25
+ whatsapp = FastAPIWhatsApp("5m_live_YOUR_KEY")
26
+ whatsapp.send_alert("923001234567", "system_alert", ["Server Down!"])
@@ -0,0 +1,5 @@
1
+ fastapi_whatsapp/__init__.py,sha256=j1T0V_SBmYYYikrL9wt7j1h49xZjb7v8lmuvHvbYMlY,1082
2
+ fastapi_whatsapp_api-1.0.0.dist-info/METADATA,sha256=lvqmzFaIGkVyEYgPATBq7XEAWHw2N9YlvAGBiB7Is78,849
3
+ fastapi_whatsapp_api-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
4
+ fastapi_whatsapp_api-1.0.0.dist-info/top_level.txt,sha256=4UkyUtLI2r__g_9NPEYMLw6SkEZNj_paimKbEtQ9xVw,17
5
+ fastapi_whatsapp_api-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ fastapi_whatsapp