fix: API calling endpoint

This commit is contained in:
Abhishek Kumar 2026-01-12 16:05:57 +05:30
parent 11e033c72d
commit df2bfd7429
3 changed files with 6 additions and 16 deletions

View file

@ -133,6 +133,7 @@ async def initiate_call(
workflow_id=trigger.workflow_id,
mode=workflow_run_mode,
initial_context={
"provider": provider.PROVIDER_NAME,
"phone_number": request.phone_number,
"agent_uuid": uuid,
**(request.initial_context or {}),
@ -158,23 +159,12 @@ async def initiate_call(
)
# 10. Initiate call via telephony provider
result = await provider.initiate_call(
await provider.initiate_call(
to_number=request.phone_number,
webhook_url=webhook_url,
workflow_run_id=workflow_run.id,
)
# 11. Store provider metadata in workflow run context
gathered_context = {
"provider": provider.PROVIDER_NAME,
"triggered_by": "api",
"trigger_uuid": uuid,
**(result.provider_metadata or {}),
}
await db_client.update_workflow_run(
run_id=workflow_run.id, gathered_context=gathered_context
)
logger.info(
f"Call initiated successfully for workflow run {workflow_run.id} "
f"via trigger {uuid}"

View file

@ -31,7 +31,7 @@ async def run_integrations_post_workflow_run(_ctx, workflow_run_id: int):
)
if not workflow_run or not workflow_run.workflow:
logger.error("Workflow run or workflow not found")
logger.warning("Workflow run or workflow not found")
return
if not organization_id:
@ -68,7 +68,7 @@ async def run_integrations_post_workflow_run(_ctx, workflow_run_id: int):
)
except Exception as e:
# Log error but continue with other webhooks
logger.error(
logger.warning(
f"Failed to execute webhook '{webhook_data.get('name', 'unknown')}': {e}"
)
@ -120,7 +120,7 @@ async def _execute_webhook_node(
# 2. Validate endpoint URL
url = webhook_data.get("endpoint_url")
if not url:
logger.error(f"Webhook '{webhook_name}' has no endpoint URL")
logger.warning(f"Webhook '{webhook_name}' has no endpoint URL")
return False
# 3. Build headers