

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Amazon Chime SDK 消息传递中接收推送通知
<a name="receive-notifications"></a>

除了频道消息推送通知的标头和正文外，Amazon Chime SDK 还在数据负载中包含频道消息 ID 和频道 ARN。您可以使用该信息来加载完整的频道消息。

以下示例介绍了典型的推送通知负载。

```
{
    "pinpoint.openApp=true",
    "pinpoint.notification.title=PushNotificationTitle",
    "pinpoint.notification.body=PushNotificationBody",
    "pinpoint.campaign.campaign_id=_DIRECT",
    "pinpoint.notification.silentPush=0",
    "pinpoint.jsonBody="{
        "chime.message_id":"ChannelMessageId",
        "chime.channel_arn":"ChannelARN"
    }
}
```

## 禁用或筛选推送通知回执
<a name="disable-filter-receipt"></a>

Amazon Chime SDK 提供了多个选项，允许应用程序实例用户控制他们是否希望接收推送通知。

**禁用所有推送通知**  
 应用程序实例用户可以调用 [https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_identity-chime_UpdateAppInstanceUserEndpoint.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_identity-chime_UpdateAppInstanceUserEndpoint.html) 并将 `AllowMessages` 属性设置为 `NONE`，从而完全禁用推送通知。

**禁用频道的推送通知**  
应用程序实例用户可以通过在 “**PushNotification 首选项**” 字段`NONE`中调[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_messaging-chime_PutChannelMembershipPreferences.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_messaging-chime_PutChannelMembershipPreferences.html)用来禁用特定频道的推送通知。

**筛选频道的推送通知**  
应用程序实例用户可以设置过滤规则，让自己在使用 [https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_messaging-chime_PutChannelMembershipPreferences.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_messaging-chime_PutChannelMembershipPreferences.html) API 时只能接收特定的推送通知。有关更多信息，请参阅[在 Amazon Chime SDK 消息传递中使用筛选规则来筛选消息](filter-msgs.md)。