Text-sdk-python
A helper library to sending messages using python.
Want to send messages in your Python application? Then you are at the right address. If you want to get all the functionalities, go to: CM.com API Docs
Installing
Include the SDK by downloading the files manually or running the following command in a Python Shell.
pip install cm_text_sdk_python
Instantiate the client
Use your productToken which authorizes you on the CM platform. Get yours on CM.com
from cm_text import TextClient
client = TextClient(apikey=key)
Send a message
By calling SendSingleMessage and providing message text, sender name, recipient phone number(s).
client = TextClient(apikey=key)
client.SendSingleMessage(message=message, from_='CM.com', to=Recipients)
Sending multiple messages
By calling AddMessage and providing message text, sender name, recipient phone number(s) you can queue multiple messages. Send them by calling send.
client = TextClient(apikey=key)
client.AddMessage(message=message, from_='pythonSDK', to=Recipients)
client.AddMessage(message=message2, from_='pythonSDK', to=Recipients2)
response = client.send()
Sending a rich message
By calling AddRichMessage and providing Media, message text, sender name, recipient phone number(s) you can queue multiple Rich messages. Send them by calling send.
media = {
"mediaName": "conversational-commerce",
"mediaUri": "https://www.cm.com/cdn/cm/cm.png",
"mimeType": "image/png"
}
client = TextClient(apikey=key)
client.AddRichMessage(message=message, from_='pythonSDK', to=to, allowedChannels=allowedChannels, media=media)
response = client.send()
Sending a Whatsapp Template message
By calling AddWhatsappTemplateMessage and providing Template, sender name, recipient phone number(s) you can queue multiple Whatsapp Template messages. Send them by calling send.
template_namespace = "Your-Template-Namespace"
template_element_name = "Replace with Template Name"
template = WhatsappTemplate(template_namespace, template_element_name)
client = TextClient(apikey=key)
client.AddWhatsappTemplateMessage(from_='pythonSDK', to=to, template=template)
response = client.send()
See Examples folder for more examples.
Sending Interactive Whatsapp message
See the example file for an example.
Get the result
Sending a message by calling send returns the response body. Response is of type: https://requests.readthedocs.io/en/master/user/quickstart/#response-content
response = client.send()
Metadata
Release files for cm-text-sdk-python 2.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cm_text_sdk_python-2.0.4.tar.gz | 8.9 kB | Without provenance | Details for cm_text_sdk_python-2.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cm_text_sdk_python-2.0.4-py3-none-any.whl | Python 3 | none | any | Details for cm_text_sdk_python-2.0.4-py3-none-any.whl |
Total release size: 20.5 kB
Release files / cm_text_sdk_python-2.0.4.tar.gz
| Download URL | cm_text_sdk_python-2.0.4.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed77efe1df96ca5e50f1de8d6416e897f267105e127efe6421a4da50d35419c2
|
|
BLAKE2b-256 checksum How to use checksums |
b039565498674ea81fdc34617106be42a60312762904bf6886b81a637e7d742d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.12
|
Release files / cm_text_sdk_python-2.0.4-py3-none-any.whl
| Download URL | cm_text_sdk_python-2.0.4-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d97be4f410f5008a6c83d7b05c8409bd368fb5ac181ad886cfa2874abc8e252
|
|
BLAKE2b-256 checksum How to use checksums |
20426068972fb65b483943f9e5485214b55cab8b592fe468aeb17cbe4cf1e953
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.12
|
Security for cm-text-sdk-python 2.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.