푸시 알림 트리거
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
파트너 트리거 알림
메시지 및 알림 추가
배경
사용자가 패스를 추가한 후 패스와 관련된 메시지를 보내 패스에 대한 알림을 제공할 수 있습니다. message_type
이 TEXT_AND_NOTIFY
인 Add Message API 요청을 사용하면 다음이 발생합니다.
- '메시지' 항목이 '패스 뒷면' (세부정보 템플릿)에 추가되고 패스가 저장된 사용자에게 푸시 알림이 전송됩니다.
- 사용자가 알림을 탭하면 Google 월렛이 패스 앞면 (카드 뷰라고도 함)으로 열리고 화면 상단에 '메시지 보기' 버튼이 있는 콜아웃이 표시됩니다.
- 콜아웃을 클릭하면 사용자가 패스 뒷면으로 이동하여 새 읽지 않은 메시지가 강조 표시됩니다.
사용자에게 알림이 포함된 메시지를 보낼 때의 고려사항
- 사용자가 메시지와 관련된 푸시 알림을 수신하려면 패스에 알림이 사용 설정되어 있어야 합니다.
- 메일에 웹사이트 또는 앱의 URI가 포함될 수 있습니다. 하이퍼링크는 패스와 관련된 웹사이트 또는 앱이어야 합니다. 사용자를 패스와 관련 없는 링크로 연결하는 것은 용어 사용 정책을 위반하는 행위입니다.
- 24시간 동안 푸시 알림을 트리거하는 메시지를 최대 3개 보낼 수 있습니다. Google에서 사용자가 스팸을 받는다고 판단하면 푸시 알림 전송 할당량을 제한할 수 있습니다.
- 사용자가 잠금 화면에 보는 푸시 알림은 Google 월렛에서 제어합니다.
- UPDATE 또는 PATCH 메서드를 사용하여 일반 클래스 또는 객체 엔드포인트를 사용하여 메시지 데이터를 수정하거나 삭제할 수 있습니다.
통합 단계
AddMessage API를 사용하여 추가된 새 발급자 메시지에 관해 사용자에게 알리려면 새 텍스트가 포함된 Message에 MessageType
TEXT_AND_NOTIFY가 아닌 TEXT가 포함되도록 AddMessageRequest를 업데이트해야 합니다.
패스 클래스에 메시지 추가 및 알림을 위한 JSON 요청 예시
…
"id": ISSUER_ID.CLASS_ID",
"message":
{
"header":"My Class message header",
"body": "My Class message body with a <a href="https://wallet.google">Hyperlink<\a>",
"id": "message_id",
"message_type": "TEXT_AND_NOTIFY"
},
…
패스 객체에 메시지 추가 및 알림을 전송하는 JSON 요청 예시
…
"id": OBJECT_ID",
"classId": "ISSUER_ID.CLASS_ID",
"message":
{
"header":"My Object message header",
"body": "My Object message body with a <a href="http://play.google.com/store/apps/details?id=com.google.android.apps.maps">Hyperlink<\a>",
"id": "message_id",
"message_type": "TEXT_AND_NOTIFY"
},
…
패스 클래스에 관한 메시지를 추가하고 알리는 응답의 예
// The updated resource
…
{
"kind": "walletobjects#walletObjectMessage",
"header": "My Object message header",
"body": "My Object message body with a <a href="http://play.google.com/store/apps/details?id=com.google.android.apps.maps">Hyperlink<\a>",
"id": "message_id",
"messageType": "textAndNotify"
},
…
예외 처리
3번 이상 알림을 보내려고 하면 QuotaExceededException 응답이 반환됩니다. 패스를 추가로 업데이트하려면 통합 단계에서 설명한 대로 'TEXT_AND_NOTIFY' 대신 'TEXT'를 사용하여 설정할 수 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[[["\u003cp\u003e\u003cstrong\u003e\u003ccode\u003eTEXT_AND_NOTIFY\u003c/code\u003e\u003c/strong\u003e message type adds a message to the pass's details and triggers a push notification, directing users to the message in Google Wallet.\u003c/p\u003e\n"],["\u003cp\u003eUsers must have notifications enabled for their passes to receive these push notifications.\u003c/p\u003e\n"],["\u003cp\u003eA maximum of 3 notification-triggering messages can be sent within a 24-hour period to avoid spamming users.\u003c/p\u003e\n"],["\u003cp\u003eYou can update or remove message data using standard update/patch methods and change the \u003ccode\u003emessage_type\u003c/code\u003e to \u003ccode\u003eTEXT\u003c/code\u003e for further updates without notifications.\u003c/p\u003e\n"],["\u003cp\u003eExceeding the notification limit results in a \u003ccode\u003eQuotaExceededException\u003c/code\u003e, after which \u003ccode\u003eTEXT\u003c/code\u003e should be used instead of \u003ccode\u003eTEXT_AND_NOTIFY\u003c/code\u003e for subsequent messages.\u003c/p\u003e\n"]]],["The `Add Message API` with `message_type` as `TEXT_AND_NOTIFY` sends a push notification to users when a new message is added to their pass. Tapping the notification opens the pass in Google Wallet, displaying a \"View Message\" callout. Clicking this directs users to the pass's \"back\" where new messages are highlighted. A maximum of three push notifications are allowed within 24 hours, with excessive usage resulting in a `QuotaExceededException`. Messages can include hyperlinks relevant to the pass.\n"],null,["# Trigger Push Notifications\n\nPartner Triggered Notifications\n-------------------------------\n\n### Add Message and Notify\n\n#### Background\n\nAfter a user adds a pass you may want to send them a message related to the\npass and ensure they are notified about it. Using the [Add Message API](/wallet/tickets/transit-passes/qr-code/rest/v1/transitclass/addmessage)\nrequest with a `message_type` equal to\n**`TEXT_AND_NOTIFY`** the following occurs:\n\n1. A \"[Message](https://developers.google.com/wallet/reference/rest/v1/Message)\" item is added to the \"back of pass\" (aka [Details\n Template](/wallet/tickets/transit-passes/qr-code/resources/template#details-template)) and a push notification is sent to users with the pass saved.\n2. Once the user taps the notification it opens Google Wallet to the front of the pass (a.k.a. Card view) and the user will see a callout at the top of the screen with a \"View Message\" button.\n3. Clicking the callout will take users to the back of the pass, where new unread messages are highlighted.\n\n#### Some considerations when sending messages with notifications to users\n\n- Users must have notifications enabled for their passes to receive the push notifications related to messages.\n- Messages may contain URIs to your website or app. Hyperlinks must be a website or app related to the pass. It is a violation of the [Acceptable Use Policy](https://payments.developers.google.com/terms/aup) to send users to links not related to the pass.\n- You may send a maximum of 3 messages that trigger a push notification in a 24 hour period. Google may throttle your push notification delivery quota if it deems you are spamming your users.\n- The push notification users see on their lock screen is controlled by Google Wallet.\n- You can use the [UPDATE](/wallet/tickets/transit-passes/qr-code/rest/v1/transitclass/update) or [PATCH](/wallet/tickets/transit-passes/qr-code/rest/v1/transitclass/patch) methods to edit or remove message data using the regular class or object endpoint.\n\n#### Integration Steps\n\nWhen you want to notify users about a new issuer message added using the\nAddMessage API, you will need to update the [AddMessageRequest](https://developers.google.com/wallet/reference/rest/v1/AddMessageRequest)\nso that the [Message](https://developers.google.com/wallet/reference/rest/v1/Message)\nwhich contains your new text has the [MessageType](https://developers.google.com/wallet/reference/rest/v1/Message#MessageType)\n**TEXT_AND_NOTIFY** instead of **TEXT**.\n\n#### Example JSON Request to add message and notify in a Passes Class\n\n```carbon\n ...\n \"id\": ISSUER_ID.CLASS_ID\",\n \"message\":\n {\n \"header\":\"My Class message header\",\n \"body\": \"My Class message body with a \u003ca href=\"https://wallet.google\"\u003eHyperlink\u003c\\a\u003e\",\n \"id\": \"message_id\",\n \"message_type\": \"TEXT_AND_NOTIFY\"\n },\n ...\n```\n\n#### Example JSON Request to add message and notify in a Passes Object\n\n```carbon\n ...\n \"id\": OBJECT_ID\",\n \"classId\": \"ISSUER_ID.CLASS_ID\",\n \"message\":\n {\n \"header\":\"My Object message header\",\n \"body\": \"My Object message body with a \u003ca href=\"http://play.google.com/store/apps/details?id=com.google.android.apps.maps\"\u003eHyperlink\u003c\\a\u003e\",\n \"id\": \"message_id\",\n \"message_type\": \"TEXT_AND_NOTIFY\"\n },\n ...\n```\n\n#### Example [Response](/wallet/tickets/transit-passes/qr-code/rest/v1/transitclass/addmessage#response-body) to add message and notify for a Pass Class\n\n```scilab\n // The updated resource\n …\n {\n \"kind\": \"walletobjects#walletObjectMessage\",\n \"header\": \"My Object message header\",\n \"body\": \"My Object message body with a \u003ca href=\"http://play.google.com/store/apps/details?id=com.google.android.apps.maps\"\u003eHyperlink\u003c\\a\u003e\",\n \"id\": \"message_id\",\n \"messageType\": \"textAndNotify\"\n },\n …\n```\n\n#### Exception handling\n\nAny attempts to notify more than 3 times will yield a\n**QuotaExceededException** response. Any further updates to the\npass can be set using \"**TEXT** \" instead of\n\"**TEXT_AND_NOTIFY** \" as discussed in the [Integration\nSteps](#add-message-and-notify-integration-steps)."]]