# tnzapi
## Documentation
The documentation for the TNZ API can be found [here][apidocs].
## Versions
`tnzapi` uses a modified version of [Semantic Versioning](https://semver.org) for all changes. [See this document](VERSIONS.md) for details.
### Supported Python Versions
This library supports the following Python implementations:
* Python 3.9
* Python 3.10
* Python 3.11
## Installation
Install from PyPi using [pip](http://www.pip-installer.org/en/latest/), a
package manager for Python.
pip install tnzapi
Don't have pip installed? Try installing it, by running this from the command
line:
$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
python setup.py install
You may need to run the above commands with `sudo`.
## Getting Started
Getting started with the TNZ API couldn't be easier. Create a
`Client` and you're ready to go.
### API Credentials
The `TNZAPI` needs your TNZ API credentials (TNZ Auth Tokens). You can either pass these
directly to the constructor (see the code below) or via environment variables.
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken = "[Your Auth Token]"
)
```
### Send Message
Send SMS/Email/Voice/Fax through `tnzapi` library.
#### Send SMS
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Messaging.SMS.SendMessage(
Reference="Test",
MessageText = "Test SMS Message click [[Reply]] to opt out",
Recipients = ["+64211231234"],
)
print(response)
```
#### Send an Email
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Messaging.Email.SendMessage(
EmailSubject = "Test Email",
Recipients = [
"recipient@example.com"
],
MessagePlain = "Hi world!"
)
print(response)
```
#### Send a Fax Document
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Messaging.Fax.SendMessage(
Recipients = "+6491232345",
Attachments = ["C:\\Document.pdf"]
)
print(response)
```
#### Make a Call - Text-to-Speech (TTS)
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Messaging.TTS.SendMessage(
Recipients = ["+64211232345"],
Reference = "Voice Test - 64211232345",
MessageToPeople = "Hi there!",
Keypads = [
Keypad(
Tone=1,
Play="You pressed 1",
RouteNumber="+6491232345"
)
]
)
print(response)
```
#### Make a Call - Upload MP3 / Wav File
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Messaging.Voice.SendMessage(
Recipients = ["+64211232345"],
Reference = "Voice Test - 64211232345",
MessageToPeople = "C:\\file1.wav",
MessageToAnswerPhones = "C:\\file2.wav",
Keypads = [
Keypad(
Tone=1,
RouteNumber="+6491232345",
PlayFile="C:\\file3.wav"
)
]
)
print(response)
```
### Reports
Retrieve your message status using `tnzapi` library.
#### Reports - Get Message Status
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Reports.Status.Poll(
MessageID="ID123456"
)
print(response)
```
#### Reports - Get SMS Reply
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
request = client.Reports.SMSReply.Poll(
MessageID="ID123456"
)
print(response)
```
#### Reports - Get SMS Received List
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Reports.SMSReceived.Poll(
#TimePeriod = 1440
DateFrom="2023-07-01 00:00:00",
DateTo="2023-08-01 00:00:00"
)
print(response)
```
### Actions
Amend your message using `tnzapi` library.
#### Actions - Abort Pending/Delayed Job
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Actions.Abort.SendRequest(
MessageID="ID123456"
)
print(response)
```
#### Actions - Resubmit Failed Job
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Actions.Resubmit.SendRequest(
MessageID="ID123456",
SendTime="2023-07-10T09:00" #optional
)
print(response)
```
#### Actions - Reschedule DELAYED Job
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Actions.Reschedule.SendRequest(
MessageID="ID123456",
SendTime=datetime.now()
)
print(response)
```
#### Actions - Set Number of Operators on TTS/Voice Job
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
request = client.Set.Pacing(
MessageID="ID123456",
NumberOfOperators=10
)
print(response)
```
### Addressbook - Contacts
Manage your contacts using `tnzapi` library.
#### Contacts - List
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Contact.List(
RecordsPerPage=10,
Page=1
)
print(response)
```
#### Contacts - Detail
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Contact.Detail(
ContactID="[Contact ID]"
)
print(response)
```
#### Contacts - Create
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Contact.Create(
Title="Mr",
Company="TNZ Group",
FirstName="First",
LastName="Last",
MobilePhone="+642122223333",
ViewPublic="Account",
EditPublid="Account"
)
print(response)
```
#### Contacts - Update
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Contact.Update(
ContactID="[Contact ID]",
Attention="Test Attention"
)
print(response)
```
#### Contacts - Delete
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Contact.Delete(
ContactID="[Contact ID]"
)
print(response)
```
### Addressbook - Contact Group
Manage your contact group relationship using `tnzapi` library.
#### Contact Group - List
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.ContactGroup.List(
RecordsPerPage=10,
Page=1,
ContactID="[Contact ID]"
)
print(response)
```
#### Contact Group - Detail
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.ContactGroup.Detail(
ContactID="[Contact ID]",
GroupCode="[Group Code]"
)
print(response)
```
#### Contact Group - Create
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.ContactGroup.Create(
ContactID="[Contact ID]",
GroupCode="[Group Code]"
)
print(response)
```
#### Contact Group - Delete
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.ContactGroup.Delete(
ContactID="[Contact ID]",
GroupCode="[Group Code]"
)
print(response)
```
### Addressbook - Group
Manage your group using `tnzapi` library.
#### Group - List
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Group.List(
RecordsPerPage=10,
Page=1
)
print(response)
```
#### Group - Detail
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Group.Detail(
GroupCode="[Group Code]"
)
print(response)
```
#### Group - Create
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Group.Create(
GroupCode="[Group Code]",
GroupName="[Group Name]"
)
print(response)
```
#### Group - Update
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Group.Update(
GroupCode="[Group Code]",
GroupName="[Group Name]"
)
print(response)
```
#### Group - Delete
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.Group.Delete(
GroupCode="[Group Code]"
)
print(response)
```
### Addressbook - Group Contact
Manage your group contact relationship using `tnzapi` library.
#### Group Contact - List
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.GroupContact.List(
RecordsPerPage=10,
Page=1,
GroupCode="[Group Code]"
)
print(response)
```
#### Group Contact - Detail
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.GroupContact.Detail(
GroupCode="[Group Code]",
ContactID="[Contact ID]"
)
print(response)
```
#### Group Contact - Create
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.GroupContact.Create(
GroupCode="[Group Code]",
ContactID="[Contact ID]"
)
print(response)
```
#### Group Contact - Delete
```python
from tnzapi import TNZAPI
client = TNZAPI(
AuthToken="[Your Auth Token]"
)
response = client.Addressbook.GroupContact.Delete(
GroupCode="[Group Code]",
ContactID="[Contact ID]"
)
print(response)
```
### Getting help
If you need help installing or using the library, please check the [TNZ Contact](https://www.tnz.co.nz/About/Contact/) if you don't find an answer to your question.
[apidocs]: https://www.tnz.co.nz/Docs/PythonAPI/
Raw data
{
"_id": null,
"home_page": "https://www.tnz.co.nz",
"name": "tnzapi",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "tnz, api, sms, fax, email, voice, tts",
"author": "TNZ Group Limited",
"author_email": "support@tnz.co.nz",
"download_url": "https://files.pythonhosted.org/packages/f1/32/144a32b2181e21508e9ee9425f6a825e28450f5e8390f88d65d040f32c0d/tnzapi-2.4.0.0.tar.gz",
"platform": null,
"description": "# tnzapi\r\n\r\n## Documentation\r\n\r\nThe documentation for the TNZ API can be found [here][apidocs].\r\n\r\n## Versions\r\n\r\n`tnzapi` uses a modified version of [Semantic Versioning](https://semver.org) for all changes. [See this document](VERSIONS.md) for details.\r\n\r\n### Supported Python Versions\r\n\r\nThis library supports the following Python implementations:\r\n\r\n* Python 3.9\r\n* Python 3.10\r\n* Python 3.11\r\n\r\n## Installation\r\n\r\nInstall from PyPi using [pip](http://www.pip-installer.org/en/latest/), a\r\npackage manager for Python.\r\n\r\n pip install tnzapi\r\n\r\nDon't have pip installed? Try installing it, by running this from the command\r\nline:\r\n\r\n $ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python\r\n\r\n python setup.py install\r\n\r\nYou may need to run the above commands with `sudo`.\r\n\r\n## Getting Started\r\n\r\nGetting started with the TNZ API couldn't be easier. Create a\r\n`Client` and you're ready to go.\r\n\r\n### API Credentials\r\n\r\nThe `TNZAPI` needs your TNZ API credentials (TNZ Auth Tokens). You can either pass these\r\ndirectly to the constructor (see the code below) or via environment variables.\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken = \"[Your Auth Token]\"\r\n)\r\n```\r\n\r\n### Send Message\r\n\r\nSend SMS/Email/Voice/Fax through `tnzapi` library.\r\n\r\n#### Send SMS\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Messaging.SMS.SendMessage(\r\n Reference=\"Test\",\r\n MessageText = \"Test SMS Message click [[Reply]] to opt out\",\r\n Recipients = [\"+64211231234\"],\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Send an Email\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Messaging.Email.SendMessage(\r\n EmailSubject = \"Test Email\",\r\n Recipients = [\r\n \"recipient@example.com\"\r\n ],\r\n MessagePlain = \"Hi world!\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Send a Fax Document\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Messaging.Fax.SendMessage(\r\n Recipients = \"+6491232345\",\r\n Attachments = [\"C:\\\\Document.pdf\"]\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Make a Call - Text-to-Speech (TTS)\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Messaging.TTS.SendMessage(\r\n Recipients = [\"+64211232345\"],\r\n Reference = \"Voice Test - 64211232345\",\r\n MessageToPeople = \"Hi there!\",\r\n Keypads = [\r\n Keypad(\r\n Tone=1,\r\n Play=\"You pressed 1\",\r\n RouteNumber=\"+6491232345\"\r\n )\r\n ]\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Make a Call - Upload MP3 / Wav File\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Messaging.Voice.SendMessage(\r\n Recipients = [\"+64211232345\"],\r\n Reference = \"Voice Test - 64211232345\",\r\n MessageToPeople = \"C:\\\\file1.wav\",\r\n MessageToAnswerPhones = \"C:\\\\file2.wav\",\r\n Keypads = [\r\n Keypad(\r\n Tone=1,\r\n RouteNumber=\"+6491232345\",\r\n PlayFile=\"C:\\\\file3.wav\"\r\n )\r\n ]\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Reports\r\n\r\nRetrieve your message status using `tnzapi` library.\r\n\r\n#### Reports - Get Message Status\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Reports.Status.Poll(\r\n MessageID=\"ID123456\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Reports - Get SMS Reply\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nrequest = client.Reports.SMSReply.Poll(\r\n MessageID=\"ID123456\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Reports - Get SMS Received List\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Reports.SMSReceived.Poll(\r\n #TimePeriod = 1440\r\n DateFrom=\"2023-07-01 00:00:00\",\r\n DateTo=\"2023-08-01 00:00:00\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Actions\r\n\r\nAmend your message using `tnzapi` library.\r\n\r\n#### Actions - Abort Pending/Delayed Job\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Actions.Abort.SendRequest(\r\n MessageID=\"ID123456\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Actions - Resubmit Failed Job\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Actions.Resubmit.SendRequest(\r\n MessageID=\"ID123456\",\r\n SendTime=\"2023-07-10T09:00\" #optional\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Actions - Reschedule DELAYED Job\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Actions.Reschedule.SendRequest(\r\n MessageID=\"ID123456\",\r\n SendTime=datetime.now()\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Actions - Set Number of Operators on TTS/Voice Job\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nrequest = client.Set.Pacing(\r\n MessageID=\"ID123456\",\r\n NumberOfOperators=10\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Addressbook - Contacts\r\n\r\nManage your contacts using `tnzapi` library.\r\n\r\n#### Contacts - List\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Contact.List(\r\n RecordsPerPage=10,\r\n Page=1\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contacts - Detail\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Contact.Detail(\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contacts - Create\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Contact.Create(\r\n Title=\"Mr\",\r\n Company=\"TNZ Group\",\r\n FirstName=\"First\",\r\n LastName=\"Last\",\r\n MobilePhone=\"+642122223333\",\r\n ViewPublic=\"Account\",\r\n EditPublid=\"Account\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contacts - Update\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Contact.Update(\r\n ContactID=\"[Contact ID]\",\r\n Attention=\"Test Attention\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contacts - Delete\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Contact.Delete(\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Addressbook - Contact Group\r\n\r\nManage your contact group relationship using `tnzapi` library.\r\n\r\n#### Contact Group - List\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.ContactGroup.List(\r\n RecordsPerPage=10,\r\n Page=1,\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contact Group - Detail\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.ContactGroup.Detail(\r\n ContactID=\"[Contact ID]\",\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contact Group - Create\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.ContactGroup.Create(\r\n ContactID=\"[Contact ID]\",\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Contact Group - Delete\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.ContactGroup.Delete(\r\n ContactID=\"[Contact ID]\",\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Addressbook - Group\r\n\r\nManage your group using `tnzapi` library.\r\n\r\n#### Group - List\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Group.List(\r\n RecordsPerPage=10,\r\n Page=1\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group - Detail\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Group.Detail(\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group - Create\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Group.Create(\r\n GroupCode=\"[Group Code]\",\r\n GroupName=\"[Group Name]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group - Update\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Group.Update(\r\n GroupCode=\"[Group Code]\",\r\n GroupName=\"[Group Name]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group - Delete\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.Group.Delete(\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Addressbook - Group Contact\r\n\r\nManage your group contact relationship using `tnzapi` library.\r\n\r\n#### Group Contact - List\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.GroupContact.List(\r\n RecordsPerPage=10,\r\n Page=1,\r\n GroupCode=\"[Group Code]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group Contact - Detail\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.GroupContact.Detail(\r\n GroupCode=\"[Group Code]\",\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group Contact - Create\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.GroupContact.Create(\r\n GroupCode=\"[Group Code]\",\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n#### Group Contact - Delete\r\n\r\n```python\r\nfrom tnzapi import TNZAPI\r\n\r\nclient = TNZAPI(\r\n AuthToken=\"[Your Auth Token]\"\r\n)\r\n\r\nresponse = client.Addressbook.GroupContact.Delete(\r\n GroupCode=\"[Group Code]\",\r\n ContactID=\"[Contact ID]\"\r\n)\r\n\r\nprint(response)\r\n```\r\n\r\n### Getting help\r\n\r\nIf you need help installing or using the library, please check the [TNZ Contact](https://www.tnz.co.nz/About/Contact/) if you don't find an answer to your question.\r\n\r\n[apidocs]: https://www.tnz.co.nz/Docs/PythonAPI/\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "TNZ REST API Helper Library for Python",
"version": "2.4.0.0",
"project_urls": {
"Homepage": "https://www.tnz.co.nz"
},
"split_keywords": [
"tnz",
" api",
" sms",
" fax",
" email",
" voice",
" tts"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f132144a32b2181e21508e9ee9425f6a825e28450f5e8390f88d65d040f32c0d",
"md5": "542f8ef05dddb492f3644cbee36d93f3",
"sha256": "abcc796633fc5dc31532ab51ece6679554637152f7d24673567fb37b4f7b50f4"
},
"downloads": -1,
"filename": "tnzapi-2.4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "542f8ef05dddb492f3644cbee36d93f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37286,
"upload_time": "2024-08-16T04:53:54",
"upload_time_iso_8601": "2024-08-16T04:53:54.781083Z",
"url": "https://files.pythonhosted.org/packages/f1/32/144a32b2181e21508e9ee9425f6a825e28450f5e8390f88d65d040f32c0d/tnzapi-2.4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-16 04:53:54",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tnzapi"
}