Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Utilizzo delle notifiche
Con l'API Amazon WorkMail Push Notifications, puoi ricevere notifiche push sulle modifiche nella tua casella di posta, inclusi nuovi aggiornamenti di e-mail e calendario. Devi registrare il URLs (o i risponditori di notifiche push) per ricevere le notifiche. Con questa funzionalità, gli sviluppatori possono creare applicazioni reattive per WorkMail gli utenti Amazon, in quanto le applicazioni ricevono rapidamente notifiche sulle modifiche dalla casella di posta dell'utente.
Per ulteriori informazioni consultare l'articolo relativo alle notifiche per sottoscrizioni, eventi di mailbox e EWS in Exchange
Puoi iscriverti a cartelle specifiche, come Posta in arrivo o Calendario, o a tutte le cartelle per gli eventi di modifica della cassetta postale (inclusi New Mail, Created e Modified).
È possibile utilizzare librerie client come EWS Java API o Managed EWS
Di seguito è riportato un esempio di richiesta di sottoscrizione push:
<?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>
Di seguito è riportato un risultato di richiesta di sottoscrizione andata a buon fine:
<?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>
Successivamente le notifiche vengono inviate agli URL specificati nella richiesta di sottoscrizione. Di seguito è riportata una notifica di esempio:
<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>
Per riconoscere che il risponditore delle notifiche push ha ricevuto la notifica, deve rispondere nel modo seguente:
<?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>
Per annullare la ricezione delle notifiche push, i client devono inviare una risposta di annullamento della sottoscrizione nel campo SubscriptionStatus
in maniera analoga a come riportato di seguito:
<?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>
Per verificare lo stato del tuo risponditore di notifiche push, Amazon WorkMail invia un «battito cardiaco» (chiamato anche aStatusEvent
). La frequenza con cui vengono inviati dipende dal parametro StatusFrequency
fornito nella richiesta di sottoscrizione iniziale. Ad esempio, se è StatusFrequency
uguale1
, a StatusEvent
viene inviato ogni minuto. Questo valore può essere compreso tra 1 e 1440 minuti. Questo StatusEvent
ha il seguente aspetto:
<?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>
Se un client che risponde alle notifiche push non risponde con OK
lo stesso stato di prima, la notifica viene ritentata per un massimo di minuti. StatusFrequency
Ad esempio, se StatusFrequency
è uguale a 5 e la prima notifica ha esito negativo, viene effettuato un altro tentativo per un massimo di 5 minuti con un backoff esponenziale tra ogni tentativo. Se la notifica non viene recapitata dopo la scadenza del periodo di riprova, l'abbonamento viene invalidato e non vengono inviate nuove notifiche. È necessario creare una nuova sottoscrizione per continuare a ricevere le notifiche relative agli eventi della mailbox. Al momento è possibile effettuare la sottoscrizione per un massimo di tre sottoscrizioni per mailbox.