mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-14 01:09:43 +00:00
Revert "revert webhook schema updates" (#2482)
This commit is contained in:
parent
0116d2db52
commit
de18a60ac2
3 changed files with 60 additions and 72 deletions
|
@ -90,7 +90,7 @@ from skyvern.forge.sdk.workflow.models.yaml import (
|
|||
WorkflowCreateYAMLRequest,
|
||||
WorkflowDefinitionYAML,
|
||||
)
|
||||
from skyvern.schemas.runs import ProxyLocation
|
||||
from skyvern.schemas.runs import ProxyLocation, RunStatus, RunType, WorkflowRunRequest, WorkflowRunResponse
|
||||
from skyvern.webeye.browser_factory import BrowserState
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
@ -1220,39 +1220,37 @@ class WorkflowService:
|
|||
)
|
||||
return
|
||||
|
||||
# send webhook to the webhook callback url
|
||||
payload = workflow_run_status_response.model_dump_json()
|
||||
# build new schema for backward compatible webhook payload
|
||||
# app_url = (
|
||||
# f"{settings.SKYVERN_APP_URL.rstrip('/')}/workflows/"
|
||||
# f"{workflow_run.workflow_permanent_id}/{workflow_run.workflow_run_id}"
|
||||
# )
|
||||
# workflow_run_response = WorkflowRunResponse(
|
||||
# run_id=workflow_run.workflow_run_id,
|
||||
# run_type=RunType.workflow_run,
|
||||
# status=RunStatus(workflow_run_status_response.status),
|
||||
# output=workflow_run_status_response.outputs,
|
||||
# downloaded_files=workflow_run_status_response.downloaded_files,
|
||||
# recording_url=workflow_run_status_response.recording_url,
|
||||
# screenshot_urls=workflow_run_status_response.screenshot_urls,
|
||||
# failure_reason=workflow_run_status_response.failure_reason,
|
||||
# app_url=app_url,
|
||||
# created_at=workflow_run_status_response.created_at,
|
||||
# modified_at=workflow_run_status_response.modified_at,
|
||||
# run_request=WorkflowRunRequest(
|
||||
# workflow_id=workflow_run.workflow_permanent_id,
|
||||
# title=workflow_run_status_response.workflow_title,
|
||||
# parameters=workflow_run_status_response.parameters,
|
||||
# proxy_location=workflow_run.proxy_location,
|
||||
# webhook_url=workflow_run.webhook_callback_url or None,
|
||||
# totp_url=workflow_run.totp_verification_url or None,
|
||||
# totp_identifier=workflow_run.totp_identifier,
|
||||
# ),
|
||||
# )
|
||||
# payload_dict = json.loads(workflow_run_status_response.model_dump_json())
|
||||
# workflow_run_response_dict = json.loads(workflow_run_response.model_dump_json())
|
||||
# payload_dict.update(workflow_run_response_dict)
|
||||
# payload = json.dumps(payload_dict, default=str)
|
||||
app_url = (
|
||||
f"{settings.SKYVERN_APP_URL.rstrip('/')}/workflows/"
|
||||
f"{workflow_run.workflow_permanent_id}/{workflow_run.workflow_run_id}"
|
||||
)
|
||||
workflow_run_response = WorkflowRunResponse(
|
||||
run_id=workflow_run.workflow_run_id,
|
||||
run_type=RunType.workflow_run,
|
||||
status=RunStatus(workflow_run_status_response.status),
|
||||
output=workflow_run_status_response.outputs,
|
||||
downloaded_files=workflow_run_status_response.downloaded_files,
|
||||
recording_url=workflow_run_status_response.recording_url,
|
||||
screenshot_urls=workflow_run_status_response.screenshot_urls,
|
||||
failure_reason=workflow_run_status_response.failure_reason,
|
||||
app_url=app_url,
|
||||
created_at=workflow_run_status_response.created_at,
|
||||
modified_at=workflow_run_status_response.modified_at,
|
||||
run_request=WorkflowRunRequest(
|
||||
workflow_id=workflow_run.workflow_permanent_id,
|
||||
title=workflow_run_status_response.workflow_title,
|
||||
parameters=workflow_run_status_response.parameters,
|
||||
proxy_location=workflow_run.proxy_location,
|
||||
webhook_url=workflow_run.webhook_callback_url or None,
|
||||
totp_url=workflow_run.totp_verification_url or None,
|
||||
totp_identifier=workflow_run.totp_identifier,
|
||||
),
|
||||
)
|
||||
payload_dict = json.loads(workflow_run_status_response.model_dump_json())
|
||||
workflow_run_response_dict = json.loads(workflow_run_response.model_dump_json())
|
||||
payload_dict.update(workflow_run_response_dict)
|
||||
payload = json.dumps(payload_dict, separators=(",", ":"), ensure_ascii=False)
|
||||
headers = generate_skyvern_webhook_headers(
|
||||
payload=payload,
|
||||
api_key=api_key,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue