Skip to main content

salesmanago-python-api

Python API for SalesManago integration.

Installation

Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions. With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

Mac/Linux

pip install virtualenv virtualenv source /bin/activate /bin/pip install salesmanago_python_api

Windows

pip install virtualenv virtualenv \Scripts\activate \Scripts\pip.exe install salesmanago_python_api

Supported Python Versions

Python 3.7, and 3.8 are fully supported and tested. This library may work on later versions of 3, but we do not currently run tests against those versions

Deprecated Python Versions Python <= 3.7

Third Party Libraries and Dependencies

The following libraries will be installed when you install the client library:

requests

Services

Currently client service is supported PARTIALLY, event service is supported only for inserts. I've needed only a few methods and those were implemented.

SalesManagoClientService handles:

  • insert
  • upsert
  • update
  • delete

SalesManagoClientService handles:

  • addContactExtEvent
  • batchAddContactExtEvent

Usage of Client Service

Start with import ;) from salesmanago_python_api.services import SalesManagoClientService

Since SalesManago has different data requirements for all supported methods, it's required to interface with the client service using SalesManagoClientData class. It will handle all the required formatting for you.

clientServiceClass = SalesManagoClientService(
    apiKey=API_KEY,
    clientId=CLIENT_ID,
    apiSecret=API_SECRET,
    serverDomain=SERVER_DOMAIN
)

clientDataClass = clientServiceClass.ClientData
clientData = clientDataClass(
    email='unittest@salesmanagopythonapi.pl',
    owner=REAL_OWNER
)

response = clientServiceClass.insert(clientData)
response.raise_for_status()
response_json = response.json()

SalesManagoClientService needs to be initialized only once, it setups requests Session and handles the request build process.

clientServiceClass = SalesManagoClientService(
    apiKey=API_KEY,
    clientId=CLIENT_ID,
    apiSecret=API_SECRET,
    serverDomain=SERVER_DOMAIN
)

#insert new client into SM database.
clientDataClass = clientServiceClass.ClientData
clientData = clientDataClass(
    email='client@salesmanagopythonapi.pl',
    owner='owner@company.com'
)
clientServiceClass.insert(clientData)


#update SM client with newMail and state
clientUpdateData = clientDataClass(
    email='client@salesmanagopythonapi.pl',
    owner='owner@company.com',
    state='CUSTOMER',
    newMail='newmail@salesmanagopythonapi.pl'
)
clientServiceClass.update(clientUpdateData)

#delete him
clientDeleteData = clientDataClass(
    email='newmail@salesmanagopythonapi.pl',
    owner='owner@company.com'
)
clientServiceClass.delete(clientData)

Properties on SalesManagoClientData

  • email: str - Required Contact E-mail
  • owner: str - Required Owner E-mail
  • state: str - one of ['CUSTOMER', 'PROSPECT', 'PARTNER', 'OTHER', 'UNKNOWN]
  • name: Optional[str]
  • phone: Optional[str]
  • fax: Optional[str]
  • company: Optional[str]
  • externalId: Optional[str]
  • newEmail: Optional[str]
  • birthday: Optional[datetime.date]
  • address_streetAddress: Optional[str]
  • address_zipCode: Optional[str]
  • address_city: Optional[str]
  • address_country: Optional[str]
  • lang: Optional[str]
  • tags: list = field(default_factory=list)
  • removeTags: list = field(default_factory=list)
  • forceOptOut: bool
  • forceOptIn: bool
  • forcePhoneOptOut: bool
  • forcePhoneOptIn: bool
  • useApiDoubleOptIn: bool
  • properties: dict = field(default_factory=dict)
  • province: str

Tags / removeTags and properties

Tags and removeTags have nice methods:

clientData.add_tag('XXX')
clientData.remove_tag('XXX')

clientData.add_removeTags('XXX')
clientData.remove_removeTags('XXX')

Properties have those too :)

clientData.add_property('key', 'value')
clientData.remove_property('key')

Running tests VS real API

To run real tests vs REAL API some enviroment variables need to be set:

  • TEST_REAL_API -> True
  • REAL_API_KEY
  • REAL_API_SECRET
  • REAL_CLIENT_ID
  • REAL_OWNER
  • REAL_SERVER_DOMAIN

To set enviroment variables use set in Linux or export in Windows.

Metadata

Release files for salesmanago-python-api 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for salesmanago-python-api 0.4
File Size Uploaded
salesmanago_python_api-0.4.tar.gz 9.8 kB Details

Release files / salesmanago_python_api-0.4.tar.gz

Download URL salesmanago_python_api-0.4.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6287aea568b275d02681d2e97882a4882f988ba2a8ab1b7e7011d866d1d6e6d1
BLAKE2b-256 checksum
How to use checksums
84a7725acdc0c1a67277557c4a2745dd90283c521306d5cd1f7f5d60bb222a32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page