Skip to content

Commit 2ff0122

Browse files
combining arguments into object
1 parent 5306f3a commit 2ff0122

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

src/sap_cloud_sdk/extensibility/client.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -498,20 +498,23 @@ async def call_hook(
498498

499499
# 3. Execute workflow
500500
message_body = message.model_dump(mode="json") if message is not None else {}
501+
execute_arguments = {
502+
"workflowId": hook.n8n_workflow_config.workflow_id,
503+
"inputs": {
504+
"type": "webhook",
505+
"webhookData": {
506+
"method": hook.n8n_workflow_config.method,
507+
"query": {},
508+
"body": message_body,
509+
"headers": headers or {},
510+
},
511+
},
512+
}
501513
try:
502514
result_str = await agw_client.call_mcp_tool(
503515
execute_tool,
504516
user_token=user_token or None,
505-
workflowId=hook.n8n_workflow_config.workflow_id,
506-
inputs={
507-
"type": "webhook",
508-
"webhookData": {
509-
"method": hook.n8n_workflow_config.method,
510-
"query": {},
511-
"body": message_body,
512-
"headers": headers or {},
513-
},
514-
},
517+
**execute_arguments,
515518
)
516519
except Exception as exc:
517520
raise TransportError(
@@ -558,12 +561,15 @@ async def call_hook(
558561
await asyncio.sleep(_HOOK_POLL_INTERVAL)
559562

560563
try:
564+
get_execution_arguments = {
565+
"workflowId": hook.n8n_workflow_config.workflow_id,
566+
"executionId": str(execution_id),
567+
"includeData": True,
568+
}
561569
result_str = await agw_client.call_mcp_tool(
562570
get_exec_tool,
563571
user_token=user_token or None,
564-
workflowId=hook.n8n_workflow_config.workflow_id,
565-
executionId=str(execution_id),
566-
includeData=True,
572+
**get_execution_arguments,
567573
)
568574
except Exception as exc:
569575
raise TransportError(

0 commit comments

Comments
 (0)