Skip to content

Commit 4e758a9

Browse files
fix: enrich trigger response
1 parent 6295031 commit 4e758a9

8 files changed

Lines changed: 46 additions & 20 deletions

File tree

packages/uipath-core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-core"
3-
version = "0.5.13"
3+
version = "0.5.14"
44
description = "UiPath Core abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-core/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath-platform/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-platform"
3-
version = "0.1.38"
3+
version = "0.1.39"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from uipath.platform.action_center import Task
2424
from uipath.platform.action_center.tasks import TaskStatus
2525
from uipath.platform.common._config import UiPathConfig
26+
from uipath.platform.connections import EventArguments
2627
from uipath.platform.common.interrupt_models import (
2728
CreateBatchTransform,
2829
CreateDeepRag,
@@ -406,9 +407,13 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None:
406407
case UiPathResumeTriggerType.INBOX:
407408
if trigger.integration_resume and trigger.integration_resume.inbox_id:
408409
try:
409-
return await uipath.jobs.retrieve_inbox_payload_async(
410+
inbox_payload = await uipath.jobs.retrieve_inbox_payload_async(
410411
trigger.integration_resume.inbox_id
411412
)
413+
event_args = EventArguments.model_validate(inbox_payload)
414+
return await uipath.connections.retrieve_event_payload_async(
415+
event_args
416+
)
412417
except Exception as e:
413418
raise UiPathFaultedTriggerError(
414419
ErrorCategory.SYSTEM,
@@ -947,13 +952,15 @@ async def _handle_inbox_trigger(
947952
connections = await uipath.connections.list_async(
948953
name=value.connection_name,
949954
folder_path=value.connection_folder_path,
955+
connector_key=value.connector,
950956
)
951957
connection = next(
952958
(c for c in connections if c.name == value.connection_name), None
953959
)
954960
if connection is None:
955961
raise Exception(
956-
f"No connection named '{value.connection_name}' found"
962+
f"No connection named '{value.connection_name}' "
963+
f"for connector '{value.connector}' found"
957964
+ (
958965
f" in folder '{value.connection_folder_path}'"
959966
if value.connection_folder_path

packages/uipath-platform/tests/services/test_hitl.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import uuid
23
from typing import Any
34
from unittest.mock import AsyncMock, patch
@@ -518,18 +519,36 @@ async def test_read_inbox_trigger(
518519
base_url: str,
519520
setup_test_env: None,
520521
) -> None:
521-
"""Test reading an Inbox trigger fetches the payload via GetPayload.
522-
523-
Orchestrator returns the stored payload directly (no envelope), so the
524-
inbox reader must surface the response body as-is.
522+
"""Test reading an Inbox trigger fetches the IS metadata via GetPayload
523+
and then enriches it via /elements_/v1/events/{processedEventId}.
525524
"""
526525
inbox_id = str(uuid.uuid4())
527-
payload_data = {"text": "hello from slack", "channel": "alerts"}
526+
processed_event_id = "v2::pp::1777041494382::334071::e374ecd5d0f73c21"
527+
inbox_metadata = {
528+
"UiPathEventConnector": "uipath-slack",
529+
"UiPathEvent": "NEW_MESSAGE",
530+
"UiPathEventObjectType": "Message",
531+
"UiPathEventObjectId": "C123:1777041494.382",
532+
"UiPathAdditionalEventData": json.dumps(
533+
{"processedEventId": processed_event_id}
534+
),
535+
}
536+
enriched_event = {
537+
"channel": "alerts",
538+
"user": "U456",
539+
"text": "hello from slack",
540+
"ts": "1777041494.382",
541+
}
528542

529543
httpx_mock.add_response(
530544
url=f"{base_url}/orchestrator_/api/JobTriggers/GetPayload/{inbox_id}",
531545
status_code=200,
532-
json=payload_data,
546+
json=inbox_metadata,
547+
)
548+
httpx_mock.add_response(
549+
url=f"{base_url}/elements_/v1/events/{processed_event_id}",
550+
status_code=200,
551+
json=enriched_event,
533552
)
534553

535554
resume_trigger = UiPathResumeTrigger(
@@ -545,7 +564,7 @@ async def test_read_inbox_trigger(
545564

546565
reader = UiPathResumeTriggerReader()
547566
result = await reader.read_trigger(resume_trigger)
548-
assert result == payload_data
567+
assert result == enriched_event
549568

550569
@pytest.mark.anyio
551570
async def test_read_inbox_trigger_failure(
@@ -1490,7 +1509,7 @@ async def test_create_resume_trigger_wait_integration_event(
14901509
assert isinstance(resume_trigger.integration_resume.inbox_id, str)
14911510
uuid.UUID(resume_trigger.integration_resume.inbox_id)
14921511
mock_list_async.assert_called_once_with(
1493-
name="Slack-Alerts", folder_path="Shared"
1512+
name="Slack-Alerts", folder_path="Shared", connector_key="slack"
14941513
)
14951514

14961515
@pytest.mark.anyio
@@ -1522,7 +1541,7 @@ async def test_create_resume_trigger_wait_integration_event_optional_fields_omit
15221541
assert resume_trigger.integration_resume.filter_expression is None
15231542
assert resume_trigger.integration_resume.parameters is None
15241543
mock_list_async.assert_called_once_with(
1525-
name="Teams-Default", folder_path=None
1544+
name="Teams-Default", folder_path=None, connector_key="teams"
15261545
)
15271546

15281547
@pytest.mark.anyio

packages/uipath-platform/uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.56"
3+
version = "2.10.59"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath/uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)