7. 로직 설정하기

로직 설정에서는 본인이 작성한 글에 다른 유저가 게시글에 좋아요를 누르면 푸시 알림을 발송하는 로직을 만들 거예요.

1. 데이터 기록 확인하기

먼저 좋아요를 눌렀을 때 데이터가 어떻게 등록되는지 확인하기 위해 앱 중고거래 메뉴의 게시글에 좋아요 버튼을 눌러주세요.

관리자 웹 > 운영 모드 > 설정 > 고급 설정 > 데이터 로그를 클릭해 주세요.

데이터 로그는 하나의 문서에서 데이터가 생성, 수정, 삭제될 때 기록이 남는 곳이에요.

좋아요도 데이터 중 하나이기 때문에 데이터 로그에서 확인할 수 있어요.

방금 앱에서 누른 좋아요의 metaCode는 sale, component는 _like, type은 like로 등록되어 있어요.

2. 로직 생성하기

관리자 웹 > 로직 설정에서 좋아요 푸시 알림을 만들어 볼게요.

새로운 로직 생성하기 버튼을 눌러주세요.

첫 번째 빈칸은 데이터가 처리되는 곳을 입력하는 곳으로 데이터 로그를 선택해 주세요.

두 번째 빈칸은 데이터가 처리되는 유형을 입력하는 곳으로 등록을 선택해 주세요.

세 번째 빈칸은 데이터가 처리된 후 진행될 활동을 입력하는 곳으로 푸시 알림을 발송을 선택해 주세요.

이렇게 하면 지금 만드는 로직은 '데이터 로그를 등록하면 푸시 알림을 발송한다.' 되는 거예요.

3. 이벤트 옵션 설정하기

데이터 로그에 등록된 데이터가 좋아요인 경우에만 푸시 알림을 발송해야 하기 때문에 상세 조건을 설정할 거예요.

이벤트 옵션 > 상세 조건 > 조건 1에 위 사진과 같이 입력해 주세요.

그럼 '신규데이터의 component가 _like와 같을 때'라는 조건이 생긴 거예요.

'신규데이터의 type이 like와 같을 때'라는 조건도 추가해 볼게요.

조건 추가 버튼을 누르고 위 사진과 같이 입력해 주세요.

3. 플로우 옵션 설정하기

이제 좋아요 데이터가 등록됐을 때 발송될 푸시 알림을 설정할 거예요.

플로우 옵션 > 옵션으로 이동해서 푸시 알림 제목에 나타날 '중고거래 좋아요 푸시 알림'을 메세지 제목에 입력해 주세요.

푸시 알림 내용에 나타날 '#{nickname}님이 커뮤니티 글에 좋아요를 눌렀어요'를 메세지 내용에 입력해 주세요.

좋아요를 누른 사람을 변수로 설정할 거예요.

메세지 내용에 사용할 변수 설정 > 항목 1에 항목 ID는 #{nickname}, 항목 값은 newDocument._createUser.nickname를 입력해 주세요.

그럼 #{nickname}이 신규 데이터의 작성자의 닉네임이라는 변수가 설정된 거예요.

전송 대상에서 푸시 알림이 전송될 대상을 설정할 수 있어요.

푸시 알림은 좋아요가 등록된 글의 작성자에게 발송돼야 하기 때문에 부모데이터의 작성자 ID 코드인 parentDocument._createUser._id를 입력해 주세요.

메세지 타입에서 푸시 알림을 클릭했을 때 이동할 탭이나 화면을 설정할 수 있어요.

좋아요가 등록된 글로 이동하도록 상세화면을 선택해 주세요.

생성 버튼을 누르고 내가 작성한 글에 좋아요를 누르면 알림이 발송되는 걸 확인할 수 있어요.

4. 이벤트 옵션 추가 설정하기

내가 작성한 글에 내가 좋아요를 눌렀을 경우에는 푸시 알림이 발송되지 않도록 조건을 추가해 볼게요.

이벤트 옵션 > 상세 조건에 조건 추가 버튼을 누르고 위 사진과 같이 입력해 주세요.

