1- # infobip-python-channels
2- Python client for Infobip's channels API.
1+ # infobip-api- python-sdk
2+ Python client for Infobip's API channels .
33
4+ #### Table of contents:
5+
6+ - [ General Info] ( #general-info )
7+ - [ License] ( #license )
8+ - [ Installation] ( #installation )
9+ - [ Code example] ( #code-example )
10+ - [ Testing] ( #testing )
11+ - [ Enable pre-commit hooks] ( #enable-pre-commit-hooks )
12+ - [ Generating distribution package] ( #generating-distribution-package )
13+ - [ Uploading distribution package on TestPyPI] ( #uploading-distribution-package-on-testpypi-for-testing-purposes )
14+ - [ Installing your newly uploaded package] ( #installing-your-newly-uploaded-package )
15+
16+
17+ ## General Info
18+
19+ For ` infobip-api-python-sdk ` versioning we use [ Semantic Versioning] ( https://semver.org ) scheme.
20+
21+ Python 3.6 is minimum supported version by this library.
22+
23+ ## License
24+
25+ Published under [ MIT License] ( LICENSE ) .
26+
27+ ## Installation
28+
29+ Install the library by using the following command:
30+ ```
31+ pip install infobip-api-python-sdk
32+ ```
33+
34+ ## Code Example
35+ To use the package you'll need an Infobip account.
36+ If you don't already have one, you can create a free trial account [ here] ( https://www.infobip.com/signup ) .
37+
38+ In this example we will show how to send WhatsApp text message.
39+ First step is to import necessary channel, in this case WhatsApp channel.
40+
41+ ```
42+ from infobip_channels import WhatsAppChannel
43+ ```
44+
45+ Now you can create instance of ` WhatsAppChannel ` with your ` base_url ` and ` api_key ` .
46+
47+ ```
48+ c = WhatsAppChannel.from_auth_params({
49+ "base_url": "<your_base_url>",
50+ "api_key": "<your_api_key>"
51+ })
52+ ```
53+ After that you can access all the methods from ` WhatsAppChannel ` .
54+ To send text message you can use ` send_text_message ` method and add correct payload:
55+ ```
56+ response = c.send_text_message(
57+ {
58+ "from": "<WhatsApp sender number from your Infobib account>",
59+ "to": "<Number that will receive WhatsApp message>",
60+ "messageId": "a28dd97c-1ffb-4fcf-99f1-0b557ed381da",
61+ "content": {
62+ "text": "Some text"
63+ },
64+ "callbackData": "Callback data",
65+ "notifyUrl": "https://www.example.com/whatsapp"
66+ }
67+ )
68+ ```
469## Testing
5- To run tests position yourself in the project's root while your virual environment
70+ To run tests position yourself in the project's root while your virtual environment
671is active and run:
772```
873python -m pytest
@@ -27,7 +92,7 @@ To check installation run:
2792pre-commit --version
2893```
2994If installation was successful you will see version number.
30- Pre-commit configuration you can find in ` .pre-commit-config.yaml ` .
95+ You can find the Pre-commit configuration in ` .pre-commit-config.yaml ` .
3196Install the git hook scripts:
3297```
3398pre-commit install
@@ -36,9 +101,9 @@ Run against all files:
36101```
37102pre-commit run --all-files
38103```
39- If setup was successful pre-commit will run will now run on every commit.
40- Every time you clone a project using pre-commit running ` pre-commit install `
41- should always be the first thing you do.
104+ If setup was successful pre-commit will run on every commit.
105+ Every time you clone a project that uses pre-commit, running ` pre-commit install `
106+ should be the first thing you do.
42107
43108
44109## Generating distribution package
@@ -47,10 +112,11 @@ Make sure you have the latest version of PyPA's
47112```
48113python -m pip install --upgrade build
49114```
50-
115+ After installation check ` setup.cfg ` file for metadata.
116+ Name and version are used for file generation.
117+ Make sure that you appropriately change version before build.
51118Update the ` version ` in the ` setup.cfg ` file to the desired one.
52119
53-
54120Now run this command from the same directory where pyproject.toml is located:
55121```
56122python -m build
0 commit comments