|
3 | 3 | from collections.abc import Awaitable, Callable, Iterable |
4 | 4 | from typing import Any, TypeVar |
5 | 5 |
|
6 | | -from microsoft_agents.activity import ChannelId |
| 6 | +from microsoft_agents.activity import Activity, ChannelId |
7 | 7 | from microsoft_agents.hosting.core import TurnContext |
8 | 8 | from microsoft_agents.hosting.core.app.state import TurnState |
9 | 9 | from .models.agent_notification_activity import AgentNotificationActivity, NotificationTypes |
10 | 10 | from .models.agent_subchannel import AgentSubChannel |
11 | 11 | from .models.agent_lifecycle_event import AgentLifecycleEvent |
| 12 | +from .models.email_response import EmailResponse |
12 | 13 |
|
13 | 14 | TContext = TypeVar("TContext", bound=TurnContext) |
14 | 15 | TState = TypeVar("TState", bound=TurnState) |
@@ -181,3 +182,14 @@ def _normalize_lifecycleevent(value: str | AgentLifecycleEvent | None) -> str: |
181 | 182 | return "" |
182 | 183 | resolved = value.value if isinstance(value, AgentLifecycleEvent) else str(value) |
183 | 184 | return resolved.lower().strip() |
| 185 | + |
| 186 | + @staticmethod |
| 187 | + def create_email_response_activity( |
| 188 | + activity: Activity, email_response_html_body: str |
| 189 | + ) -> Activity: |
| 190 | + working_activity = activity.create_reply() |
| 191 | + email_response = EmailResponse(html_body=email_response_html_body) |
| 192 | + if working_activity.entities is None: |
| 193 | + working_activity.entities = [] |
| 194 | + working_activity.entities.append(email_response) |
| 195 | + return working_activity |
0 commit comments