알림 작업 - 아마존 WorkMail

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

알림 작업

Amazon WorkMail 푸시 알림 API를 사용하면 새 이메일 및 캘린더 업데이트를 포함하여 사서함의 변경 사항에 대한 푸시 알림을 받을 수 있습니다. 또한 알림 메시지를 수신할 URL(또는 푸시 알림 수신인)을 등록해야 합니다. 이 기능을 통해 개발자는 Amazon WorkMail 사용자를 위한 반응형 애플리케이션을 만들 수 있습니다. 애플리케이션은 사용자 사서함에서 변경 내용을 신속하게 통보받기 때문입니다.

자세한 내용은 Notification subscriptions, mailbox events, and EWS in Exchange를 참조하십시오.

사서함 변경 이벤트(새 메일, 생성됨, 수정됨)에 따라 특정 폴더(받은 편지함, 일정 등) 또는 모든 폴더를 구독할 수 있습니다.

EWS Java API 또는 Managed EWS C# API 같은 클라이언트 라이브러리를 사용하면 이러한 기능에 접근할 수 있습니다. AWS Lambda 및 API Gateway (AWS 서버리스 프레임워크 사용) 를 사용하여 개발된 푸시 응답기의 전체 샘플 애플리케이션은 이 페이지에서 제공됩니다. AWS GitHub 이 애플리케이션은 EWS Java API를 사용합니다.

다음은 푸시 구독 요청을 나타내는 샘플입니다.

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:Body> <m:Subscribe xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> <m:PushSubscriptionRequest> <t:FolderIds> <t:DistinguishedFolderId Id="inbox" /> </t:FolderIds> <t:EventTypes> <t:EventType>NewMailEvent</t:EventType> <t:EventType>CopiedEvent</t:EventType> <t:EventType>CreatedEvent</t:EventType> <t:EventType>DeletedEvent</t:EventType> <t:EventType>ModifiedEvent</t:EventType> <t:EventType>MovedEvent</t:EventType> </t:EventTypes> <t:StatusFrequency>1</t:StatusFrequency> <t:URL>https://YOUR_PUSH_RESPONDER_URL</t:URL> </m:PushSubscriptionRequest> </m:Subscribe> </soap:Body> </soap:Envelope>

다음은 성공적인 구독 요청 결과입니다.

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Header xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <ServerVersionInfo xmlns="http://schemas.microsoft.com/exchange/services/2006/types" MajorVersion="14" MinorVersion="2" MajorBuildNumber="390" Version="Exchange2010_SP2" MinorBuildNumber="3" /> </Header> <soap:Body> <m:SubscribeResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <m:ResponseMessages> <m:SubscribeResponseMessage ResponseClass="Success"> <m:ResponseCode>NoError</m:ResponseCode> <m:SubscriptionId>hKJETtoAdi9PPW0tZDQ4MThmMDoVYB</m:SubscriptionId> <m:Watermark>AAAAAAA=</m:Watermark> </m:SubscribeResponseMessage> </m:ResponseMessages> </m:SubscribeResponse> </soap:Body> </soap:Envelope>

그런 다음 알림 메시지가 구독 요청에서 지정한 URL로 전송됩니다. 다음은 알림 샘플입니다.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <t:RequestServerVersion xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" Version="Exchange2010_SP2"> </t:RequestServerVersion> </soap:Header> <soap:Body> <m:SendNotification xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> <m:ResponseMessages> <m:SendNotificationResponseMessage ResponseClass="Success"> <m:ResponseCode>NoError</m:ResponseCode> <m:Notification> <t:SubscriptionId>hKJETtoAdi9PPW0tZDQ4MThmMDoVYB</t:SubscriptionId> <t:PreviousWatermark>ygwAAAAAAAA=</t:PreviousWatermark> <t:MoreEvents>false</t:MoreEvents> <t:ModifiedEvent> <t:Watermark>ywwAAAAAAAA=</t:Watermark> <t:TimeStamp>2018-02-02T15:15:14Z</t:TimeStamp> <t:FolderId Id="AAB2L089bS1kNDgxOGYwOGE5OTQ0="></t:FolderId> <t:ParentFolderId Id="AAB2L089bS1kNDgxOGYwOGE="></t:ParentFolderId> </t:ModifiedEvent> </m:Notification> </m:SendNotificationResponseMessage> </m:ResponseMessages> </m:SendNotification> </soap:Body> </soap:Envelope>

푸시 알림 응답자가 알림 메시지를 수신하였다고 알려주려면 다음과 같이 응답해야 합니다.

<?xml version="1.0"?> <s:Envelope xmlns:s= "http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <SendNotificationResult xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <SubscriptionStatus>OK</SubscriptionStatus> </SendNotificationResult> </s:Body> </s:Envelope>

클라이언트가 푸시 알림 메시지 수신을 구독 해제하려면 다음과 유사한 방법으로 SubscriptionStatus 필드에 구독 해제 응답 메시지를 전송해야 합니다.

<?xml version="1.0"?> <s:Envelope xmlns:s= "http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <SendNotificationResult xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <SubscriptionStatus>Unsubscribe</SubscriptionStatus> </SendNotificationResult> </s:Body> </s:Envelope>

푸시 알림 응답자의 상태를 확인하기 위해 Amazon은 “하트비트" (a라고도 함) 를 WorkMail 전송합니다. StatusEvent 전송 주기는 초기 구독 요청에서 입력한 StatusFrequency 파라미터에 따라 결정됩니다. 예를 들어 StatusFrequency1이면 StatusEvent가 1분마다 전송됩니다. 이 값은 1~1440분까지 설정할 수 있습니다. StatusEvent의 모습은 다음과 같습니다.

<?xml version="1.0 (http://www.w3.org/TR/REC-xml/)" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <t:RequestServerVersion xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" Version="Exchange2010_SP2"/> </soap:Header> <soap:Body> <m:SendNotification xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> <m:ResponseMessages> <m:SendNotificationResponseMessage ResponseClass="Success"> <m:ResponseCode>NoError</m:ResponseCode> <m:Notification> <t:SubscriptionId>hKJETtoAdi9PPW0tZDQ4MThmMDoVYB</t:SubscriptionId> <t:PreviousWatermark>AAAAAAAAAAA=</t:PreviousWatermark> <t:MoreEvents>false</t:MoreEvents> <t:StatusEvent> <t:Watermark>AAAAAAAAAAA=</t:Watermark> </t:StatusEvent> </m:Notification> </m:SendNotificationResponseMessage> </m:ResponseMessages> </m:SendNotification> </soap:Body> </soap:Envelope>

클라이언트 푸시 알림 응답자가 이전과 같은 OK 상태로 응답하지 않을 경우에는 최대 StatusFrequency분 동안 알림이 재시도됩니다. 예를 들어 StatusFrequency가 5이고, 첫 번째 알림 메시지가 전송되지 않은 경우에는 각 재시도 사이에 지수 백오프를 사용하여 최대 5분 동안 재시도됩니다. 재시도 시간이 지난 후에도 알림 메시지가 전송되지 않으면 구독 유효성이 무효화되고 새로운 알림 메시지가 전송되지 않습니다. 메일박스 이벤트에 대한 알림을 계속 수신하려면 새 구독을 생성해야 합니다. 현재는 메일박스 1개당 최대 3개까지 구독이 가능합니다.