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,1065 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from universal_mcp.applications.application import APIApplication
|
|
4
|
+
from universal_mcp.integrations import Integration
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class WhatsappBusinessApp(APIApplication):
|
|
8
|
+
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
|
9
|
+
super().__init__(name="whatsapp-business", integration=integration, **kwargs)
|
|
10
|
+
self.base_url = "https://graph.facebook.com"
|
|
11
|
+
|
|
12
|
+
def get_analytics(
|
|
13
|
+
self, api_version: str, waba_id: str, fields: str | None = None
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
"""
|
|
16
|
+
Retrieves details of a specified WhatsApp Business Account (WABA) with customizable fields using the GET method.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
api_version (string): api-version
|
|
20
|
+
waba_id (string): waba-id
|
|
21
|
+
fields (string): Specifies which fields to include/exclude in the response for the WhatsApp Business Account resource. Example: 'analytics.start(1680503760).end(1680564980).granularity(DAY).phone_numbers([]).country_codes(["US", "BR"])'.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
dict[str, Any]: Example reponse / Example response / Example response / Example response
|
|
25
|
+
|
|
26
|
+
Raises:
|
|
27
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
28
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
29
|
+
|
|
30
|
+
Tags:
|
|
31
|
+
WhatsApp Business Accounts (WABA)
|
|
32
|
+
"""
|
|
33
|
+
if api_version is None:
|
|
34
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
35
|
+
if waba_id is None:
|
|
36
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
37
|
+
url = f"{self.base_url}/{api_version}/{waba_id}"
|
|
38
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
|
39
|
+
response = self._get(url, params=query_params)
|
|
40
|
+
response.raise_for_status()
|
|
41
|
+
if (
|
|
42
|
+
response.status_code == 204
|
|
43
|
+
or not response.content
|
|
44
|
+
or not response.text.strip()
|
|
45
|
+
):
|
|
46
|
+
return None
|
|
47
|
+
try:
|
|
48
|
+
return response.json()
|
|
49
|
+
except ValueError:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
def get_credit_lines(
|
|
53
|
+
self, api_version: str, business_account_id: str
|
|
54
|
+
) -> dict[str, Any]:
|
|
55
|
+
"""
|
|
56
|
+
Retrieves the extended credit lines available for a specified business account using its ID.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
api_version (string): api-version
|
|
60
|
+
business_account_id (string): business-account-id
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
dict[str, Any]: Example response
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
67
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
68
|
+
|
|
69
|
+
Tags:
|
|
70
|
+
Billing
|
|
71
|
+
"""
|
|
72
|
+
if api_version is None:
|
|
73
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
74
|
+
if business_account_id is None:
|
|
75
|
+
raise ValueError("Missing required parameter 'business-account-id'.")
|
|
76
|
+
url = f"{self.base_url}/{api_version}/{business_account_id}/extendedcredits"
|
|
77
|
+
query_params = {}
|
|
78
|
+
response = self._get(url, params=query_params)
|
|
79
|
+
response.raise_for_status()
|
|
80
|
+
if (
|
|
81
|
+
response.status_code == 204
|
|
82
|
+
or not response.content
|
|
83
|
+
or not response.text.strip()
|
|
84
|
+
):
|
|
85
|
+
return None
|
|
86
|
+
try:
|
|
87
|
+
return response.json()
|
|
88
|
+
except ValueError:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
def get_business_account(
|
|
92
|
+
self, api_version: str, business_account_id: str, fields: str | None = None
|
|
93
|
+
) -> dict[str, Any]:
|
|
94
|
+
"""
|
|
95
|
+
Retrieves information about a business account using the specified API version and business account ID, optionally filtering the response fields via a query parameter.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
api_version (string): api-version
|
|
99
|
+
business_account_id (string): business-account-id
|
|
100
|
+
fields (string): Specifies the fields to include in the response, reducing payload size by returning only the requested data. Example: 'id,name,timezone_id'.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
dict[str, Any]: Example response
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
107
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
108
|
+
|
|
109
|
+
Tags:
|
|
110
|
+
Business accounts, important
|
|
111
|
+
"""
|
|
112
|
+
if api_version is None:
|
|
113
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
114
|
+
if business_account_id is None:
|
|
115
|
+
raise ValueError("Missing required parameter 'business-account-id'.")
|
|
116
|
+
url = f"{self.base_url}/{api_version}/{business_account_id}"
|
|
117
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
|
118
|
+
response = self._get(url, params=query_params)
|
|
119
|
+
response.raise_for_status()
|
|
120
|
+
if (
|
|
121
|
+
response.status_code == 204
|
|
122
|
+
or not response.content
|
|
123
|
+
or not response.text.strip()
|
|
124
|
+
):
|
|
125
|
+
return None
|
|
126
|
+
try:
|
|
127
|
+
return response.json()
|
|
128
|
+
except ValueError:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
def get_commerce_settings(
|
|
132
|
+
self, api_version: str, business_phone_number_id: str
|
|
133
|
+
) -> dict[str, Any]:
|
|
134
|
+
"""
|
|
135
|
+
Retrieves the commerce settings configured for a specific WhatsApp Business phone number.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
api_version (string): api-version
|
|
139
|
+
business_phone_number_id (string): business-phone-number-id
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
dict[str, Any]: Example response
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
146
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
147
|
+
|
|
148
|
+
Tags:
|
|
149
|
+
Commerce, important
|
|
150
|
+
"""
|
|
151
|
+
if api_version is None:
|
|
152
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
153
|
+
if business_phone_number_id is None:
|
|
154
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
155
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/whatsapp_commerce_settings"
|
|
156
|
+
query_params = {}
|
|
157
|
+
response = self._get(url, params=query_params)
|
|
158
|
+
response.raise_for_status()
|
|
159
|
+
if (
|
|
160
|
+
response.status_code == 204
|
|
161
|
+
or not response.content
|
|
162
|
+
or not response.text.strip()
|
|
163
|
+
):
|
|
164
|
+
return None
|
|
165
|
+
try:
|
|
166
|
+
return response.json()
|
|
167
|
+
except ValueError:
|
|
168
|
+
return None
|
|
169
|
+
|
|
170
|
+
def set_or_update_commerce_settings(
|
|
171
|
+
self,
|
|
172
|
+
api_version: str,
|
|
173
|
+
business_phone_number_id: str,
|
|
174
|
+
is_cart_enabled: str | None = None,
|
|
175
|
+
is_catalog_visible: str | None = None,
|
|
176
|
+
) -> dict[str, Any]:
|
|
177
|
+
"""
|
|
178
|
+
Updates WhatsApp Business commerce settings (cart availability and catalog visibility) for a specific business phone number.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
api_version (string): api-version
|
|
182
|
+
business_phone_number_id (string): business-phone-number-id
|
|
183
|
+
is_cart_enabled (string): Indicates whether the shopping cart is enabled or disabled for the specified WhatsApp commerce settings. Example: 'true'.
|
|
184
|
+
is_catalog_visible (string): Determines whether the business's product catalog is visible to customers in WhatsApp conversations. Example: 'true'.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
dict[str, Any]: Example response
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
191
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
192
|
+
|
|
193
|
+
Tags:
|
|
194
|
+
Commerce
|
|
195
|
+
"""
|
|
196
|
+
if api_version is None:
|
|
197
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
198
|
+
if business_phone_number_id is None:
|
|
199
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
200
|
+
request_body_data = None
|
|
201
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/whatsapp_commerce_settings"
|
|
202
|
+
query_params = {
|
|
203
|
+
k: v
|
|
204
|
+
for k, v in [
|
|
205
|
+
("is_cart_enabled", is_cart_enabled),
|
|
206
|
+
("is_catalog_visible", is_catalog_visible),
|
|
207
|
+
]
|
|
208
|
+
if v is not None
|
|
209
|
+
}
|
|
210
|
+
response = self._post(
|
|
211
|
+
url,
|
|
212
|
+
data=request_body_data,
|
|
213
|
+
params=query_params,
|
|
214
|
+
content_type="application/json",
|
|
215
|
+
)
|
|
216
|
+
response.raise_for_status()
|
|
217
|
+
if (
|
|
218
|
+
response.status_code == 204
|
|
219
|
+
or not response.content
|
|
220
|
+
or not response.text.strip()
|
|
221
|
+
):
|
|
222
|
+
return None
|
|
223
|
+
try:
|
|
224
|
+
return response.json()
|
|
225
|
+
except ValueError:
|
|
226
|
+
return None
|
|
227
|
+
|
|
228
|
+
def upload_file(
|
|
229
|
+
self,
|
|
230
|
+
api_version: str,
|
|
231
|
+
app_id: str,
|
|
232
|
+
file_length: str | None = None,
|
|
233
|
+
file_type: str | None = None,
|
|
234
|
+
) -> dict[str, Any]:
|
|
235
|
+
"""
|
|
236
|
+
Uploads a file using the specified API version and application ID, with optional query parameters for file length and type, and returns a successful status message upon completion.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
api_version (string): api-version
|
|
240
|
+
app_id (string): app-id
|
|
241
|
+
file_length (string): File size, in bytes Example: '<FILE_SIZE>'.
|
|
242
|
+
file_type (string): File MIME type (e.g. image/jpg) Example: '<MIME_TYPE>'.
|
|
243
|
+
|
|
244
|
+
Returns:
|
|
245
|
+
dict[str, Any]: Step 1 example response
|
|
246
|
+
|
|
247
|
+
Raises:
|
|
248
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
249
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
250
|
+
|
|
251
|
+
Tags:
|
|
252
|
+
Media
|
|
253
|
+
"""
|
|
254
|
+
if api_version is None:
|
|
255
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
256
|
+
if app_id is None:
|
|
257
|
+
raise ValueError("Missing required parameter 'app-id'.")
|
|
258
|
+
request_body_data = None
|
|
259
|
+
url = f"{self.base_url}/{api_version}/{app_id}/uploads"
|
|
260
|
+
query_params = {
|
|
261
|
+
k: v
|
|
262
|
+
for k, v in [("file_length", file_length), ("file_type", file_type)]
|
|
263
|
+
if v is not None
|
|
264
|
+
}
|
|
265
|
+
response = self._post(
|
|
266
|
+
url,
|
|
267
|
+
data=request_body_data,
|
|
268
|
+
params=query_params,
|
|
269
|
+
content_type="application/json",
|
|
270
|
+
)
|
|
271
|
+
response.raise_for_status()
|
|
272
|
+
if (
|
|
273
|
+
response.status_code == 204
|
|
274
|
+
or not response.content
|
|
275
|
+
or not response.text.strip()
|
|
276
|
+
):
|
|
277
|
+
return None
|
|
278
|
+
try:
|
|
279
|
+
return response.json()
|
|
280
|
+
except ValueError:
|
|
281
|
+
return None
|
|
282
|
+
|
|
283
|
+
def resume_session(self, api_version: str) -> dict[str, Any]:
|
|
284
|
+
"""
|
|
285
|
+
Initiates a session using the provided SESSION_ID and file offset specified in the header, supporting further session-related operations via the POST method at the "/{api-version}/<SESSION_ID>" endpoint.
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
api_version (string): api-version
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
dict[str, Any]: Step 2 example response
|
|
292
|
+
|
|
293
|
+
Raises:
|
|
294
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
295
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
296
|
+
|
|
297
|
+
Tags:
|
|
298
|
+
Media
|
|
299
|
+
"""
|
|
300
|
+
if api_version is None:
|
|
301
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
302
|
+
request_body_data = None
|
|
303
|
+
url = f"{self.base_url}/{api_version}/<SESSION_ID>"
|
|
304
|
+
query_params = {}
|
|
305
|
+
response = self._post(
|
|
306
|
+
url,
|
|
307
|
+
data=request_body_data,
|
|
308
|
+
params=query_params,
|
|
309
|
+
content_type="application/json",
|
|
310
|
+
)
|
|
311
|
+
response.raise_for_status()
|
|
312
|
+
if (
|
|
313
|
+
response.status_code == 204
|
|
314
|
+
or not response.content
|
|
315
|
+
or not response.text.strip()
|
|
316
|
+
):
|
|
317
|
+
return None
|
|
318
|
+
try:
|
|
319
|
+
return response.json()
|
|
320
|
+
except ValueError:
|
|
321
|
+
return None
|
|
322
|
+
|
|
323
|
+
def get_business_phone_number(
|
|
324
|
+
self,
|
|
325
|
+
api_version: str,
|
|
326
|
+
business_phone_number_id: str,
|
|
327
|
+
fields: str | None = None,
|
|
328
|
+
) -> dict[str, Any]:
|
|
329
|
+
"""
|
|
330
|
+
Retrieves details for a specific business phone number ID using query parameters to specify returned fields.
|
|
331
|
+
|
|
332
|
+
Args:
|
|
333
|
+
api_version (string): api-version
|
|
334
|
+
business_phone_number_id (string): business-phone-number-id
|
|
335
|
+
fields (string): Specifies which fields to include in the response for the business phone number. Example: 'id,display_phone_number,name_status'.
|
|
336
|
+
|
|
337
|
+
Returns:
|
|
338
|
+
dict[str, Any]: Example response / Example response
|
|
339
|
+
|
|
340
|
+
Raises:
|
|
341
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
342
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
343
|
+
|
|
344
|
+
Tags:
|
|
345
|
+
Phone numbers, important
|
|
346
|
+
"""
|
|
347
|
+
if api_version is None:
|
|
348
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
349
|
+
if business_phone_number_id is None:
|
|
350
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
351
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}"
|
|
352
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
|
353
|
+
response = self._get(url, params=query_params)
|
|
354
|
+
response.raise_for_status()
|
|
355
|
+
if (
|
|
356
|
+
response.status_code == 204
|
|
357
|
+
or not response.content
|
|
358
|
+
or not response.text.strip()
|
|
359
|
+
):
|
|
360
|
+
return None
|
|
361
|
+
try:
|
|
362
|
+
return response.json()
|
|
363
|
+
except ValueError:
|
|
364
|
+
return None
|
|
365
|
+
|
|
366
|
+
def get_all_business_phone_numbers(
|
|
367
|
+
self,
|
|
368
|
+
api_version: str,
|
|
369
|
+
waba_id: str,
|
|
370
|
+
fields: str | None = None,
|
|
371
|
+
filtering: str | None = None,
|
|
372
|
+
) -> list[Any]:
|
|
373
|
+
"""
|
|
374
|
+
Retrieves a list of phone numbers associated with a specific WhatsApp Business Account (WABA), allowing for filtering and customization of the response fields.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
api_version (string): api-version
|
|
378
|
+
waba_id (string): waba-id
|
|
379
|
+
fields (string): Optional parameter to specify which fields should be included in the response for phone numbers associated with a WABA, allowing customization of the returned data. Example: 'id,is_official_business_account,display_phone_number,verified_name'.
|
|
380
|
+
filtering (string): Specifies query parameters to filter phone numbers based on specific criteria for the GET operation. Example: "[{'field':'account_mode','operator':'EQUAL','value':'SANDBOX'}]".
|
|
381
|
+
|
|
382
|
+
Returns:
|
|
383
|
+
list[Any]: Example response
|
|
384
|
+
|
|
385
|
+
Raises:
|
|
386
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
387
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
388
|
+
|
|
389
|
+
Tags:
|
|
390
|
+
Phone numbers, important
|
|
391
|
+
"""
|
|
392
|
+
if api_version is None:
|
|
393
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
394
|
+
if waba_id is None:
|
|
395
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
396
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/phone_numbers"
|
|
397
|
+
query_params = {
|
|
398
|
+
k: v
|
|
399
|
+
for k, v in [("fields", fields), ("filtering", filtering)]
|
|
400
|
+
if v is not None
|
|
401
|
+
}
|
|
402
|
+
response = self._get(url, params=query_params)
|
|
403
|
+
response.raise_for_status()
|
|
404
|
+
if (
|
|
405
|
+
response.status_code == 204
|
|
406
|
+
or not response.content
|
|
407
|
+
or not response.text.strip()
|
|
408
|
+
):
|
|
409
|
+
return None
|
|
410
|
+
try:
|
|
411
|
+
return response.json()
|
|
412
|
+
except ValueError:
|
|
413
|
+
return None
|
|
414
|
+
|
|
415
|
+
def get_qr_code(
|
|
416
|
+
self, api_version: str, business_phone_number_id: str
|
|
417
|
+
) -> dict[str, Any]:
|
|
418
|
+
"""
|
|
419
|
+
Retrieves a message linked to a specific QR code for a business phone number using the GET method via the API.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
api_version (string): api-version
|
|
423
|
+
business_phone_number_id (string): business-phone-number-id
|
|
424
|
+
|
|
425
|
+
Returns:
|
|
426
|
+
dict[str, Any]: Example Response
|
|
427
|
+
|
|
428
|
+
Raises:
|
|
429
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
430
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
431
|
+
|
|
432
|
+
Tags:
|
|
433
|
+
QR codes
|
|
434
|
+
"""
|
|
435
|
+
if api_version is None:
|
|
436
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
437
|
+
if business_phone_number_id is None:
|
|
438
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
439
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/message_qrdls/<QR_CODE_ID>"
|
|
440
|
+
query_params = {}
|
|
441
|
+
response = self._get(url, params=query_params)
|
|
442
|
+
response.raise_for_status()
|
|
443
|
+
if (
|
|
444
|
+
response.status_code == 204
|
|
445
|
+
or not response.content
|
|
446
|
+
or not response.text.strip()
|
|
447
|
+
):
|
|
448
|
+
return None
|
|
449
|
+
try:
|
|
450
|
+
return response.json()
|
|
451
|
+
except ValueError:
|
|
452
|
+
return None
|
|
453
|
+
|
|
454
|
+
def delete_qr_code(
|
|
455
|
+
self, api_version: str, business_phone_number_id: str
|
|
456
|
+
) -> dict[str, Any]:
|
|
457
|
+
"""
|
|
458
|
+
Deletes a specific WhatsApp Business QR code using the provided QR code ID and returns a success message if the operation is completed successfully.
|
|
459
|
+
|
|
460
|
+
Args:
|
|
461
|
+
api_version (string): api-version
|
|
462
|
+
business_phone_number_id (string): business-phone-number-id
|
|
463
|
+
|
|
464
|
+
Returns:
|
|
465
|
+
dict[str, Any]: Example Response
|
|
466
|
+
|
|
467
|
+
Raises:
|
|
468
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
469
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
470
|
+
|
|
471
|
+
Tags:
|
|
472
|
+
QR codes
|
|
473
|
+
"""
|
|
474
|
+
if api_version is None:
|
|
475
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
476
|
+
if business_phone_number_id is None:
|
|
477
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
478
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/message_qrdls/<QR_CODE_ID>"
|
|
479
|
+
query_params = {}
|
|
480
|
+
response = self._delete(url, params=query_params)
|
|
481
|
+
response.raise_for_status()
|
|
482
|
+
if (
|
|
483
|
+
response.status_code == 204
|
|
484
|
+
or not response.content
|
|
485
|
+
or not response.text.strip()
|
|
486
|
+
):
|
|
487
|
+
return None
|
|
488
|
+
try:
|
|
489
|
+
return response.json()
|
|
490
|
+
except ValueError:
|
|
491
|
+
return None
|
|
492
|
+
|
|
493
|
+
def get_all_qr_codes_default_fields(
|
|
494
|
+
self,
|
|
495
|
+
api_version: str,
|
|
496
|
+
business_phone_number_id: str,
|
|
497
|
+
fields: str | None = None,
|
|
498
|
+
code: str | None = None,
|
|
499
|
+
) -> dict[str, Any]:
|
|
500
|
+
"""
|
|
501
|
+
Retrieves a list of message QR code deep links associated with a business phone number, filtered by specified fields and QR code identifiers.
|
|
502
|
+
|
|
503
|
+
Args:
|
|
504
|
+
api_version (string): api-version
|
|
505
|
+
business_phone_number_id (string): business-phone-number-id
|
|
506
|
+
fields (string): .format can be SVG or PNG Example: 'code,prefilled_message,qr_image_url.format(SVG)'.
|
|
507
|
+
code (string): The unique identifier code used to filter messages associated with the specified business phone number. Example: '<QR_CODE_ID>'.
|
|
508
|
+
|
|
509
|
+
Returns:
|
|
510
|
+
dict[str, Any]: Example Response / Example Response / Example Response / Example Response
|
|
511
|
+
|
|
512
|
+
Raises:
|
|
513
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
514
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
515
|
+
|
|
516
|
+
Tags:
|
|
517
|
+
QR codes
|
|
518
|
+
"""
|
|
519
|
+
if api_version is None:
|
|
520
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
521
|
+
if business_phone_number_id is None:
|
|
522
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
523
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/message_qrdls"
|
|
524
|
+
query_params = {
|
|
525
|
+
k: v for k, v in [("fields", fields), ("code", code)] if v is not None
|
|
526
|
+
}
|
|
527
|
+
response = self._get(url, params=query_params)
|
|
528
|
+
response.raise_for_status()
|
|
529
|
+
if (
|
|
530
|
+
response.status_code == 204
|
|
531
|
+
or not response.content
|
|
532
|
+
or not response.text.strip()
|
|
533
|
+
):
|
|
534
|
+
return None
|
|
535
|
+
try:
|
|
536
|
+
return response.json()
|
|
537
|
+
except ValueError:
|
|
538
|
+
return None
|
|
539
|
+
|
|
540
|
+
def create_qr_code(
|
|
541
|
+
self,
|
|
542
|
+
api_version: str,
|
|
543
|
+
business_phone_number_id: str,
|
|
544
|
+
code: str | None = None,
|
|
545
|
+
prefilled_message: str | None = None,
|
|
546
|
+
) -> dict[str, Any]:
|
|
547
|
+
"""
|
|
548
|
+
Creates a WhatsApp Business QR code with a predefined message and returns the generated code details.
|
|
549
|
+
|
|
550
|
+
Args:
|
|
551
|
+
api_version (string): api-version
|
|
552
|
+
business_phone_number_id (string): business-phone-number-id
|
|
553
|
+
code (string): code Example: 'WOMVT6TJ2BP7A1'.
|
|
554
|
+
prefilled_message (string): prefilled_message Example: 'Tell me about your new workshops'.
|
|
555
|
+
|
|
556
|
+
Returns:
|
|
557
|
+
dict[str, Any]: Example Response / Example Response
|
|
558
|
+
|
|
559
|
+
Raises:
|
|
560
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
561
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
562
|
+
|
|
563
|
+
Tags:
|
|
564
|
+
QR codes
|
|
565
|
+
"""
|
|
566
|
+
if api_version is None:
|
|
567
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
568
|
+
if business_phone_number_id is None:
|
|
569
|
+
raise ValueError("Missing required parameter 'business-phone-number-id'.")
|
|
570
|
+
request_body_data = None
|
|
571
|
+
request_body_data = {
|
|
572
|
+
"code": code,
|
|
573
|
+
"prefilled_message": prefilled_message,
|
|
574
|
+
}
|
|
575
|
+
request_body_data = {
|
|
576
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
577
|
+
}
|
|
578
|
+
url = f"{self.base_url}/{api_version}/{business_phone_number_id}/message_qrdls"
|
|
579
|
+
query_params = {}
|
|
580
|
+
response = self._post(
|
|
581
|
+
url,
|
|
582
|
+
data=request_body_data,
|
|
583
|
+
params=query_params,
|
|
584
|
+
content_type="application/json",
|
|
585
|
+
)
|
|
586
|
+
response.raise_for_status()
|
|
587
|
+
if (
|
|
588
|
+
response.status_code == 204
|
|
589
|
+
or not response.content
|
|
590
|
+
or not response.text.strip()
|
|
591
|
+
):
|
|
592
|
+
return None
|
|
593
|
+
try:
|
|
594
|
+
return response.json()
|
|
595
|
+
except ValueError:
|
|
596
|
+
return None
|
|
597
|
+
|
|
598
|
+
def get_template_by_id_default_fields(self, api_version: str) -> dict[str, Any]:
|
|
599
|
+
"""
|
|
600
|
+
Retrieves a template using the specified template ID from the API version path.
|
|
601
|
+
|
|
602
|
+
Args:
|
|
603
|
+
api_version (string): api-version
|
|
604
|
+
|
|
605
|
+
Returns:
|
|
606
|
+
dict[str, Any]: Example response
|
|
607
|
+
|
|
608
|
+
Raises:
|
|
609
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
610
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
611
|
+
|
|
612
|
+
Tags:
|
|
613
|
+
Templates
|
|
614
|
+
"""
|
|
615
|
+
if api_version is None:
|
|
616
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
617
|
+
url = f"{self.base_url}/{api_version}/<TEMPLATE_ID>"
|
|
618
|
+
query_params = {}
|
|
619
|
+
response = self._get(url, params=query_params)
|
|
620
|
+
response.raise_for_status()
|
|
621
|
+
if (
|
|
622
|
+
response.status_code == 204
|
|
623
|
+
or not response.content
|
|
624
|
+
or not response.text.strip()
|
|
625
|
+
):
|
|
626
|
+
return None
|
|
627
|
+
try:
|
|
628
|
+
return response.json()
|
|
629
|
+
except ValueError:
|
|
630
|
+
return None
|
|
631
|
+
|
|
632
|
+
def edit_template(
|
|
633
|
+
self,
|
|
634
|
+
api_version: str,
|
|
635
|
+
category: str | None = None,
|
|
636
|
+
components: list[dict[str, Any]] | None = None,
|
|
637
|
+
language: str | None = None,
|
|
638
|
+
name: str | None = None,
|
|
639
|
+
) -> dict[str, Any]:
|
|
640
|
+
"""
|
|
641
|
+
Creates or processes a resource using the specified template ID based on the API version and returns a successful status upon completion.
|
|
642
|
+
|
|
643
|
+
Args:
|
|
644
|
+
api_version (string): api-version
|
|
645
|
+
category (string): category Example: 'MARKETING'.
|
|
646
|
+
components (array): components Example: "[{'format': 'TEXT', 'text': 'Fall Sale', 'type': 'HEADER'}, {'example': {'body_text': [['Mark', 'FALL25']]}, 'text': 'Hi {{1}}, our Fall Sale is on! Use promo code {{2}} Get an extra 25% off every order above $350!', 'type': 'BODY'}, {'text': 'Not interested in any of our sales? Tap Stop Promotions', 'type': 'FOOTER'}, {'buttons': [{'text': 'Stop promotions', 'type': 'QUICK_REPLY'}], 'type': 'BUTTONS'}]".
|
|
647
|
+
language (string): language Example: 'en_US'.
|
|
648
|
+
name (string): name Example: '2023_april_promo'.
|
|
649
|
+
|
|
650
|
+
Returns:
|
|
651
|
+
dict[str, Any]: Example response
|
|
652
|
+
|
|
653
|
+
Raises:
|
|
654
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
655
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
656
|
+
|
|
657
|
+
Tags:
|
|
658
|
+
Templates
|
|
659
|
+
"""
|
|
660
|
+
if api_version is None:
|
|
661
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
662
|
+
request_body_data = None
|
|
663
|
+
request_body_data = {
|
|
664
|
+
"category": category,
|
|
665
|
+
"components": components,
|
|
666
|
+
"language": language,
|
|
667
|
+
"name": name,
|
|
668
|
+
}
|
|
669
|
+
request_body_data = {
|
|
670
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
671
|
+
}
|
|
672
|
+
url = f"{self.base_url}/{api_version}/<TEMPLATE_ID>"
|
|
673
|
+
query_params = {}
|
|
674
|
+
response = self._post(
|
|
675
|
+
url,
|
|
676
|
+
data=request_body_data,
|
|
677
|
+
params=query_params,
|
|
678
|
+
content_type="application/json",
|
|
679
|
+
)
|
|
680
|
+
response.raise_for_status()
|
|
681
|
+
if (
|
|
682
|
+
response.status_code == 204
|
|
683
|
+
or not response.content
|
|
684
|
+
or not response.text.strip()
|
|
685
|
+
):
|
|
686
|
+
return None
|
|
687
|
+
try:
|
|
688
|
+
return response.json()
|
|
689
|
+
except ValueError:
|
|
690
|
+
return None
|
|
691
|
+
|
|
692
|
+
def get_template_by_name_default_fields(
|
|
693
|
+
self, api_version: str, waba_id: str, name: str | None = None
|
|
694
|
+
) -> dict[str, Any]:
|
|
695
|
+
"""
|
|
696
|
+
Retrieves a list of WhatsApp message templates associated with a specific WhatsApp Business Account using the "GET" method, allowing filtering by template name.
|
|
697
|
+
|
|
698
|
+
Args:
|
|
699
|
+
api_version (string): api-version
|
|
700
|
+
waba_id (string): waba-id
|
|
701
|
+
name (string): Filters message templates by exact name match. Example: '<TEMPLATE_NAME>'.
|
|
702
|
+
|
|
703
|
+
Returns:
|
|
704
|
+
dict[str, Any]: Example response / Example response
|
|
705
|
+
|
|
706
|
+
Raises:
|
|
707
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
708
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
709
|
+
|
|
710
|
+
Tags:
|
|
711
|
+
Templates
|
|
712
|
+
"""
|
|
713
|
+
if api_version is None:
|
|
714
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
715
|
+
if waba_id is None:
|
|
716
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
717
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/message_templates"
|
|
718
|
+
query_params = {k: v for k, v in [("name", name)] if v is not None}
|
|
719
|
+
response = self._get(url, params=query_params)
|
|
720
|
+
response.raise_for_status()
|
|
721
|
+
if (
|
|
722
|
+
response.status_code == 204
|
|
723
|
+
or not response.content
|
|
724
|
+
or not response.text.strip()
|
|
725
|
+
):
|
|
726
|
+
return None
|
|
727
|
+
try:
|
|
728
|
+
return response.json()
|
|
729
|
+
except ValueError:
|
|
730
|
+
return None
|
|
731
|
+
|
|
732
|
+
def create_message_template(
|
|
733
|
+
self,
|
|
734
|
+
api_version: str,
|
|
735
|
+
waba_id: str,
|
|
736
|
+
category: str | None = None,
|
|
737
|
+
components: list[dict[str, Any]] | None = None,
|
|
738
|
+
language: str | None = None,
|
|
739
|
+
name: str | None = None,
|
|
740
|
+
) -> dict[str, Any]:
|
|
741
|
+
"""
|
|
742
|
+
Creates a new WhatsApp message template for a business account, allowing businesses to send standardized messages to customers.
|
|
743
|
+
|
|
744
|
+
Args:
|
|
745
|
+
api_version (string): api-version
|
|
746
|
+
waba_id (string): waba-id
|
|
747
|
+
category (string): category Example: 'UTILITY'.
|
|
748
|
+
components (array): components Example: "[{'example': {'header_handle': ['4::YXBwbGljYXRpb24vcGRm:ARZVv4zuogJMxmAdS3_6T4o_K4ll2806avA7rWpikisTzYPsXXUeKk0REjS-hIM1rYrizHD7rQXj951TKgUFblgd_BDWVROCwRkg9Vhjj-cHNQ:e:1681237341:634974688087057:100089620928913:ARa1ZDhwbLZM3EENeeg']}, 'format': 'DOCUMENT', 'type': 'HEADER'}, {'example': {'body_text': [['Mark', '860198-230332']]}, 'text': 'Thank you for your order, {{1}}! Your order number is {{2}}. Tap the PDF linked above to view your receipt. If you have any questions, please use the buttons below to contact support. Thanks again!', 'type': 'BODY'}, {'buttons': [{'phone_number': '16467043595', 'text': 'Call', 'type': 'PHONE_NUMBER'}, {'text': 'Contact Support', 'type': 'URL', 'url': 'https://www.examplesite.com/support'}], 'type': 'BUTTONS'}]".
|
|
749
|
+
language (string): language Example: 'en_US'.
|
|
750
|
+
name (string): name Example: 'order_confirmation'.
|
|
751
|
+
|
|
752
|
+
Returns:
|
|
753
|
+
dict[str, Any]: Example response / Example response / Example response / Example response / Example response / Example response / Example response / Example response
|
|
754
|
+
|
|
755
|
+
Raises:
|
|
756
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
757
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
758
|
+
|
|
759
|
+
Tags:
|
|
760
|
+
Templates, important
|
|
761
|
+
"""
|
|
762
|
+
if api_version is None:
|
|
763
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
764
|
+
if waba_id is None:
|
|
765
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
766
|
+
request_body_data = None
|
|
767
|
+
request_body_data = {
|
|
768
|
+
"category": category,
|
|
769
|
+
"components": components,
|
|
770
|
+
"language": language,
|
|
771
|
+
"name": name,
|
|
772
|
+
}
|
|
773
|
+
request_body_data = {
|
|
774
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
775
|
+
}
|
|
776
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/message_templates"
|
|
777
|
+
query_params = {}
|
|
778
|
+
response = self._post(
|
|
779
|
+
url,
|
|
780
|
+
data=request_body_data,
|
|
781
|
+
params=query_params,
|
|
782
|
+
content_type="application/json",
|
|
783
|
+
)
|
|
784
|
+
response.raise_for_status()
|
|
785
|
+
if (
|
|
786
|
+
response.status_code == 204
|
|
787
|
+
or not response.content
|
|
788
|
+
or not response.text.strip()
|
|
789
|
+
):
|
|
790
|
+
return None
|
|
791
|
+
try:
|
|
792
|
+
return response.json()
|
|
793
|
+
except ValueError:
|
|
794
|
+
return None
|
|
795
|
+
|
|
796
|
+
def delete_template_by_name(
|
|
797
|
+
self,
|
|
798
|
+
api_version: str,
|
|
799
|
+
waba_id: str,
|
|
800
|
+
name: str | None = None,
|
|
801
|
+
hsm_id: str | None = None,
|
|
802
|
+
) -> dict[str, Any]:
|
|
803
|
+
"""
|
|
804
|
+
Deletes WhatsApp message templates by name (all languages) or specific ID using query parameters and returns a success status.
|
|
805
|
+
|
|
806
|
+
Args:
|
|
807
|
+
api_version (string): api-version
|
|
808
|
+
waba_id (string): waba-id
|
|
809
|
+
name (string): The name of the message template to delete. Example: '<TEMPLATE_NAME>'.
|
|
810
|
+
hsm_id (string): Template ID Example: '<HSM_ID>'.
|
|
811
|
+
|
|
812
|
+
Returns:
|
|
813
|
+
dict[str, Any]: Example response / Example response
|
|
814
|
+
|
|
815
|
+
Raises:
|
|
816
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
817
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
818
|
+
|
|
819
|
+
Tags:
|
|
820
|
+
Templates
|
|
821
|
+
"""
|
|
822
|
+
if api_version is None:
|
|
823
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
824
|
+
if waba_id is None:
|
|
825
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
826
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/message_templates"
|
|
827
|
+
query_params = {
|
|
828
|
+
k: v for k, v in [("name", name), ("hsm_id", hsm_id)] if v is not None
|
|
829
|
+
}
|
|
830
|
+
response = self._delete(url, params=query_params)
|
|
831
|
+
response.raise_for_status()
|
|
832
|
+
if (
|
|
833
|
+
response.status_code == 204
|
|
834
|
+
or not response.content
|
|
835
|
+
or not response.text.strip()
|
|
836
|
+
):
|
|
837
|
+
return None
|
|
838
|
+
try:
|
|
839
|
+
return response.json()
|
|
840
|
+
except ValueError:
|
|
841
|
+
return None
|
|
842
|
+
|
|
843
|
+
def get_subscribed_apps(self, api_version: str, waba_id: str) -> dict[str, Any]:
|
|
844
|
+
"""
|
|
845
|
+
Retrieves a list of apps subscribed to webhooks for a WhatsApp Business Account using the GET method.
|
|
846
|
+
|
|
847
|
+
Args:
|
|
848
|
+
api_version (string): api-version
|
|
849
|
+
waba_id (string): waba-id
|
|
850
|
+
|
|
851
|
+
Returns:
|
|
852
|
+
dict[str, Any]: Example response
|
|
853
|
+
|
|
854
|
+
Raises:
|
|
855
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
856
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
857
|
+
|
|
858
|
+
Tags:
|
|
859
|
+
Webhooks
|
|
860
|
+
"""
|
|
861
|
+
if api_version is None:
|
|
862
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
863
|
+
if waba_id is None:
|
|
864
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
865
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/subscribed_apps"
|
|
866
|
+
query_params = {}
|
|
867
|
+
response = self._get(url, params=query_params)
|
|
868
|
+
response.raise_for_status()
|
|
869
|
+
if (
|
|
870
|
+
response.status_code == 204
|
|
871
|
+
or not response.content
|
|
872
|
+
or not response.text.strip()
|
|
873
|
+
):
|
|
874
|
+
return None
|
|
875
|
+
try:
|
|
876
|
+
return response.json()
|
|
877
|
+
except ValueError:
|
|
878
|
+
return None
|
|
879
|
+
|
|
880
|
+
def subscribe_app_to_waba_swebhooks(
|
|
881
|
+
self, api_version: str, waba_id: str
|
|
882
|
+
) -> dict[str, Any]:
|
|
883
|
+
"""
|
|
884
|
+
Subscribes an app to webhooks for a WhatsApp Business Account (WABA) using the POST method at the `/subscribed_apps` endpoint, allowing the app to receive updates and notifications from the WABA.
|
|
885
|
+
|
|
886
|
+
Args:
|
|
887
|
+
api_version (string): api-version
|
|
888
|
+
waba_id (string): waba-id
|
|
889
|
+
|
|
890
|
+
Returns:
|
|
891
|
+
dict[str, Any]: Example response
|
|
892
|
+
|
|
893
|
+
Raises:
|
|
894
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
895
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
896
|
+
|
|
897
|
+
Tags:
|
|
898
|
+
Webhooks
|
|
899
|
+
"""
|
|
900
|
+
if api_version is None:
|
|
901
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
902
|
+
if waba_id is None:
|
|
903
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
904
|
+
request_body_data = None
|
|
905
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/subscribed_apps"
|
|
906
|
+
query_params = {}
|
|
907
|
+
response = self._post(
|
|
908
|
+
url,
|
|
909
|
+
data=request_body_data,
|
|
910
|
+
params=query_params,
|
|
911
|
+
content_type="application/json",
|
|
912
|
+
)
|
|
913
|
+
response.raise_for_status()
|
|
914
|
+
if (
|
|
915
|
+
response.status_code == 204
|
|
916
|
+
or not response.content
|
|
917
|
+
or not response.text.strip()
|
|
918
|
+
):
|
|
919
|
+
return None
|
|
920
|
+
try:
|
|
921
|
+
return response.json()
|
|
922
|
+
except ValueError:
|
|
923
|
+
return None
|
|
924
|
+
|
|
925
|
+
def unsubscribe_apps_by_waba_id(
|
|
926
|
+
self, api_version: str, waba_id: str
|
|
927
|
+
) -> dict[str, Any]:
|
|
928
|
+
"""
|
|
929
|
+
Unsubscribes an app from webhook notifications for a WhatsApp Business Account.
|
|
930
|
+
|
|
931
|
+
Args:
|
|
932
|
+
api_version (string): api-version
|
|
933
|
+
waba_id (string): waba-id
|
|
934
|
+
|
|
935
|
+
Returns:
|
|
936
|
+
dict[str, Any]: Example response
|
|
937
|
+
|
|
938
|
+
Raises:
|
|
939
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
940
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
941
|
+
|
|
942
|
+
Tags:
|
|
943
|
+
Webhooks
|
|
944
|
+
"""
|
|
945
|
+
if api_version is None:
|
|
946
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
947
|
+
if waba_id is None:
|
|
948
|
+
raise ValueError("Missing required parameter 'waba-id'.")
|
|
949
|
+
url = f"{self.base_url}/{api_version}/{waba_id}/subscribed_apps"
|
|
950
|
+
query_params = {}
|
|
951
|
+
response = self._delete(url, params=query_params)
|
|
952
|
+
response.raise_for_status()
|
|
953
|
+
if (
|
|
954
|
+
response.status_code == 204
|
|
955
|
+
or not response.content
|
|
956
|
+
or not response.text.strip()
|
|
957
|
+
):
|
|
958
|
+
return None
|
|
959
|
+
try:
|
|
960
|
+
return response.json()
|
|
961
|
+
except ValueError:
|
|
962
|
+
return None
|
|
963
|
+
|
|
964
|
+
def get_all_shared_wabas(self, api_version: str, business_account_id: str) -> Any:
|
|
965
|
+
"""
|
|
966
|
+
Retrieves information about WhatsApp Business accounts associated with a business client, using the specified business account ID and API version.
|
|
967
|
+
|
|
968
|
+
Args:
|
|
969
|
+
api_version (string): api-version
|
|
970
|
+
business_account_id (string): business-account-id
|
|
971
|
+
|
|
972
|
+
Returns:
|
|
973
|
+
Any: API response data.
|
|
974
|
+
|
|
975
|
+
Raises:
|
|
976
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
977
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
978
|
+
|
|
979
|
+
Tags:
|
|
980
|
+
WhatsApp Business Accounts (WABA)
|
|
981
|
+
"""
|
|
982
|
+
if api_version is None:
|
|
983
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
984
|
+
if business_account_id is None:
|
|
985
|
+
raise ValueError("Missing required parameter 'business-account-id'.")
|
|
986
|
+
url = f"{self.base_url}/{api_version}/{business_account_id}/client_whatsapp_business_accounts"
|
|
987
|
+
query_params = {}
|
|
988
|
+
response = self._get(url, params=query_params)
|
|
989
|
+
response.raise_for_status()
|
|
990
|
+
if (
|
|
991
|
+
response.status_code == 204
|
|
992
|
+
or not response.content
|
|
993
|
+
or not response.text.strip()
|
|
994
|
+
):
|
|
995
|
+
return None
|
|
996
|
+
try:
|
|
997
|
+
return response.json()
|
|
998
|
+
except ValueError:
|
|
999
|
+
return None
|
|
1000
|
+
|
|
1001
|
+
def get_all_owned_wabas(
|
|
1002
|
+
self, api_version: str, business_account_id: str
|
|
1003
|
+
) -> dict[str, Any]:
|
|
1004
|
+
"""
|
|
1005
|
+
Retrieves a list of WhatsApp Business Accounts owned by or shared with the specified business account using a GET request to the given endpoint.
|
|
1006
|
+
|
|
1007
|
+
Args:
|
|
1008
|
+
api_version (string): api-version
|
|
1009
|
+
business_account_id (string): business-account-id
|
|
1010
|
+
|
|
1011
|
+
Returns:
|
|
1012
|
+
dict[str, Any]: Example response
|
|
1013
|
+
|
|
1014
|
+
Raises:
|
|
1015
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
1016
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
1017
|
+
|
|
1018
|
+
Tags:
|
|
1019
|
+
WhatsApp Business Accounts (WABA)
|
|
1020
|
+
"""
|
|
1021
|
+
if api_version is None:
|
|
1022
|
+
raise ValueError("Missing required parameter 'api-version'.")
|
|
1023
|
+
if business_account_id is None:
|
|
1024
|
+
raise ValueError("Missing required parameter 'business-account-id'.")
|
|
1025
|
+
url = f"{self.base_url}/{api_version}/{business_account_id}/owned_whatsapp_business_accounts"
|
|
1026
|
+
query_params = {}
|
|
1027
|
+
response = self._get(url, params=query_params)
|
|
1028
|
+
response.raise_for_status()
|
|
1029
|
+
if (
|
|
1030
|
+
response.status_code == 204
|
|
1031
|
+
or not response.content
|
|
1032
|
+
or not response.text.strip()
|
|
1033
|
+
):
|
|
1034
|
+
return None
|
|
1035
|
+
try:
|
|
1036
|
+
return response.json()
|
|
1037
|
+
except ValueError:
|
|
1038
|
+
return None
|
|
1039
|
+
|
|
1040
|
+
def list_tools(self):
|
|
1041
|
+
return [
|
|
1042
|
+
self.get_analytics,
|
|
1043
|
+
self.get_credit_lines,
|
|
1044
|
+
self.get_business_account,
|
|
1045
|
+
self.get_commerce_settings,
|
|
1046
|
+
self.set_or_update_commerce_settings,
|
|
1047
|
+
self.upload_file,
|
|
1048
|
+
self.resume_session,
|
|
1049
|
+
self.get_business_phone_number,
|
|
1050
|
+
self.get_all_business_phone_numbers,
|
|
1051
|
+
self.get_qr_code,
|
|
1052
|
+
self.delete_qr_code,
|
|
1053
|
+
self.get_all_qr_codes_default_fields,
|
|
1054
|
+
self.create_qr_code,
|
|
1055
|
+
self.get_template_by_id_default_fields,
|
|
1056
|
+
self.edit_template,
|
|
1057
|
+
self.get_template_by_name_default_fields,
|
|
1058
|
+
self.create_message_template,
|
|
1059
|
+
self.delete_template_by_name,
|
|
1060
|
+
self.get_subscribed_apps,
|
|
1061
|
+
self.subscribe_app_to_waba_swebhooks,
|
|
1062
|
+
self.unsubscribe_apps_by_waba_id,
|
|
1063
|
+
self.get_all_shared_wabas,
|
|
1064
|
+
self.get_all_owned_wabas,
|
|
1065
|
+
]
|