universal-mcp-applications 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- universal_mcp/applications/ahrefs/README.md +51 -0
- universal_mcp/applications/ahrefs/__init__.py +1 -0
- universal_mcp/applications/ahrefs/app.py +2291 -0
- universal_mcp/applications/airtable/README.md +22 -0
- universal_mcp/applications/airtable/__init__.py +1 -0
- universal_mcp/applications/airtable/app.py +479 -0
- universal_mcp/applications/apollo/README.md +44 -0
- universal_mcp/applications/apollo/__init__.py +1 -0
- universal_mcp/applications/apollo/app.py +1847 -0
- universal_mcp/applications/asana/README.md +199 -0
- universal_mcp/applications/asana/__init__.py +1 -0
- universal_mcp/applications/asana/app.py +9509 -0
- universal_mcp/applications/aws-s3/README.md +0 -0
- universal_mcp/applications/aws-s3/__init__.py +1 -0
- universal_mcp/applications/aws-s3/app.py +552 -0
- universal_mcp/applications/bill/README.md +0 -0
- universal_mcp/applications/bill/__init__.py +1 -0
- universal_mcp/applications/bill/app.py +8705 -0
- universal_mcp/applications/box/README.md +307 -0
- universal_mcp/applications/box/__init__.py +1 -0
- universal_mcp/applications/box/app.py +15987 -0
- universal_mcp/applications/braze/README.md +106 -0
- universal_mcp/applications/braze/__init__.py +1 -0
- universal_mcp/applications/braze/app.py +4754 -0
- universal_mcp/applications/cal-com-v2/README.md +150 -0
- universal_mcp/applications/cal-com-v2/__init__.py +1 -0
- universal_mcp/applications/cal-com-v2/app.py +5541 -0
- universal_mcp/applications/calendly/README.md +53 -0
- universal_mcp/applications/calendly/__init__.py +1 -0
- universal_mcp/applications/calendly/app.py +1436 -0
- universal_mcp/applications/canva/README.md +43 -0
- universal_mcp/applications/canva/__init__.py +1 -0
- universal_mcp/applications/canva/app.py +941 -0
- universal_mcp/applications/clickup/README.md +135 -0
- universal_mcp/applications/clickup/__init__.py +1 -0
- universal_mcp/applications/clickup/app.py +5009 -0
- universal_mcp/applications/coda/README.md +108 -0
- universal_mcp/applications/coda/__init__.py +1 -0
- universal_mcp/applications/coda/app.py +3671 -0
- universal_mcp/applications/confluence/README.md +198 -0
- universal_mcp/applications/confluence/__init__.py +1 -0
- universal_mcp/applications/confluence/app.py +6273 -0
- universal_mcp/applications/contentful/README.md +17 -0
- universal_mcp/applications/contentful/__init__.py +1 -0
- universal_mcp/applications/contentful/app.py +364 -0
- universal_mcp/applications/crustdata/README.md +25 -0
- universal_mcp/applications/crustdata/__init__.py +1 -0
- universal_mcp/applications/crustdata/app.py +586 -0
- universal_mcp/applications/dialpad/README.md +202 -0
- universal_mcp/applications/dialpad/__init__.py +1 -0
- universal_mcp/applications/dialpad/app.py +5949 -0
- universal_mcp/applications/digitalocean/README.md +463 -0
- universal_mcp/applications/digitalocean/__init__.py +1 -0
- universal_mcp/applications/digitalocean/app.py +20835 -0
- universal_mcp/applications/domain-checker/README.md +13 -0
- universal_mcp/applications/domain-checker/__init__.py +1 -0
- universal_mcp/applications/domain-checker/app.py +265 -0
- universal_mcp/applications/e2b/README.md +12 -0
- universal_mcp/applications/e2b/__init__.py +1 -0
- universal_mcp/applications/e2b/app.py +187 -0
- universal_mcp/applications/elevenlabs/README.md +88 -0
- universal_mcp/applications/elevenlabs/__init__.py +1 -0
- universal_mcp/applications/elevenlabs/app.py +3235 -0
- universal_mcp/applications/exa/README.md +15 -0
- universal_mcp/applications/exa/__init__.py +1 -0
- universal_mcp/applications/exa/app.py +221 -0
- universal_mcp/applications/falai/README.md +17 -0
- universal_mcp/applications/falai/__init__.py +1 -0
- universal_mcp/applications/falai/app.py +331 -0
- universal_mcp/applications/figma/README.md +49 -0
- universal_mcp/applications/figma/__init__.py +1 -0
- universal_mcp/applications/figma/app.py +1090 -0
- universal_mcp/applications/firecrawl/README.md +20 -0
- universal_mcp/applications/firecrawl/__init__.py +1 -0
- universal_mcp/applications/firecrawl/app.py +514 -0
- universal_mcp/applications/fireflies/README.md +25 -0
- universal_mcp/applications/fireflies/__init__.py +1 -0
- universal_mcp/applications/fireflies/app.py +506 -0
- universal_mcp/applications/fpl/README.md +23 -0
- universal_mcp/applications/fpl/__init__.py +1 -0
- universal_mcp/applications/fpl/app.py +1327 -0
- universal_mcp/applications/fpl/utils/api.py +142 -0
- universal_mcp/applications/fpl/utils/fixtures.py +629 -0
- universal_mcp/applications/fpl/utils/helper.py +982 -0
- universal_mcp/applications/fpl/utils/league_utils.py +546 -0
- universal_mcp/applications/fpl/utils/position_utils.py +68 -0
- universal_mcp/applications/ghost-content/README.md +25 -0
- universal_mcp/applications/ghost-content/__init__.py +1 -0
- universal_mcp/applications/ghost-content/app.py +654 -0
- universal_mcp/applications/github/README.md +1049 -0
- universal_mcp/applications/github/__init__.py +1 -0
- universal_mcp/applications/github/app.py +50600 -0
- universal_mcp/applications/gong/README.md +63 -0
- universal_mcp/applications/gong/__init__.py +1 -0
- universal_mcp/applications/gong/app.py +2297 -0
- universal_mcp/applications/google-ads/README.md +0 -0
- universal_mcp/applications/google-ads/__init__.py +1 -0
- universal_mcp/applications/google-ads/app.py +23 -0
- universal_mcp/applications/google-calendar/README.md +21 -0
- universal_mcp/applications/google-calendar/__init__.py +1 -0
- universal_mcp/applications/google-calendar/app.py +574 -0
- universal_mcp/applications/google-docs/README.md +25 -0
- universal_mcp/applications/google-docs/__init__.py +1 -0
- universal_mcp/applications/google-docs/app.py +760 -0
- universal_mcp/applications/google-drive/README.md +68 -0
- universal_mcp/applications/google-drive/__init__.py +1 -0
- universal_mcp/applications/google-drive/app.py +4936 -0
- universal_mcp/applications/google-gemini/README.md +25 -0
- universal_mcp/applications/google-gemini/__init__.py +1 -0
- universal_mcp/applications/google-gemini/app.py +663 -0
- universal_mcp/applications/google-mail/README.md +31 -0
- universal_mcp/applications/google-mail/__init__.py +1 -0
- universal_mcp/applications/google-mail/app.py +1354 -0
- universal_mcp/applications/google-searchconsole/README.md +21 -0
- universal_mcp/applications/google-searchconsole/__init__.py +1 -0
- universal_mcp/applications/google-searchconsole/app.py +320 -0
- universal_mcp/applications/google-sheet/README.md +36 -0
- universal_mcp/applications/google-sheet/__init__.py +1 -0
- universal_mcp/applications/google-sheet/app.py +1941 -0
- universal_mcp/applications/hashnode/README.md +20 -0
- universal_mcp/applications/hashnode/__init__.py +1 -0
- universal_mcp/applications/hashnode/app.py +455 -0
- universal_mcp/applications/heygen/README.md +44 -0
- universal_mcp/applications/heygen/__init__.py +1 -0
- universal_mcp/applications/heygen/app.py +961 -0
- universal_mcp/applications/http-tools/README.md +16 -0
- universal_mcp/applications/http-tools/__init__.py +1 -0
- universal_mcp/applications/http-tools/app.py +153 -0
- universal_mcp/applications/hubspot/README.md +239 -0
- universal_mcp/applications/hubspot/__init__.py +1 -0
- universal_mcp/applications/hubspot/app.py +416 -0
- universal_mcp/applications/jira/README.md +600 -0
- universal_mcp/applications/jira/__init__.py +1 -0
- universal_mcp/applications/jira/app.py +28804 -0
- universal_mcp/applications/klaviyo/README.md +313 -0
- universal_mcp/applications/klaviyo/__init__.py +1 -0
- universal_mcp/applications/klaviyo/app.py +11236 -0
- universal_mcp/applications/linkedin/README.md +15 -0
- universal_mcp/applications/linkedin/__init__.py +1 -0
- universal_mcp/applications/linkedin/app.py +243 -0
- universal_mcp/applications/mailchimp/README.md +281 -0
- universal_mcp/applications/mailchimp/__init__.py +1 -0
- universal_mcp/applications/mailchimp/app.py +10937 -0
- universal_mcp/applications/markitdown/README.md +12 -0
- universal_mcp/applications/markitdown/__init__.py +1 -0
- universal_mcp/applications/markitdown/app.py +63 -0
- universal_mcp/applications/miro/README.md +151 -0
- universal_mcp/applications/miro/__init__.py +1 -0
- universal_mcp/applications/miro/app.py +5429 -0
- universal_mcp/applications/ms-teams/README.md +42 -0
- universal_mcp/applications/ms-teams/__init__.py +1 -0
- universal_mcp/applications/ms-teams/app.py +1823 -0
- universal_mcp/applications/neon/README.md +74 -0
- universal_mcp/applications/neon/__init__.py +1 -0
- universal_mcp/applications/neon/app.py +2018 -0
- universal_mcp/applications/notion/README.md +30 -0
- universal_mcp/applications/notion/__init__.py +1 -0
- universal_mcp/applications/notion/app.py +527 -0
- universal_mcp/applications/openai/README.md +22 -0
- universal_mcp/applications/openai/__init__.py +1 -0
- universal_mcp/applications/openai/app.py +759 -0
- universal_mcp/applications/outlook/README.md +20 -0
- universal_mcp/applications/outlook/__init__.py +1 -0
- universal_mcp/applications/outlook/app.py +444 -0
- universal_mcp/applications/perplexity/README.md +12 -0
- universal_mcp/applications/perplexity/__init__.py +1 -0
- universal_mcp/applications/perplexity/app.py +65 -0
- universal_mcp/applications/pipedrive/README.md +284 -0
- universal_mcp/applications/pipedrive/__init__.py +1 -0
- universal_mcp/applications/pipedrive/app.py +12924 -0
- universal_mcp/applications/posthog/README.md +132 -0
- universal_mcp/applications/posthog/__init__.py +1 -0
- universal_mcp/applications/posthog/app.py +7125 -0
- universal_mcp/applications/reddit/README.md +135 -0
- universal_mcp/applications/reddit/__init__.py +1 -0
- universal_mcp/applications/reddit/app.py +4652 -0
- universal_mcp/applications/replicate/README.md +18 -0
- universal_mcp/applications/replicate/__init__.py +1 -0
- universal_mcp/applications/replicate/app.py +495 -0
- universal_mcp/applications/resend/README.md +40 -0
- universal_mcp/applications/resend/__init__.py +1 -0
- universal_mcp/applications/resend/app.py +881 -0
- universal_mcp/applications/retell/README.md +21 -0
- universal_mcp/applications/retell/__init__.py +1 -0
- universal_mcp/applications/retell/app.py +333 -0
- universal_mcp/applications/rocketlane/README.md +70 -0
- universal_mcp/applications/rocketlane/__init__.py +1 -0
- universal_mcp/applications/rocketlane/app.py +4346 -0
- universal_mcp/applications/semanticscholar/README.md +25 -0
- universal_mcp/applications/semanticscholar/__init__.py +1 -0
- universal_mcp/applications/semanticscholar/app.py +482 -0
- universal_mcp/applications/semrush/README.md +44 -0
- universal_mcp/applications/semrush/__init__.py +1 -0
- universal_mcp/applications/semrush/app.py +2081 -0
- universal_mcp/applications/sendgrid/README.md +362 -0
- universal_mcp/applications/sendgrid/__init__.py +1 -0
- universal_mcp/applications/sendgrid/app.py +9752 -0
- universal_mcp/applications/sentry/README.md +186 -0
- universal_mcp/applications/sentry/__init__.py +1 -0
- universal_mcp/applications/sentry/app.py +7471 -0
- universal_mcp/applications/serpapi/README.md +14 -0
- universal_mcp/applications/serpapi/__init__.py +1 -0
- universal_mcp/applications/serpapi/app.py +293 -0
- universal_mcp/applications/sharepoint/README.md +0 -0
- universal_mcp/applications/sharepoint/__init__.py +1 -0
- universal_mcp/applications/sharepoint/app.py +215 -0
- universal_mcp/applications/shopify/README.md +321 -0
- universal_mcp/applications/shopify/__init__.py +1 -0
- universal_mcp/applications/shopify/app.py +15392 -0
- universal_mcp/applications/shortcut/README.md +128 -0
- universal_mcp/applications/shortcut/__init__.py +1 -0
- universal_mcp/applications/shortcut/app.py +4478 -0
- universal_mcp/applications/slack/README.md +0 -0
- universal_mcp/applications/slack/__init__.py +1 -0
- universal_mcp/applications/slack/app.py +570 -0
- universal_mcp/applications/spotify/README.md +91 -0
- universal_mcp/applications/spotify/__init__.py +1 -0
- universal_mcp/applications/spotify/app.py +2526 -0
- universal_mcp/applications/supabase/README.md +87 -0
- universal_mcp/applications/supabase/__init__.py +1 -0
- universal_mcp/applications/supabase/app.py +2970 -0
- universal_mcp/applications/tavily/README.md +12 -0
- universal_mcp/applications/tavily/__init__.py +1 -0
- universal_mcp/applications/tavily/app.py +51 -0
- universal_mcp/applications/trello/README.md +266 -0
- universal_mcp/applications/trello/__init__.py +1 -0
- universal_mcp/applications/trello/app.py +10875 -0
- universal_mcp/applications/twillo/README.md +0 -0
- universal_mcp/applications/twillo/__init__.py +1 -0
- universal_mcp/applications/twillo/app.py +269 -0
- universal_mcp/applications/twitter/README.md +100 -0
- universal_mcp/applications/twitter/__init__.py +1 -0
- universal_mcp/applications/twitter/api_segments/__init__.py +0 -0
- universal_mcp/applications/twitter/api_segments/api_segment_base.py +51 -0
- universal_mcp/applications/twitter/api_segments/compliance_api.py +122 -0
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +255 -0
- universal_mcp/applications/twitter/api_segments/dm_events_api.py +140 -0
- universal_mcp/applications/twitter/api_segments/likes_api.py +159 -0
- universal_mcp/applications/twitter/api_segments/lists_api.py +395 -0
- universal_mcp/applications/twitter/api_segments/openapi_json_api.py +34 -0
- universal_mcp/applications/twitter/api_segments/spaces_api.py +309 -0
- universal_mcp/applications/twitter/api_segments/trends_api.py +40 -0
- universal_mcp/applications/twitter/api_segments/tweets_api.py +1403 -0
- universal_mcp/applications/twitter/api_segments/usage_api.py +40 -0
- universal_mcp/applications/twitter/api_segments/users_api.py +1498 -0
- universal_mcp/applications/twitter/app.py +46 -0
- universal_mcp/applications/unipile/README.md +28 -0
- universal_mcp/applications/unipile/__init__.py +1 -0
- universal_mcp/applications/unipile/app.py +829 -0
- universal_mcp/applications/whatsapp/README.md +23 -0
- universal_mcp/applications/whatsapp/__init__.py +1 -0
- universal_mcp/applications/whatsapp/app.py +595 -0
- universal_mcp/applications/whatsapp-business/README.md +34 -0
- universal_mcp/applications/whatsapp-business/__init__.py +1 -0
- universal_mcp/applications/whatsapp-business/app.py +1065 -0
- universal_mcp/applications/wrike/README.md +46 -0
- universal_mcp/applications/wrike/__init__.py +1 -0
- universal_mcp/applications/wrike/app.py +1583 -0
- universal_mcp/applications/youtube/README.md +57 -0
- universal_mcp/applications/youtube/__init__.py +1 -0
- universal_mcp/applications/youtube/app.py +1696 -0
- universal_mcp/applications/zenquotes/README.md +12 -0
- universal_mcp/applications/zenquotes/__init__.py +1 -0
- universal_mcp/applications/zenquotes/app.py +31 -0
- universal_mcp_applications-0.1.1.dist-info/METADATA +172 -0
- universal_mcp_applications-0.1.1.dist-info/RECORD +268 -0
- universal_mcp_applications-0.1.1.dist-info/WHEEL +4 -0
- universal_mcp_applications-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
from datetime import UTC, datetime
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from universal_mcp.applications.application import APIApplication
|
|
5
|
+
from universal_mcp.integrations import Integration
|
|
6
|
+
from universal_mcp_hubspot.api_segments.crm_api import CrmApi
|
|
7
|
+
from universal_mcp_hubspot.api_segments.marketing_api import MarketingApi
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HubspotApp(APIApplication):
|
|
11
|
+
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
|
12
|
+
super().__init__(name="hubspot", integration=integration, **kwargs)
|
|
13
|
+
self.base_url = "https://api.hubapi.com"
|
|
14
|
+
self.crm = CrmApi(self)
|
|
15
|
+
self.marketing = MarketingApi(self)
|
|
16
|
+
|
|
17
|
+
def add_a_note(
|
|
18
|
+
self,
|
|
19
|
+
hs_note_body: str,
|
|
20
|
+
hs_timestamp: str | None = None,
|
|
21
|
+
associations: list[dict[str, Any]] | None = None,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
"""
|
|
24
|
+
Create a note in HubSpot with the given properties and associations.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
hs_note_body (str): The body/content of the note
|
|
28
|
+
hs_timestamp (Optional[str]): Timestamp for the note (ISO format). If not provided, current time will be used.
|
|
29
|
+
associations (Optional[List[dict[str, Any]]]): List of associations to other objects. Exmaple: To add notes to contact [{"to": {"id": "101"}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 202}]}], to add notes to company [{"to": {"id": "101"}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 190}]}]
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
dict[str, Any]: The created note object with ID
|
|
33
|
+
|
|
34
|
+
Raises:
|
|
35
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
36
|
+
|
|
37
|
+
Tags:
|
|
38
|
+
Notes, CRM, important
|
|
39
|
+
"""
|
|
40
|
+
if hs_note_body is None:
|
|
41
|
+
raise ValueError("Missing required parameter 'hs_note_body'.")
|
|
42
|
+
|
|
43
|
+
url = f"{self.base_url}/crm/v3/objects/notes"
|
|
44
|
+
|
|
45
|
+
# Build the properties object
|
|
46
|
+
properties = {
|
|
47
|
+
"hs_note_body": hs_note_body,
|
|
48
|
+
"hs_timestamp": hs_timestamp
|
|
49
|
+
if hs_timestamp
|
|
50
|
+
else datetime.now(UTC).isoformat(),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Build the request body
|
|
54
|
+
request_body_data: dict[str, Any] = {"properties": properties}
|
|
55
|
+
|
|
56
|
+
# Add associations if provided
|
|
57
|
+
if associations:
|
|
58
|
+
request_body_data["associations"] = associations
|
|
59
|
+
|
|
60
|
+
response = self._post(url, data=request_body_data)
|
|
61
|
+
return self._handle_response(response)
|
|
62
|
+
|
|
63
|
+
def fetch_multiple_lists(
|
|
64
|
+
self, listIds: list[str] | None = None, includeFilters: bool | None = None
|
|
65
|
+
) -> dict[str, Any]:
|
|
66
|
+
"""
|
|
67
|
+
Fetch multiple lists in a single request by ILS list ID. The response will include the definitions of all lists that exist for the listIds provided.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
listIds (array): The **ILS IDs** of the lists to fetch.
|
|
71
|
+
includeFilters (boolean): A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
dict[str, Any]: Successful response, for a request with `includeFilters` set to `true`.
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
78
|
+
|
|
79
|
+
Tags:
|
|
80
|
+
Lists
|
|
81
|
+
"""
|
|
82
|
+
url = f"{self.base_url}/crm/v3/lists/"
|
|
83
|
+
query_params = {
|
|
84
|
+
k: v
|
|
85
|
+
for k, v in [("listIds", listIds), ("includeFilters", includeFilters)]
|
|
86
|
+
if v is not None
|
|
87
|
+
}
|
|
88
|
+
response = self._get(url, params=query_params)
|
|
89
|
+
return self._handle_response(response)
|
|
90
|
+
|
|
91
|
+
def fetch_list_memberships(
|
|
92
|
+
self,
|
|
93
|
+
listId: str,
|
|
94
|
+
after: str | None = None,
|
|
95
|
+
before: str | None = None,
|
|
96
|
+
limit: int | None = None,
|
|
97
|
+
) -> dict[str, Any]:
|
|
98
|
+
"""
|
|
99
|
+
Fetch the memberships of a list in order sorted by the recordId of the records in the list.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
listId (str): The ILS ID of the list
|
|
103
|
+
after (Optional[str]): The paging offset token for the page that comes after the previously requested records
|
|
104
|
+
before (Optional[str]): The paging offset token for the page that comes before the previously requested records
|
|
105
|
+
limit (Optional[int]): The number of records to return in the response (max 250)
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
dict[str, Any]: List memberships ordered by recordId
|
|
109
|
+
|
|
110
|
+
Raises:
|
|
111
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
112
|
+
|
|
113
|
+
Tags:
|
|
114
|
+
Lists, CRM
|
|
115
|
+
"""
|
|
116
|
+
if listId is None:
|
|
117
|
+
raise ValueError("Missing required parameter 'listId'.")
|
|
118
|
+
|
|
119
|
+
url = f"{self.base_url}/crm/v3/lists/{listId}/memberships"
|
|
120
|
+
query_params = {}
|
|
121
|
+
|
|
122
|
+
if after is not None:
|
|
123
|
+
query_params["after"] = after
|
|
124
|
+
if before is not None:
|
|
125
|
+
query_params["before"] = before
|
|
126
|
+
if limit is not None:
|
|
127
|
+
query_params["limit"] = limit
|
|
128
|
+
|
|
129
|
+
response = self._get(url, params=query_params)
|
|
130
|
+
return self._handle_response(response)
|
|
131
|
+
|
|
132
|
+
def create_list(
|
|
133
|
+
self,
|
|
134
|
+
objectTypeId: str,
|
|
135
|
+
processingType: str,
|
|
136
|
+
name: str,
|
|
137
|
+
membershipSettings: dict[str, Any] | None = None,
|
|
138
|
+
customProperties: dict[str, str] | None = None,
|
|
139
|
+
listFolderId: int | None = None,
|
|
140
|
+
listPermissions: dict[str, Any] | None = None,
|
|
141
|
+
filterBranch: Any | None = None,
|
|
142
|
+
) -> dict[str, Any]:
|
|
143
|
+
"""
|
|
144
|
+
Create a new list in HubSpot with the specified object type, processing type, and name.
|
|
145
|
+
Optionally use this to provide membership settings, custom properties, a folder ID, list permissions,
|
|
146
|
+
and a filter branch to further configure the list.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
objectTypeId (string): The object type ID of the type of objects that the list will store. Example: '0-1'.
|
|
150
|
+
processingType (string): The processing type of the list. One of: `SNAPSHOT`, `MANUAL`, or `DYNAMIC`. Example: 'DYNAMIC'.
|
|
151
|
+
name (string): The name of the list, which must be globally unique across all public lists in the portal. Example: 'Dynamic Association List Example'.
|
|
152
|
+
membershipSettings (object): membershipSettings
|
|
153
|
+
customProperties (object): The list of custom properties to tie to the list. Custom property name is the key, the value is the value.
|
|
154
|
+
listFolderId (integer): The ID of the folder that the list should be created in. If left blank, then the list will be created in the root of the list folder structure.
|
|
155
|
+
listPermissions (object): listPermissions
|
|
156
|
+
filterBranch (string): filterBranch Example: {'filterBranchType': 'OR', 'filterBranches': [{'filterBranchType': 'AND', 'filterBranches': [{'associationCategory': 'HUBSPOT_DEFINED', 'associationTypeId': 4, 'filterBranchType': 'ASSOCIATION', 'filters': [{'filterType': 'PROPERTY', 'operation': {'operationType': 'BOOL', 'operator': 'IS_EQUAL_TO', 'value': True}, 'property': 'hs_is_closed_won'}], 'objectTypeId': '0-3', 'operator': 'IN_LIST'}], 'filters': [{'filterType': 'PROPERTY', 'operation': {'operationType': 'MULTISTRING', 'operator': 'IS_EQUAL_TO', 'values': ['test', 'name']}, 'property': 'firstname'}]}]}.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
dict[str, Any]: successful operation
|
|
160
|
+
|
|
161
|
+
Raises:
|
|
162
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
163
|
+
|
|
164
|
+
Tags:
|
|
165
|
+
Lists, CRM
|
|
166
|
+
"""
|
|
167
|
+
request_body_data = None
|
|
168
|
+
request_body_data = {
|
|
169
|
+
"membershipSettings": membershipSettings,
|
|
170
|
+
"objectTypeId": objectTypeId,
|
|
171
|
+
"processingType": processingType,
|
|
172
|
+
"customProperties": customProperties,
|
|
173
|
+
"listFolderId": listFolderId,
|
|
174
|
+
"name": name,
|
|
175
|
+
"listPermissions": listPermissions,
|
|
176
|
+
"filterBranch": filterBranch,
|
|
177
|
+
}
|
|
178
|
+
request_body_data = {
|
|
179
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
180
|
+
}
|
|
181
|
+
url = f"{self.base_url}/crm/v3/lists/"
|
|
182
|
+
query_params = {}
|
|
183
|
+
response = self._post(
|
|
184
|
+
url,
|
|
185
|
+
data=request_body_data,
|
|
186
|
+
params=query_params,
|
|
187
|
+
content_type="application/json",
|
|
188
|
+
)
|
|
189
|
+
return self._handle_response(response)
|
|
190
|
+
|
|
191
|
+
def get_list_by_id(
|
|
192
|
+
self, listId: str, includeFilters: bool | None = None
|
|
193
|
+
) -> dict[str, Any]:
|
|
194
|
+
"""
|
|
195
|
+
Fetch a single list by ILS list ID.
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
listId (string): listId
|
|
199
|
+
includeFilters (boolean): A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response.
|
|
200
|
+
|
|
201
|
+
Returns:
|
|
202
|
+
dict[str, Any]: Successful response, for a request with `includeFilters` set to `true`.
|
|
203
|
+
|
|
204
|
+
Raises:
|
|
205
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
206
|
+
|
|
207
|
+
Tags:
|
|
208
|
+
Lists, CRM
|
|
209
|
+
"""
|
|
210
|
+
if listId is None:
|
|
211
|
+
raise ValueError("Missing required parameter 'listId'.")
|
|
212
|
+
url = f"{self.base_url}/crm/v3/lists/{listId}"
|
|
213
|
+
query_params = {
|
|
214
|
+
k: v for k, v in [("includeFilters", includeFilters)] if v is not None
|
|
215
|
+
}
|
|
216
|
+
response = self._get(url, params=query_params)
|
|
217
|
+
return self._handle_response(response)
|
|
218
|
+
|
|
219
|
+
def delete_list_by_id(self, listId: str) -> Any:
|
|
220
|
+
"""
|
|
221
|
+
Delete a list by ILS list ID. Lists deleted through this endpoint can be restored for up to 90 days. After 90 days, the list is permanently purged and cannot be restored
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
listId (string): listId
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
Any: No content
|
|
228
|
+
|
|
229
|
+
Raises:
|
|
230
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
231
|
+
|
|
232
|
+
Tags:
|
|
233
|
+
Lists, CRM
|
|
234
|
+
"""
|
|
235
|
+
if listId is None:
|
|
236
|
+
raise ValueError("Missing required parameter 'listId'.")
|
|
237
|
+
url = f"{self.base_url}/crm/v3/lists/{listId}"
|
|
238
|
+
query_params = {}
|
|
239
|
+
response = self._delete(url, params=query_params)
|
|
240
|
+
return self._handle_response(response)
|
|
241
|
+
|
|
242
|
+
def add_records_to_list(self, listId: str, items: list[str]) -> dict[str, Any]:
|
|
243
|
+
"""
|
|
244
|
+
Add the records provided to the list. Records that do not exist or that are already members of the list are ignored.
|
|
245
|
+
This only works for lists that have a processingType of MANUAL or SNAPSHOT.
|
|
246
|
+
|
|
247
|
+
Args:
|
|
248
|
+
listId (string): listId
|
|
249
|
+
items (array): The **ILS IDs** of the records to add to the list.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
dict[str, Any]: Successful response
|
|
253
|
+
|
|
254
|
+
Raises:
|
|
255
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
256
|
+
|
|
257
|
+
Tags:
|
|
258
|
+
Memberships, Lists
|
|
259
|
+
"""
|
|
260
|
+
if listId is None:
|
|
261
|
+
raise ValueError("Missing required parameter 'listId'.")
|
|
262
|
+
request_body_data = None
|
|
263
|
+
# Using array parameter 'items' directly as request body
|
|
264
|
+
request_body_data = items
|
|
265
|
+
url = f"{self.base_url}/crm/v3/lists/{listId}/memberships/add"
|
|
266
|
+
query_params = {}
|
|
267
|
+
response = self._put(
|
|
268
|
+
url,
|
|
269
|
+
data=request_body_data,
|
|
270
|
+
params=query_params,
|
|
271
|
+
content_type="application/json",
|
|
272
|
+
)
|
|
273
|
+
return self._handle_response(response)
|
|
274
|
+
|
|
275
|
+
def remove_records_from_list(self, listId: str, items: list[str]) -> dict[str, Any]:
|
|
276
|
+
"""
|
|
277
|
+
Remove the records provided from the list. Records that are not members of the list are ignored.
|
|
278
|
+
This only works for lists that have a processingType of MANUAL or SNAPSHOT.
|
|
279
|
+
|
|
280
|
+
Args:
|
|
281
|
+
listId (string): listId
|
|
282
|
+
items (array): The **ILS IDs** of the records to remove from the list.
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
dict[str, Any]: Successful response
|
|
286
|
+
|
|
287
|
+
Raises:
|
|
288
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
289
|
+
|
|
290
|
+
Tags:
|
|
291
|
+
Memberships, Lists
|
|
292
|
+
"""
|
|
293
|
+
if listId is None:
|
|
294
|
+
raise ValueError("Missing required parameter 'listId'.")
|
|
295
|
+
request_body_data = None
|
|
296
|
+
# Using array parameter 'items' directly as request body
|
|
297
|
+
request_body_data = items
|
|
298
|
+
url = f"{self.base_url}/crm/v3/lists/{listId}/memberships/remove"
|
|
299
|
+
query_params = {}
|
|
300
|
+
response = self._put(
|
|
301
|
+
url,
|
|
302
|
+
data=request_body_data,
|
|
303
|
+
params=query_params,
|
|
304
|
+
content_type="application/json",
|
|
305
|
+
)
|
|
306
|
+
return self._handle_response(response)
|
|
307
|
+
|
|
308
|
+
def search_lists(
|
|
309
|
+
self,
|
|
310
|
+
listIds: list[str] | None = None,
|
|
311
|
+
offset: int | None = None,
|
|
312
|
+
query: str | None = None,
|
|
313
|
+
count: int | None = None,
|
|
314
|
+
processingTypes: list[str] | None = None,
|
|
315
|
+
additionalProperties: list[str] | None = None,
|
|
316
|
+
sort: str | None = None,
|
|
317
|
+
) -> dict[str, Any]:
|
|
318
|
+
"""
|
|
319
|
+
Search lists by list name or page through all lists by providing an empty query value.
|
|
320
|
+
|
|
321
|
+
Args:
|
|
322
|
+
listIds (array): The `listIds` that will be used to filter results by `listId`. If values are provided, then the response will only include results that have a `listId` in this array.
|
|
323
|
+
|
|
324
|
+
If no value is provided, or if an empty list is provided, then the results will not be filtered by `listId`.
|
|
325
|
+
offset (integer): Value used to paginate through lists. The `offset` provided in the response can be used in the next request to fetch the next page of results. Defaults to `0` if no offset is provided. Example: 0.
|
|
326
|
+
query (string): The `query` that will be used to search for lists by list name. If no `query` is provided, then the results will include all lists. Example: 'Test'.
|
|
327
|
+
count (integer): The number of lists to include in the response. Defaults to `20` if no value is provided. The max `count` is `500`. Example: 100.
|
|
328
|
+
processingTypes (array): The `processingTypes` that will be used to filter results by `processingType`. If values are provided, then the response will only include results that have a `processingType` in this array.
|
|
329
|
+
|
|
330
|
+
If no value is provided, or if an empty list is provided, then results will not be filtered by `processingType`.
|
|
331
|
+
|
|
332
|
+
Valid `processingTypes` are: `MANUAL`, `SNAPSHOT`, or `DYNAMIC`.
|
|
333
|
+
additionalProperties (array): The property names of any additional list properties to include in the response. Properties that do not exist or that are empty for a particular list are not included in the response.
|
|
334
|
+
|
|
335
|
+
By default, all requests will fetch the following properties for each list: `hs_list_size`, `hs_last_record_added_at`, `hs_last_record_removed_at`, `hs_folder_name`, and `hs_list_reference_count`. Example: ['hs_list_size_week_delta'].
|
|
336
|
+
sort (string): sort
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
dict[str, Any]: Successful response
|
|
340
|
+
|
|
341
|
+
Raises:
|
|
342
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
343
|
+
|
|
344
|
+
Tags:
|
|
345
|
+
Lists, CRM
|
|
346
|
+
"""
|
|
347
|
+
request_body_data = None
|
|
348
|
+
request_body_data = {
|
|
349
|
+
"listIds": listIds,
|
|
350
|
+
"offset": offset,
|
|
351
|
+
"query": query,
|
|
352
|
+
"count": count,
|
|
353
|
+
"processingTypes": processingTypes,
|
|
354
|
+
"additionalProperties": additionalProperties,
|
|
355
|
+
"sort": sort,
|
|
356
|
+
}
|
|
357
|
+
request_body_data = {
|
|
358
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
359
|
+
}
|
|
360
|
+
url = f"{self.base_url}/crm/v3/lists/search"
|
|
361
|
+
query_params = {}
|
|
362
|
+
response = self._post(
|
|
363
|
+
url,
|
|
364
|
+
data=request_body_data,
|
|
365
|
+
params=query_params,
|
|
366
|
+
content_type="application/json",
|
|
367
|
+
)
|
|
368
|
+
return self._handle_response(response)
|
|
369
|
+
|
|
370
|
+
def fetch_list_by_name(
|
|
371
|
+
self, objectTypeId: str, listName: str, includeFilters: bool | None = None
|
|
372
|
+
) -> dict[str, Any]:
|
|
373
|
+
"""
|
|
374
|
+
Fetch a list by its name and object type ID.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
objectTypeId (string): objectTypeId
|
|
378
|
+
listName (string): listName
|
|
379
|
+
includeFilters (boolean): A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response.
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
dict[str, Any]: Successful response, for a request with `includeFilters` set to `false`.
|
|
383
|
+
|
|
384
|
+
Raises:
|
|
385
|
+
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
386
|
+
|
|
387
|
+
Tags:
|
|
388
|
+
Lists, CRM
|
|
389
|
+
"""
|
|
390
|
+
if objectTypeId is None:
|
|
391
|
+
raise ValueError("Missing required parameter 'objectTypeId'.")
|
|
392
|
+
if listName is None:
|
|
393
|
+
raise ValueError("Missing required parameter 'listName'.")
|
|
394
|
+
url = f"{self.base_url}/crm/v3/lists/object-type-id/{objectTypeId}/name/{listName}"
|
|
395
|
+
query_params = {
|
|
396
|
+
k: v for k, v in [("includeFilters", includeFilters)] if v is not None
|
|
397
|
+
}
|
|
398
|
+
response = self._get(url, params=query_params)
|
|
399
|
+
return self._handle_response(response)
|
|
400
|
+
|
|
401
|
+
def list_tools(self):
|
|
402
|
+
all_tools = [
|
|
403
|
+
self.add_a_note,
|
|
404
|
+
self.fetch_multiple_lists,
|
|
405
|
+
self.fetch_list_memberships,
|
|
406
|
+
self.create_list,
|
|
407
|
+
self.get_list_by_id,
|
|
408
|
+
self.delete_list_by_id,
|
|
409
|
+
self.add_records_to_list,
|
|
410
|
+
self.remove_records_from_list,
|
|
411
|
+
self.search_lists,
|
|
412
|
+
self.fetch_list_by_name,
|
|
413
|
+
]
|
|
414
|
+
all_tools.extend(self.crm.list_tools())
|
|
415
|
+
all_tools.extend(self.marketing.list_tools())
|
|
416
|
+
return all_tools
|