Skip to content

Commit ade65ab

Browse files
first commit
0 parents  commit ade65ab

10 files changed

Lines changed: 507 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install requests
22+
- name: Lint with flake8
23+
run: |
24+
pip install flake8
25+
flake8 wams_sdk
26+
- name: Run example (basic import test)
27+
run: |
28+
python wams_sdk/example.py || true

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributing to Wams Python SDK
2+
3+
Thank you for your interest in contributing!
4+
5+
## How to Contribute
6+
7+
1. Fork the repository
8+
2. Create a new branch for your feature or bugfix
9+
3. Make your changes and add tests if needed
10+
4. Ensure all code is formatted and linted
11+
5. Submit a pull request with a clear description
12+
13+
## Code Style
14+
- Follow PEP8 for Python code
15+
- Use clear, descriptive variable and function names
16+
17+
## Issues
18+
- Please use GitHub Issues for bug reports and feature requests
19+
20+
## Pull Requests
21+
- One feature/fix per PR
22+
- Add tests for new features
23+
- Ensure all tests pass before submitting
24+
25+
Thank you for helping improve the SDK!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
2+
3+
<p align="center">
4+
<img src="https://img.shields.io/pypi/v/wams-sdk.svg?style=flat-square" alt="PyPI">
5+
<img src="https://img.shields.io/github/workflow/status/yourusername/wams-python-sdk/Python%20package/main?style=flat-square" alt="CI">
6+
<img src="https://img.shields.io/github/license/yourusername/wams-python-sdk?style=flat-square" alt="License">
7+
</p>
8+
9+
# Wams Python SDK
10+
## Contributing
11+
12+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
13+
14+
Pure Python SDK for sending all types of WhatsApp messages via the Wams API.
15+
16+
## Features
17+
18+
- Send text messages
19+
- Send media (images, videos, audio, documents)
20+
- Send interactive messages (buttons, lists)
21+
- Send location
22+
- Send contact cards (vCard)
23+
- Send product messages
24+
- Send text to WhatsApp channels
25+
- Send stickers
26+
- Send polls
27+
28+
## Installation
29+
30+
```bash
31+
pip install requests
32+
# or
33+
pip install -r requirements.txt
34+
```
35+
36+
## Usage
37+
38+
```python
39+
from wams_sdk import WamsClient
40+
41+
client = WamsClient(api_key="YOUR_API_KEY", sender="YOUR_NUMBER")
42+
43+
# Send a text message
44+
resp = client.send_text(number="RECIPIENT", message="Hello World!", footer="Sent via wams")
45+
print(resp)
46+
47+
# Send an image
48+
resp = client.send_media(number="RECIPIENT", media_type="image", url_="https://example.com/image.jpg", caption="Check this image!", footer="Sent via wams")
49+
print(resp)
50+
51+
# Send a button message
52+
buttons = [
53+
{"type": "reply", "displayText": "Reply Button"},
54+
{"type": "call", "displayText": "Call Button", "phoneNumber": "1234567890"},
55+
{"type": "url", "displayText": "URL Button", "url": "https://google.com"},
56+
{"type": "copy", "displayText": "Copy Button", "copyText": "123123"}
57+
]
58+
resp = client.send_button(number="RECIPIENT", message="Choose an option", button=buttons, image="https://example.com/image.jpg", footer="optional")
59+
print(resp)
60+
61+
# Send a list message
62+
sections = [
63+
{
64+
"title": "Main Options",
65+
"description": "Select a basic option to proceed.",
66+
"rows": [
67+
{"title": "Option 1", "rowId": "id1", "description": "Description for option 1"},
68+
{"title": "Option 2", "rowId": "id2", "description": "Description for option 2"}
69+
]
70+
},
71+
{
72+
"title": "Advanced Options",
73+
"description": "Explore advanced settings.",
74+
"rows": [
75+
{"title": "Option 3", "rowId": "id3", "description": "Description for option 3"}
76+
]
77+
}
78+
]
79+
resp = client.send_list(number="RECIPIENT", name="Message list", title="title list", buttontext="Menu", message="Hello, this is a list button message", sections=sections, image="https://example.com/image.jpg", footer="optional")
80+
print(resp)
81+
82+
# Send location
83+
resp = client.send_location(number="RECIPIENT", latitude="24.121231", longitude="55.1121221")
84+
print(resp)
85+
86+
# Send vCard
87+
resp = client.send_vcard(number="RECIPIENT", name="magd", phone="1234567890")
88+
print(resp)
89+
90+
# Send product message
91+
resp = client.send_product(number="RECIPIENT", url_="https://wa.me/p/12345678901234567/RECIPIENT", message="Check out this item!")
92+
print(resp)
93+
94+
# Send text to channel
95+
resp = client.send_text_channel(url_="https://whatsapp.com/channel/ABCDEF123456", message="Hello World", footer="Sent via wams")
96+
print(resp)
97+
98+
# Send sticker
99+
resp = client.send_sticker(number="RECIPIENT", url_="https://example.com/image.jpg")
100+
print(resp)
101+
102+
# Send poll
103+
resp = client.send_poll(number="RECIPIENT", name="What color do you like?", option=["red", "blue", "yellow"], countable="1")
104+
print(resp)
105+
```
106+
107+
## API Reference
108+
109+
All methods return the JSON response from the Wams API.
110+
111+
**Constructor**
112+
113+
WamsClient(api_key: str, sender: str)
114+
115+
**Methods**
116+
117+
- `send_text(number, message, footer=None, msgid=None, full=None)`
118+
- `send_media(number, media_type, url_, caption=None, footer=None, msgid=None, full=None)`
119+
- `send_button(number, message, button, image, footer=None)`
120+
- `send_list(number, name, title, buttontext, message, sections, image, footer=None, msgid=None, full=None)`
121+
- `send_location(number, latitude, longitude, msgid=None, full=None)`
122+
- `send_vcard(number, name, phone, msgid=None, full=None)`
123+
- `send_product(number, url_, message=None, msgid=None, full=None)`
124+
- `send_text_channel(url_, message, footer=None, full=None)`
125+
- `send_sticker(number, url_, msgid=None, full=None)`
126+
- `send_poll(number, name, option, countable="1", msgid=None, full=None)`
127+
128+
See [wams_sdk/example.py](wams_sdk/example.py) for full working examples.
129+
130+
## License
131+
132+
MIT

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "wams-sdk"
7+
version = "0.1.0"
8+
description = "Pure Python SDK for sending WhatsApp messages via the Wams API."
9+
authors = [
10+
{ name = "Muhammad zain ul abidin", email = "zaincoder786@gmail.com" }
11+
]
12+
readme = "README.md"
13+
license = { file = "LICENSE" }
14+
requires-python = ">=3.7"
15+
dependencies = [
16+
"requests>=2.0.0"
17+
]
18+
19+
[project.urls]
20+
Homepage = "https://github.com/zainsardar-tech/wams-python-sdk"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests>=2.0.0

setup.cfg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[metadata]
2+
3+
name = wams-sdk
4+
version = 0.1.0
5+
description = Pure Python SDK for sending WhatsApp messages via the Wams API.
6+
long_description = file: README.md
7+
long_description_content_type = text/markdown
8+
author = Muhammad zain ul abidin
9+
author_email = zaincoder786@gmail.com
10+
url = https://github.com/zainsardar-tech/wams-python-sdk
11+
license = MIT
12+
13+
[options]
14+
packages = find:
15+
python_requires = >=3.7
16+
install_requires =
17+
requests>=2.0.0
18+
19+
[options.package_data]
20+
* = *.md

wams_sdk/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Wams SDK package
2+
from .client import WamsClient

0 commit comments

Comments
 (0)