{"id":19640195,"url":"https://github.com/gearplug/rdstation-python","last_synced_at":"2025-02-26T22:44:29.676Z","repository":{"id":65770442,"uuid":"595685258","full_name":"GearPlug/rdstation-python","owner":"GearPlug","description":"rdstation-python is an API wrapper for RD Station, written in Python.","archived":false,"fork":false,"pushed_at":"2023-04-04T20:36:41.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-09T18:56:04.684Z","etag":null,"topics":["api","companies","contacts","crm","customization","leads","marketing","notifications","oauth2","opportunities","python","rdstation","requests","webhooks","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GearPlug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-31T15:49:51.000Z","updated_at":"2023-10-06T17:21:38.000Z","dependencies_parsed_at":"2025-01-10T10:53:58.127Z","dependency_job_id":null,"html_url":"https://github.com/GearPlug/rdstation-python","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"bfa82e6eb1e479f0a1c0d959c6468e5d6a97075c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Frdstation-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Frdstation-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Frdstation-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Frdstation-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GearPlug","download_url":"https://codeload.github.com/GearPlug/rdstation-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240947651,"owners_count":19883030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","companies","contacts","crm","customization","leads","marketing","notifications","oauth2","opportunities","python","rdstation","requests","webhooks","wrapper"],"created_at":"2024-11-11T14:04:58.187Z","updated_at":"2025-02-26T22:44:29.649Z","avatar_url":"https://github.com/GearPlug.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rdstation-python\n![](https://img.shields.io/badge/version-0.2.2-success) ![](https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11-4B8BBE?logo=python\u0026logoColor=white)  \n\n*rdstation-python* is an API wrapper for RD Station, written in Python.\n1. [RD Station Marketing](#1-rd-station-marketing) (This product uses Oauth2 for authentication and uses webhook notifications). \n2. [RD Station CRM](#2-rd-station-crm)\n\n## Installing\n```\npip install rdstation-python\n```\n## 1. RD Station Marketing\n### Usage\n```python\nfrom rdstation.client import Client\nclient = Client(client_id, client_secret)\n```\nTo obtain and set an access token, follow this instructions:\n1. **Get authorization URL**\n```python\nurl = client.authorization_url(redirect_uri)\n```\n2. **Get access token using code**\n```python\nresponse = client.get_access_token(code)\n```\n3. **Set access token**\n```python\nclient.set_token(access_token)\n```\nIf your access token expired, you can get a new one using refresh token:\n```python\nresponse = client.refresh_access_token(refresh_token)\n```\nAnd then set access token again...  \nCheck more information about RD Station Oauth: https://legacydevelopers.rdstation.com/es/authentication\n#### Get account info\n```python\ninfo = client.get_account_info()\n```\n#### Get contact by email\n```python\ncontact = client.get_contact_by_email(email)\n```\n#### Get contact fields\n```python\nfields = client.get_contact_fields()\n```\n### Leads\n#### Create Lead\n```python\nlead_example = {\n    \"conversion_identifier\": \"Name of the conversion event\",\n    \"name\": \"Nome\",\n    \"email\": \"email2@email.com\",\n    \"job_title\": \"job title value\",\n    \"state\": \"state of the contact\",\n    \"city\": \"city of the contact\",\n    \"personal_phone\": \"phone of the contact\",\n    \"website\": \"website of the contact\",\n    \"cf_custom_field_api_identifier\": \"custom field value\",\n    \"company_name\": \"company name\",\n    \"client_tracking_id\": \"lead tracking client_id\",\n    \"traffic_source\": \"Google\",\n    \"tags\": [\"cml\", \"2022\"],\n    \"available_for_mailing\": True,\n    \"legal_bases\": [{\"category\": \"communications\", \"type\": \"consent\", \"status\": \"granted\"}],\n}\nevent_type = \"CONVERSION\"\ncreated = client.create_lead(event_type, lead_example)\n# 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\n```\nDepending on event type, sent data should be different, check https://legacydevelopers.rdstation.com/es/reference/events for more info.\n### Webhooks\n#### List webhooks\n```python\nwebhooks = client.list_webhooks()\n```\n#### Create webhook\n```python\nwebhook = client.create_webhook(event_type, url, event_identifiers: list = None, include_relations: list =None)\n# event type options: \"WEBHOOK.CONVERTED\", \"WEBHOOK.MARKED_OPPORTUNITY\"\n```\n#### Delete webhook\n```python\nclient.delete_webhook(uuid)\n```\n\n## 2. RD Station CRM\nCheck this site for more information: https://developers.rdstation.com/reference/instru%C3%A7%C3%B5es-e-requisitos\n### Usage\n```python\nfrom rdstation.crm import CRMClient\nclient = CRMClient(token)\n```\n### Users\n#### - List users\n```python\nusers = client.list_users()\n```\n### Contacts\n#### - List contacts\n```python\ncontacts = client.list_contacts(page=None, limit=None, order=None, direction=None, email=None, query=None)\n# limit: default is 20. Max is 200.\n# order: field to be sorted. Default is 'name'\n# direction: 'asc' or 'desc', defaulti is 'asc'\n# email: filter by email\n# query: name of contact to be searched\"\n```\n#### - Create Contact\n```python\ncustom_fields = [\n    {\n        \"custom_field_id\": \"6414c0fc43ba490012f96c64\",\n        \"value\": \"a text custom field\"\n    }\n]\ncontact = client.create_contact(\"contact X\", \"Mr\", \"1991-01-04\", \"test@test.com\", custom_data=custom_fields)\n```\n#### - Update Contact\n```python\ncustom_fields = [\n    {\n        \"custom_field_id\": \"6414c0fc43ba490012f96c64\",\n        \"value\": \"a text custom field\"\n    }\n]\ncontact = client.update_contact(\"CONTACT_ID\", \"contact X\", \"Mr\", \"1991-01-04\", custom_data=custom_fields)\n```\n### Companies\n#### - List companies\n```python\ncompanies = client.list_companies(page=None, limit=None, order=None, direction=None, user_id=None, query=None)\n# limit: default is 20. Max is 200.\n# order: field to be sorted. Default is 'name'\n# direction: 'asc' or 'desc', defaulti is 'asc'\n# query: name of company to be searched\"\n```\n### Opportunities\n#### - List opportunities\n```python\nopportunities = client.list_opportunities(limit=1, page=1, direction=\"desc\")\n```\n#### - Create opportunity\n```python\ncustom_fields_example = [\n    {\n        \"custom_field_id\": \"6414c0fc43ba490012f96c64\",\n        \"value\": \"a text custom field\"\n    }\n]\noppor = client.create_opportunity(\n    \"opportunity name 2023\",\n    deal_stage_id=\"64148f7bff9080001bdca349\",\n    organization_id=\"6414cc9895c34b000c0fb2aa\",\n    deal_source_id=\"64148f7bff9080001bdca33b\",\n    rating=4,\n    prediction_date=\"2023-11-11\",\n    custom_data=custom_fields_example,\n)\n```\nCheck this site for more information about creating opportunities: https://developers.rdstation.com/reference/oportunidades\n#### - List deal stages\n```python\nstages = client.list_deal_stages(page=None, limit=None)\n```\n#### - List deal pipelines\n```python\nstages = client.list_deal_pipelines()\n```\n#### - List deal sources\n```python\nstages = client.list_deal_sources()\n```\n### Custom fields\n#### - List custom fields\n```python\nfields = client.list_custom_fields(option=None)\n# option: \"contact\", \"deal\", \"organization\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearplug%2Frdstation-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgearplug%2Frdstation-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearplug%2Frdstation-python/lists"}