조건 항목 ID : newDocument._createUser._id, 조건 값 : parentDocument._createUser._id

그럼 '신규 데이터의 작성자의 ID가 부모데이터의 작성자의 ID와 같지 않을때 '라는 조건이 생긴 거예요.

저장 버튼을 누르면 이제 내가 작성한 글에 내가 좋아요를 누르면 푸시 알림이 오지 않아요.

5. 로직 명과 로직 설명 추가하기

관리자 웹 > 로직 설정 > 좌측 메뉴바에서 로직을 선택하고 초록색 톱니바퀴를 누르면 로직 정보를 수정할 수 있어요.

로직 정보 수정에서 로직 명과 로직 설명을 추가할 수 있어요.

로직 정보 수정에서 입력한 로직 명은 관리자 웹 > 로직 설정 > 좌측 메뉴바에 표시돼요.

6. 로직 삭제하기

로직을 삭제하고 싶으면 로직 정보 수정 화면에서 삭제 버튼을 누르면 돼요.

#로직 설정하기, #좋아요 푸시 알림, #데이터 로그, #metaCode, #component, #type, #변수 설정, #신규데이터, #부모데이터, #newDocument, #parentDocument, #이벤트 옵션, #플로우 옵션, #로직 명, #로직 설명, #로직 삭제하는 방법, #로직 삭제하기

2023 08 22 ruru

7. Setting up Business Logic

In Logic Settings, we will create logic that enables the use of push notifications when another user likes a post written by you.

First of all, tap the like button on the post in the app's marketplace menu to see how data is registered when you click like.

Go to Web Admin > Admin Mode > Settings > Advanced Settings > Data Log. In data log, you find a record of all the data that is created, modified, or deleted.

Giving someone a like on their post is also a piece of data, which means that you can view this action in the data log.

The datasetCode of the like you just registered through the app is registered as sale, component is _like, type is like.

We will create a push notification when someone pushes like in Web Admin > Developer Mode > Logic Settings.

The first blank space is where you select where data will be processed. Select the data log.

The second blank space is where you select the type of data being processed. Select register.

The third blank space is used to select which action will be performed after the data is processed. Select "send a push notification when registered in the data log".

Push notifications should only be sent when the data registered in the data log is related to the received like. To ensure this, we will set conditions.

Go to Event Options > Condition Details > Condition 1. Enter the blank spaces as shown in the picture. By entering these values, the condition that 'when the component of the new data is equal to _like" has been created.

We will also add the condition "when the type of new data is the same as like". Click Add Condition and enter as shown in the picture.

Now, we will set up a push notification to be sent when the data pertaining to a like is registered.

Go to Flow Settings > Settings and enter "when the type of data is the same as like". Click the Add Condition button and enter as shown in the picture above.

Following this, we will set up that a push notification will be sent the moment the like data is registered.

Go to Flow Settings > Settings and enter "marketplace like push notification" in the message subject for it to appear in the push notification message.

Enter "#{nickname} liked your community post", which will appear in the push notification's message text.

We will set the person who liked the post as the variable.

Go to Variables Used in Message Content > Item 1. Enter #{nickname} for the Item ID and newDocument._createUser.nickname for the Item Value. This ensures that a variable is configured that processes that #{nickname} should be set as the username that creates new data.

You can now set the push notification can be set to the target destination. The push notification should be sent to the author of the article for which likes have been registered. Therefore, enter newDocument._createUser._id, which is the author ID code of the parent data.

The tab or page you move to when clicking the push notification can be set in the message type.

Please select the detailed page to set the destination to the post with the registered like.

Press the save button and like your written post to check the push notification.

Now, we will add a condition that assures push notifications are not sent when I like my post.

Click the Add Condition button in Event Options > Condition Details and copy as shown above.

Condition Item ID: newDocument._createUser._id, condition value: parentDocument._createUser._id.

Now, the condition "when the ID of the creator of the new data is not the same as the ID of the creator of the parent data" has been created.

After press the save button, a push notification will not get sent to the author of the post if they lke their own post.

2023.08.18 Hwaran

Last updated