rdstation-python
rdstation-python is an API wrapper for RD Station, written in Python.
- RD Station Marketing (This product uses Oauth2 for authentication and uses webhook notifications).
- RD Station CRM
Installing
pip install rdstation-python
1. RD Station Marketing
Usage
from rdstation.client import Client
client = Client(client_id, client_secret)
To obtain and set an access token, follow this instructions:
- Get authorization URL
url = client.authorization_url(redirect_uri)
- Get access token using code
response = client.get_access_token(code)
- Set access token
client.set_token(access_token)
If your access token expired, you can get a new one using refresh token:
response = client.refresh_access_token(refresh_token)
And then set access token again...
Check more information about RD Station Oauth: https://legacydevelopers.rdstation.com/es/authentication
Get account info
info = client.get_account_info()
Get contact by email
contact = client.get_contact_by_email(email)
Get contact fields
fields = client.get_contact_fields()
Leads
Create Lead
lead_example = {
"conversion_identifier": "Name of the conversion event",
"name": "Nome",
"email": "email2@email.com",
"job_title": "job title value",
"state": "state of the contact",
"city": "city of the contact",
"personal_phone": "phone of the contact",
"website": "website of the contact",
"cf_custom_field_api_identifier": "custom field value",
"company_name": "company name",
"client_tracking_id": "lead tracking client_id",
"traffic_source": "Google",
"tags": ["cml", "2022"],
"available_for_mailing": True,
"legal_bases": [{"category": "communications", "type": "consent", "status": "granted"}],
}
event_type = "CONVERSION"
created = client.create_lead(event_type, lead_example)
# event_type options are: CONVERSION, OPPORTUNITY, SALE, OPPORTUNITY_LOST, ORDER_PLACED, ORDER_PLACED_ITEM, CART_ABANDONED, CART_ABANDONED_ITEM, CHAT_STARTED, CHAT_FINISHED, CALL_FINISHED, MEDIA_PLAYBACK_STARTED, MEDIA_PLAYBACK_STOPPED
Depending on event type, sent data should be different, check https://legacydevelopers.rdstation.com/es/reference/events for more info.
Webhooks
List webhooks
webhooks = client.list_webhooks()
Create webhook
webhook = client.create_webhook(event_type, url, event_identifiers: list = None, include_relations: list =None)
# event type options: "WEBHOOK.CONVERTED", "WEBHOOK.MARKED_OPPORTUNITY"
Delete webhook
client.delete_webhook(uuid)
2. RD Station CRM
Check this site for more information: https://developers.rdstation.com/reference/instru%C3%A7%C3%B5es-e-requisitos
Usage
from rdstation.crm import CRMClient
client = CRMClient(token)
Users
- List users
users = client.list_users()
Contacts
- List contacts
contacts = client.list_contacts(page=None, limit=None, order=None, direction=None, email=None, query=None)
# limit: default is 20. Max is 200.
# order: field to be sorted. Default is 'name'
# direction: 'asc' or 'desc', defaulti is 'asc'
# email: filter by email
# query: name of contact to be searched"
- Create Contact
custom_fields = [
{
"custom_field_id": "6414c0fc43ba490012f96c64",
"value": "a text custom field"
}
]
contact = client.create_contact("contact X", "Mr", "1991-01-04", "test@test.com", custom_data=custom_fields)
- Update Contact
custom_fields = [
{
"custom_field_id": "6414c0fc43ba490012f96c64",
"value": "a text custom field"
}
]
contact = client.update_contact("CONTACT_ID", "contact X", "Mr", "1991-01-04", custom_data=custom_fields)
Companies
- List companies
companies = client.list_companies(page=None, limit=None, order=None, direction=None, user_id=None, query=None)
# limit: default is 20. Max is 200.
# order: field to be sorted. Default is 'name'
# direction: 'asc' or 'desc', defaulti is 'asc'
# query: name of company to be searched"
Opportunities
- List opportunities
opportunities = client.list_opportunities(limit=1, page=1, direction="desc")
- Create opportunity
custom_fields_example = [
{
"custom_field_id": "6414c0fc43ba490012f96c64",
"value": "a text custom field"
}
]
oppor = client.create_opportunity(
"opportunity name 2023",
deal_stage_id="64148f7bff9080001bdca349",
organization_id="6414cc9895c34b000c0fb2aa",
deal_source_id="64148f7bff9080001bdca33b",
rating=4,
prediction_date="2023-11-11",
custom_data=custom_fields_example,
)
Check this site for more information about creating opportunities: https://developers.rdstation.com/reference/oportunidades
- List deal stages
stages = client.list_deal_stages(page=None, limit=None)
- List deal pipelines
stages = client.list_deal_pipelines()
- List deal sources
stages = client.list_deal_sources()
Custom fields
- List custom fields
fields = client.list_custom_fields(option=None)
# option: "contact", "deal", "organization"
Metadata
Release files for rdstation-python 0.2.2
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 |
|---|---|---|---|---|
| rdstation_python-0.2.2.tar.gz | 5.8 kB | Without provenance | Details for rdstation_python-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rdstation_python-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for rdstation_python-0.2.2-py3-none-any.whl |
Total release size: 13.4 kB
Release files / rdstation_python-0.2.2.tar.gz
| Download URL | rdstation_python-0.2.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e34b37405a9e4337d0b22e60ed5ee5bceb56c9ca08904e9eba4c661b84ee080
|
|
BLAKE2b-256 checksum How to use checksums |
5c3a343c5abeb91294bc736440651f22edcaab44fae5e85fcf814847c537aae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / rdstation_python-0.2.2-py3-none-any.whl
| Download URL | rdstation_python-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3d5059d600be557a292d7405a17233b7e6186b56e17a450f9cfbdbd65d4b2ca
|
|
BLAKE2b-256 checksum How to use checksums |
e1acd3cc4e18bff4d9a79dac51036c524f7e69b01789f733c97db0d2b04cf1c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for rdstation-python 0.2.2
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.