本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
受管整合通知
受管整合通知可管理客戶的所有通知,促進即時通訊,以便在其裝置上提供更新和洞見。無論是通知客戶裝置事件、裝置生命週期或裝置狀態,受管整合通知在提升整體客戶體驗方面都扮演重要角色。透過提供可行的資訊,客戶可以做出明智的決策並最佳化資源使用率。
設定受管整合通知
若要設定受管整合通知,請遵循下列步驟:
-
建立 Amazon Kinesis 資料串流
若要建立 Kinesis 資料串流,請遵循建立和管理 Kinesis 資料串流中概述的步驟。
目前,僅支援 Amazon Kinesis 資料串流做為受管整合通知的客戶受管目的地選項。
-
建立 Amazon Kinesis 串流存取角色
建立具有許可的 AWS Identity and Access Management 存取角色,以存取您剛建立的 Kinesis 串流
如需詳細資訊,請參閱《 AWS Identity and Access Management使用者指南》中的建立 IAM 角色。
-
授予使用者呼叫
CreateDestination
API 的許可下列政策定義使用者呼叫 CreateDestination API 的需求。如果未設定,對
CreateDestination
API 的呼叫將會失敗。請參閱AWS Identity and Access Management《 使用者指南》中的授予使用者將角色傳遞至 AWS 服務的許可,以取得受管整合的傳遞許可。
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"iam:PassRole", "Resource":"arn:aws:iam::
accountID
:role/kinesis_stream_access_role", "Condition":{ "StringEquals":{ "iam:PassedToService":"iotmanagedintegrations.amazonaws.com" } } }, { "Effect":"Allow", "Action":"iotmanagedintegrations:CreateDestination", "Resource":"*" } ] } -
呼叫
CreateDestination
API在您建立 Amazon Kinesis 資料串流和串流存取角色之後,請呼叫 CreateDestination API 來建立客戶受管目的地,其中將路由受管整合通知。對於
deliveryDestinationArn
參數,請使用來自新 Amazon Kinesis 資料串流arn
的 。{ "DeliveryDestinationArn": "Your Kinesis arn" "DeliveryDestinationType": "KINESIS" "Name": "DestinationName" "ClientToken": "Random string" "RoleArn": "arn:aws:iam::
accountID
:role/kinesis_stream_access_role" } -
呼叫
CreateNotificationConfiguration
API最後,您將建立通知組態,透過將通知路由到由 Amazon Kinesis 資料串流表示的客戶受管目的地,來通知您所選事件類型。呼叫 CreateNotificationConfiguration API 來建立通知組態。在
destinationName
參數中,使用與使用CreateDestination
API 建立客戶受管目的地時最初建立的相同目的地名稱。{ "EventType": "DEVICE_EVENT" "DestinationName" // This name has to be identical to the name in createDestination API "ClientToken": "Random string" }
受管整合監控的事件類型
以下是使用 受管整合通知監控的事件類型:
-
DEVICE_COMMAND
-
SendManagedThing API 命令的狀態。有效值是
succeeded
或failed
。{ "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_EVENT", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "traceId":"1234567890abcdef0", "receivedAt":"2017-12-22T18:43:48Z", "executedAt":"2017-12-22T18:43:48Z", "result":"failed" } }
-
-
DEVICE_COMMAND_REQUEST
-
Web 即時通訊 (WebRTC) 的命令請求。
WebRTC 標準允許兩個對等之間的通訊。這些對等可以傳輸即時視訊、音訊和任意資料。受管整合支援 WebRTC,可在客戶行動應用程式和最終使用者的裝置之間啟用這些類型的串流。如需 WebRTC 標準的詳細資訊,請參閱 WebRTC
。 { "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_COMMAND_REQUEST", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "endpoints":[{ "endpointId":"1", "capabilities":[{ "id":"aws.DoorLock", "name":"Door Lock", "version":"1.0" }] }] } }
-
-
DEVICE_DISCOVERY_STATUS
-
裝置探索狀態。
{ "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_DISCOVERY_STATUS", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "deviceCount": 1, "deviceDiscoveryId": "123", "status": "SUCCEEDED" } }
-
-
DEVICE_EVENT
-
發生裝置事件的通知。
{ "version":"1.0", "messageId":"2ed545027bd347a2b855d28f94559940", "messageType":"DEVICE_EVENT", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"1731630247280", "resources":[ "/quit/1b15b39992f9460ba82c6c04595d1f4f" ], "payload":{ "endpoints":[{ "endpointId":"1", "capabilities":[{ "id":"aws.DoorLock", "name":"Door Lock", "version":"1.0", "properties":[{ "name":"ActuatorEnabled", "value":"true" }] }] }] } }
-
-
DEVICE_LIFE_CYCLE
-
裝置生命週期的狀態。
{ "version": "1.0.0", "messageId": "8d1e311a473f44f89d821531a0907b05", "messageType": "DEVICE_LIFE_CYCLE", "source": "aws.iotmanagedintegrations", "customerAccountId": "123456789012", "timestamp": "2024-11-14T19:55:57.568284645Z", "region": "ca-central-1", "resources": [ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/d5c280b423a042f3933eed09cf408657" ], "payload": { "deviceDetails": { "id": "d5c280b423a042f3933eed09cf408657", "arn": "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/d5c280b423a042f3933eed09cf408657", "createdAt": "2024-11-14T19:55:57.515841147Z", "updatedAt": "2024-11-14T19:55:57.515841559Z" }, "status": "UNCLAIMED" } }
-
-
DEVICE_OTA
-
裝置 OTA 通知。
-
-
DEVICE_STATE
-
更新裝置狀態時的通知。
{ "messageType": "DEVICE_STATE", "source": "aws.iotmanagedintegrations", "customerAccountId": "123456789012", "timestamp": "1731623291671", "resources": [ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/61889008880012345678" ], "payload": { "addedStates": { "endpoints": [{ "endpointId": "nonEndpointId", "capabilities": [{ "id": "aws.OnOff", "name": "On/Off", "version": "1.0", "properties": [{ "name": "OnOff", "value": { "propertyValue": "\"onoff\"", "lastChangedAt": "2024-06-11T01:38:09.000414Z" } } ]} ]} ]} } }
-