Isaac454 commited on
Commit
4971068
·
verified ·
1 Parent(s): 0c2efad

Create WebhookPostTool.py

Browse files
Files changed (1) hide show
  1. tools/WebhookPostTool.py +11 -0
tools/WebhookPostTool.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class WebhookPostTool(Tool):
2
+ name = "webhook_post"
3
+ description = "Send a JSON payload to a webhook URL and return the response as text."
4
+ output_type = str # Must be one of SmolAgents authorized types
5
+
6
+ def forward(self, webhook_url: str, payload: dict) -> str:
7
+ try:
8
+ response = requests.post(webhook_url, json=payload)
9
+ return response.text
10
+ except Exception as e:
11
+ return f"Error sending request: {str(e)}"