fonada-sdk 0.1.0__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.
- fonada/__init__.py +200 -0
- fonada/_endpoints.py +494 -0
- fonada/_media_validation.py +129 -0
- fonada/_platform.py +38 -0
- fonada/async_resource.py +100 -0
- fonada/auth.py +188 -0
- fonada/auth_scope.py +97 -0
- fonada/channels/__init__.py +21 -0
- fonada/channels/base.py +288 -0
- fonada/channels/chatbot.py +1672 -0
- fonada/channels/flow.py +2598 -0
- fonada/channels/rcs.py +3492 -0
- fonada/channels/rcs_validation.py +1121 -0
- fonada/channels/voice.py +1644 -0
- fonada/channels/web_widget.py +1242 -0
- fonada/channels/whatsapp.py +3131 -0
- fonada/channels/whatsapp_campaign.py +209 -0
- fonada/client.py +586 -0
- fonada/exceptions.py +290 -0
- fonada/flow/__init__.py +25 -0
- fonada/flow/graph.py +317 -0
- fonada/flow/nodes.py +420 -0
- fonada/http_client.py +863 -0
- fonada/mcp.py +272 -0
- fonada/models/__init__.py +726 -0
- fonada/models/agent.py +353 -0
- fonada/models/agent_tools.py +178 -0
- fonada/models/base.py +58 -0
- fonada/models/campaign.py +162 -0
- fonada/models/chat.py +341 -0
- fonada/models/conversation.py +152 -0
- fonada/models/credits.py +350 -0
- fonada/models/crm_campaign.py +156 -0
- fonada/models/flow.py +862 -0
- fonada/models/knowledge_base.py +152 -0
- fonada/models/kpi.py +896 -0
- fonada/models/llm_voice.py +182 -0
- fonada/models/mcp.py +247 -0
- fonada/models/message.py +191 -0
- fonada/models/rcs.py +1392 -0
- fonada/models/telephony.py +737 -0
- fonada/models/telephony_analytics.py +574 -0
- fonada/models/tool.py +735 -0
- fonada/models/user.py +222 -0
- fonada/models/user_media.py +211 -0
- fonada/models/voice_webhooks.py +108 -0
- fonada/models/web_widget.py +36 -0
- fonada/models/webhooks.py +35 -0
- fonada/models/whatsapp.py +687 -0
- fonada/models/whatsapp_languages.py +288 -0
- fonada/py.typed +0 -0
- fonada/services/__init__.py +27 -0
- fonada/services/_agent_attached_tools.py +192 -0
- fonada/services/_agent_config.py +325 -0
- fonada/services/_agent_mcp.py +167 -0
- fonada/services/_agent_resolve.py +79 -0
- fonada/services/_agent_validation.py +471 -0
- fonada/services/_analytics_validation.py +270 -0
- fonada/services/_chat_summaries.py +311 -0
- fonada/services/_crm_contacts.py +370 -0
- fonada/services/_field_validation.py +325 -0
- fonada/services/_flow_resolve.py +15 -0
- fonada/services/_mcp_resolve.py +47 -0
- fonada/services/_rcs_campaign_analytics.py +499 -0
- fonada/services/_rcs_rich_text.py +117 -0
- fonada/services/_tool_creator_validation.py +131 -0
- fonada/services/_tool_resolve.py +95 -0
- fonada/services/_whatsapp_field_validation.py +251 -0
- fonada/services/_whatsapp_tool_validation.py +320 -0
- fonada/services/agent_handle.py +310 -0
- fonada/services/agent_knowledge_base.py +160 -0
- fonada/services/agent_kpis.py +342 -0
- fonada/services/agent_mcp.py +78 -0
- fonada/services/agents.py +1719 -0
- fonada/services/analytics.py +1847 -0
- fonada/services/base.py +44 -0
- fonada/services/builtin_call_tools.py +461 -0
- fonada/services/credits.py +495 -0
- fonada/services/crm_campaigns.py +667 -0
- fonada/services/knowledge_base.py +475 -0
- fonada/services/llm_voice.py +295 -0
- fonada/services/mcp_tools.py +576 -0
- fonada/services/media.py +649 -0
- fonada/services/numbers.py +1431 -0
- fonada/services/obd_admin.py +346 -0
- fonada/services/organizations.py +293 -0
- fonada/services/telephony_analytics.py +1113 -0
- fonada/services/telephony_campaigns.py +2163 -0
- fonada/services/tools.py +1132 -0
- fonada/services/users.py +422 -0
- fonada/services/webhooks.py +161 -0
- fonada/utils/__init__.py +15 -0
- fonada/utils/validators.py +123 -0
- fonada_sdk-0.1.0.dist-info/METADATA +1017 -0
- fonada_sdk-0.1.0.dist-info/RECORD +98 -0
- fonada_sdk-0.1.0.dist-info/WHEEL +5 -0
- fonada_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
- fonada_sdk-0.1.0.dist-info/top_level.txt +1 -0
fonada/__init__.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Fonada AI Python SDK
|
|
3
|
+
|
|
4
|
+
Official Python SDK for the Fonada AI Platform. Build, deploy, and manage
|
|
5
|
+
AI-powered conversation agents across WhatsApp, Voice, RCS, Web Widget,
|
|
6
|
+
ChatBot, and more — all from a single,
|
|
7
|
+
Pythonic interface.
|
|
8
|
+
|
|
9
|
+
Quick Start::
|
|
10
|
+
|
|
11
|
+
from fonada import FonadaClient
|
|
12
|
+
|
|
13
|
+
# Minimal — only the API key is required.
|
|
14
|
+
client = FonadaClient(api_key="fsk_...")
|
|
15
|
+
|
|
16
|
+
# Or load from environment (FONADA_API_KEY)
|
|
17
|
+
client = FonadaClient()
|
|
18
|
+
|
|
19
|
+
# Create an AI agent
|
|
20
|
+
agent = client.agents.create(
|
|
21
|
+
name="Support Bot",
|
|
22
|
+
channel="whatsapp",
|
|
23
|
+
system_prompt="You are a helpful support assistant.",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Chat using agent name (SDK resolves to ID automatically)
|
|
27
|
+
response = client.agents.chat(agent="Support Bot", message="Hello!")
|
|
28
|
+
print(response.reply)
|
|
29
|
+
|
|
30
|
+
# Build a conversation flow and attach it to an agent
|
|
31
|
+
flow = client.flow_builder.create_flow(
|
|
32
|
+
flow_name="IVR Menu",
|
|
33
|
+
config=my_flow_config,
|
|
34
|
+
)
|
|
35
|
+
client.agents.update(agent.id, agent_mode="flow", linked_flow_id=flow.id)
|
|
36
|
+
|
|
37
|
+
Environment Variables:
|
|
38
|
+
FONADA_API_KEY — Your Fonada API key (``fsk_`` prefix). Required when not
|
|
39
|
+
passed directly to :class:`FonadaClient`.
|
|
40
|
+
|
|
41
|
+
Channels:
|
|
42
|
+
client.whatsapp — WhatsApp Business messaging (templates, campaigns,
|
|
43
|
+
single messages, account management)
|
|
44
|
+
client.rcs — Jio RCS Business Messaging (templates, bots,
|
|
45
|
+
campaigns, reports)
|
|
46
|
+
client.voice — Voice / Telephony (IVR sessions, transcript processing)
|
|
47
|
+
client.web_widget — Embedded web chat widget (text + voice mode)
|
|
48
|
+
client.chatbot — Session-based chatbot conversations with full
|
|
49
|
+
history, export, and summary support
|
|
50
|
+
client.flow_builder — Visual conversation flow builder: create, validate,
|
|
51
|
+
publish, and AI-generate flows; attach to agents
|
|
52
|
+
|
|
53
|
+
Services:
|
|
54
|
+
client.agents — Agent CRUD, chat, flow mode, API key generation
|
|
55
|
+
client.credits — Credit balance, usage analytics, billing/payments
|
|
56
|
+
client.knowledge_base — Document ingestion, RAG search (PDF, URL, text)
|
|
57
|
+
client.llm_voice — Runtime LLM model and voice/ASR/TTS catalogs
|
|
58
|
+
client.tools — Create / manage user-defined API tools; attach to agents
|
|
59
|
+
client.users — User management and API key provisioning
|
|
60
|
+
client.organizations — Organisation creation, settings, credit allocation
|
|
61
|
+
client.mcp_tools — MCP catalog, connections, defaults, agent attachment
|
|
62
|
+
client.mcp — Alias for mcp_tools
|
|
63
|
+
client.webhooks — Webhook Manager (list/create/update/test/toggle)
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
from fonada.client import FonadaClient, AsyncFonadaClient
|
|
67
|
+
from fonada.flow import (
|
|
68
|
+
ActionNode,
|
|
69
|
+
ApiCallNode,
|
|
70
|
+
AskNode,
|
|
71
|
+
EndNode,
|
|
72
|
+
FlowGraph,
|
|
73
|
+
SayNode,
|
|
74
|
+
StartNode,
|
|
75
|
+
)
|
|
76
|
+
from fonada.services.agent_handle import AgentHandle
|
|
77
|
+
from fonada.auth import FonadaAuth, AuthType
|
|
78
|
+
from fonada.channels.rcs import contacts_to_csv, _normalize_phone as normalize_phone
|
|
79
|
+
from fonada.channels.web_widget import VoiceSession
|
|
80
|
+
from fonada.exceptions import (
|
|
81
|
+
FonadaError,
|
|
82
|
+
AuthenticationError,
|
|
83
|
+
AuthorizationError,
|
|
84
|
+
RateLimitError,
|
|
85
|
+
ValidationError,
|
|
86
|
+
NotFoundError,
|
|
87
|
+
FlowInUseError,
|
|
88
|
+
APIError,
|
|
89
|
+
InsufficientCreditsError,
|
|
90
|
+
MessagingWindowExpiredError,
|
|
91
|
+
TemplateNotApprovedError,
|
|
92
|
+
InvalidPhoneNumberError,
|
|
93
|
+
ConnectionError,
|
|
94
|
+
TimeoutError,
|
|
95
|
+
ConfigurationError,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Re-export commonly used models
|
|
99
|
+
from fonada.models import (
|
|
100
|
+
# Channels
|
|
101
|
+
Channel,
|
|
102
|
+
# Agents
|
|
103
|
+
Agent,
|
|
104
|
+
AgentMode,
|
|
105
|
+
AgentType,
|
|
106
|
+
LLMProvider,
|
|
107
|
+
AgentChatResponse,
|
|
108
|
+
# Messages
|
|
109
|
+
MessageType,
|
|
110
|
+
MessageStatus,
|
|
111
|
+
SendMessageResponse,
|
|
112
|
+
# Chat / Sessions
|
|
113
|
+
ChatSession,
|
|
114
|
+
ChatMessage,
|
|
115
|
+
ChatResponse,
|
|
116
|
+
SessionStatus,
|
|
117
|
+
# Campaigns
|
|
118
|
+
Campaign,
|
|
119
|
+
CampaignStatus,
|
|
120
|
+
CampaignType,
|
|
121
|
+
# Credits
|
|
122
|
+
ServiceKey,
|
|
123
|
+
CreditBalance,
|
|
124
|
+
# Knowledge Base
|
|
125
|
+
Document,
|
|
126
|
+
SearchResult,
|
|
127
|
+
# Users
|
|
128
|
+
User,
|
|
129
|
+
Organization,
|
|
130
|
+
UserRole,
|
|
131
|
+
OrgRole,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
__version__ = "0.1.0"
|
|
135
|
+
__author__ = "Fonada AI"
|
|
136
|
+
|
|
137
|
+
__all__ = [
|
|
138
|
+
# Clients
|
|
139
|
+
"FonadaClient",
|
|
140
|
+
"AsyncFonadaClient",
|
|
141
|
+
"MCP",
|
|
142
|
+
# Auth
|
|
143
|
+
"FonadaAuth",
|
|
144
|
+
"AuthType",
|
|
145
|
+
# Exceptions
|
|
146
|
+
"FonadaError",
|
|
147
|
+
"AuthenticationError",
|
|
148
|
+
"AuthorizationError",
|
|
149
|
+
"RateLimitError",
|
|
150
|
+
"ValidationError",
|
|
151
|
+
"NotFoundError",
|
|
152
|
+
"FlowInUseError",
|
|
153
|
+
"APIError",
|
|
154
|
+
"InsufficientCreditsError",
|
|
155
|
+
"MessagingWindowExpiredError",
|
|
156
|
+
"TemplateNotApprovedError",
|
|
157
|
+
"InvalidPhoneNumberError",
|
|
158
|
+
"ConnectionError",
|
|
159
|
+
"TimeoutError",
|
|
160
|
+
"ConfigurationError",
|
|
161
|
+
# Models
|
|
162
|
+
"Channel",
|
|
163
|
+
"Agent",
|
|
164
|
+
"AgentHandle",
|
|
165
|
+
"AgentMode",
|
|
166
|
+
"AgentType",
|
|
167
|
+
"LLMProvider",
|
|
168
|
+
"AgentChatResponse",
|
|
169
|
+
"MessageType",
|
|
170
|
+
"MessageStatus",
|
|
171
|
+
"SendMessageResponse",
|
|
172
|
+
"ChatSession",
|
|
173
|
+
"ChatMessage",
|
|
174
|
+
"ChatResponse",
|
|
175
|
+
"SessionStatus",
|
|
176
|
+
"Campaign",
|
|
177
|
+
"CampaignStatus",
|
|
178
|
+
"CampaignType",
|
|
179
|
+
"ServiceKey",
|
|
180
|
+
"CreditBalance",
|
|
181
|
+
"Document",
|
|
182
|
+
"SearchResult",
|
|
183
|
+
"User",
|
|
184
|
+
"Organization",
|
|
185
|
+
"UserRole",
|
|
186
|
+
"OrgRole",
|
|
187
|
+
# RCS contact helpers
|
|
188
|
+
"contacts_to_csv",
|
|
189
|
+
"normalize_phone",
|
|
190
|
+
# Flow Builder
|
|
191
|
+
"FlowGraph",
|
|
192
|
+
"StartNode",
|
|
193
|
+
"AskNode",
|
|
194
|
+
"SayNode",
|
|
195
|
+
"ActionNode",
|
|
196
|
+
"EndNode",
|
|
197
|
+
"ApiCallNode",
|
|
198
|
+
# Web Widget voice
|
|
199
|
+
"VoiceSession",
|
|
200
|
+
]
|