Python sdk for Infobip's API
Project description
infobip-api-python-sdk
Python client for Infobip's API channels.
Supported channels
Table of contents:
General Info
For infobip-api-python-sdk
versioning we use Semantic Versioning scheme.
Python 3.6 is minimum supported version by this library.
License
Published under MIT License.
Installation
Install the library by using the following command:
pip install infobip-api-python-sdk
Code Example
To use the package you'll need an Infobip account. If you don't already have one, you can create a free trial account here.
In this example we will show how to send WhatsApp text message. First step is to import necessary channel, in this case WhatsApp channel.
from infobip_channels import WhatsAppChannel
Now you can create instance of WhatsAppChannel
with your base_url
and api_key
.
c = WhatsAppChannel.from_auth_params({
"base_url": "<your_base_url>",
"api_key": "<your_api_key>"
})
After that you can access all the methods from WhatsAppChannel
.
To send text message you can use send_text_message
method and add correct payload:
response = c.send_text_message(
{
"from": "<WhatsApp sender number from your Infobib account>",
"to": "<Number that will receive WhatsApp message>",
"messageId": "a28dd97c-1ffb-4fcf-99f1-0b557ed381da",
"content": {
"text": "Some text"
},
"callbackData": "Callback data",
"notifyUrl": "https://www.example.com/whatsapp"
}
)
Testing
To run tests position yourself in the project's root while your virtual environment is active and run:
python -m pytest
Enable pre-commit hooks
To enable pre-commit hooks run:
pip install -r requirements/dev.txt
You will need to install pre-commit hooks Using homebrew:
brew install pre-commit
Using conda (via conda-forge):
conda install -c conda-forge pre-commit
To check installation run:
pre-commit --version
If installation was successful you will see version number.
You can find the Pre-commit configuration in .pre-commit-config.yaml
.
Install the git hook scripts:
pre-commit install
Run against all files:
pre-commit run --all-files
If setup was successful pre-commit will run on every commit.
Every time you clone a project that uses pre-commit, running pre-commit install
should be the first thing you do.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for infobip-api-python-sdk-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eca82f2b0ee8909d0fcf29c28b502b0806373b7cc9b46fd4be7c3bdd8935122 |
|
MD5 | f6974115632b569a9345ef0e3d1fdab5 |
|
BLAKE2b-256 | 088bd65f8623c740121761ea64a01c59279b8d342d5c2ae15f18d63c84af1086 |
Hashes for infobip_api_python_sdk-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db5089fe90d1106edf32a788005c481ec57fd48250ed7210554df599cfe790f |
|
MD5 | 068af8f498ab7908db396eeb18b7c8b0 |
|
BLAKE2b-256 | f4fe38519ac96d221019182dd3fe6c1040586d358b0eeab86896e5894af9af7f |