# PM / タグ追加後の育成

**URL:** <https://meta.discourse.org/t/pm-nuture-after-tag-added/295122>\
**Category:** Feature\
**Tags:** automation\
**Created:** [2024 年 2 月 12 日午後 8:43 UTC](https://meta.discourse.org/t/pm-nuture-after-tag-added/295122 "2024-02-12T20:43:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)\
**Post date:** [2024 年 2 月 12 日午後 8:43 UTC](https://meta.discourse.org/t/pm-nuture-after-tag-added/295122/1 "2024-02-12T20:43:25Z")

</div>

ユーザー行動のパターンを調査する中で、最近、ユーザーが自分で回答するタイミングに注目し始めました。スレッド内でユーザーが自身のOP（元の投稿）に返信した場合、それは `#bump` なのか、それとも `#self-solve` なのか？ 私は、

> **ユーザーが自分で返信するスレッドを見つける。**
>
> ```plaintext
> -- Goal show threads where users respond to themselves
> -- 目標：ユーザーが自分で返信するスレッドを表示する
> 
> WITH
> 
> SonarSourcers AS (
> SELECT u.id AS user_id
> FROM groups g
> INNER JOIN group_users gu ON g.id=gu.group_id
> INNER JOIN users u ON u.id = gu.user_id
> WHERE g.name='sonarsourcers'
> ),
> 
> Tagged_topics AS (
> SELECT tt.topic_id
> FROM topic_tags tt
> JOIN tags t on t.id=tt.tag_id
> WHERE name in ('me-too', 'bump', 'self-solve')
> ),
> 
> -- find 'regular' topics created by normal users
> -- 通常のユーザーによって作成された「通常の」トピックを見つける
> topic_user AS (
> SELECT id as topic_id, user_id, created_at
> FROM topics
> LEFT JOIN SonarSourcers ss USING(user_id)
> LEFT JOIN tagged_topics tt on topics.id = tt.topic_id
> WHERE ss.user_id IS NULL -- omit topics started by SonarSourcers
> AND tt.topic_id IS NULL -- omit topics tagged me-too, bump or self-solve
> AND visible = TRUE
> AND archived = FALSE
> AND archetype='regular'
> AND deleted_at IS NULL
> AND created_at::DATE > '2023-07-01'
> ),
> 
> -- find first non-OP reply to user topics
> -- ユーザーのトピックに対する最初のOP以外の返信を見つける
> min_response AS (
> SELECT p.topic_id, tu.created_at, MIN(post_number) as post_number
> FROM posts p
> JOIN topic_user tu USING(topic_id)
> WHERE p.post_type = 1
> -- AND p.user_id = tu.user_id
> AND p.post_number > 1
> AND p.hidden = false
> AND p.deleted_at IS NULL
> GROUP BY topic_id, tu.created_at
> )
> 
> SELECT p.topic_id, p.user_id, mr.created_at::DATE as thread_date
> FROM posts p
> JOIN min_response mr ON p.topic_id = mr.topic_id AND p.post_number=mr.post_number
> LEFT JOIN SonarSourcers ss ON p.user_id=ss.user_id
> LEFT JOIN user_badges ub on p.id = ub.post_id and ub.badge_id=110
> WHERE ss.user_id IS NULL -- eliminate topics where SonarSourcer is first to respond
> AND ub.user_id IS NULL -- eliminate topics where a badge has already been granted
> ORDER BY mr.created_at DESC
> 
> ```

というレポートを作成しました。

結果を定期的に確認し、`#bump` または `#self-solve` タグを追加してスレッドを分類しています（これにより、スレッドはレポートから除外されます）。

そして今、自己解決したユーザーに「育成」PMを送信することにしたいと考えています。例えば、次のような内容です。

> 問題を解決し、調査結果を共有していただきありがとうございます。コミュニティの同僚は将来的にきっと役立つでしょう。さらに専門知識を提供したい場合は、こちらから始めることができます…

**さて、質問です** ：関連ユーザーを（スレッドのタグに基づいて）見つけることはできます。そして、これらのメッセージを手動で送信することもできます（そして、これまではそうしてきました）。

しかし、以下のことに関して、何か自動化できることはありますか？

- ユーザーの選択（はい、それ用の別のレポートを作成できます…）
- メッセージの送信

---

_[View the full topic](https://meta.discourse.org/t/pm-nuture-after-tag-added/295122)._
