PM / 培养 标签添加后

在查看用户行为模式时,我们最近开始关注用户何时会自己回答问题。当用户在帖子中回复自己的原始帖子 (OP) 时,这属于 #bump 还是 #self-solve?我写了一份报告来

查找用户回复自己的帖子。
-- 目标:显示用户回复自己的帖子
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')
),


-- 查找普通用户创建的“常规”帖子
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  -- 排除 SonarSourcers 发起的帖子
        AND tt.topic_id IS NULL -- 排除已标记 me-too, bump 或 self-solve 的帖子
        AND visible = TRUE
        AND archived = FALSE
        AND archetype='regular'
        AND deleted_at IS NULL
        AND created_at::DATE > '2023-07-01'
),

-- 查找用户帖子的第一个非 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 -- 排除 SonarSourcer 第一个回复的帖子
    AND ub.user_id IS NULL -- 排除已授予徽章的帖子
ORDER BY mr.created_at DESC

我们定期查看结果,通过添加 #bump#self-solve 标签来对帖子进行分类(这会从报告中移除该帖子)。

现在,我们希望通过向自我解决问题的用户发送“培养”私信来在此基础上进行扩展,内容大致为:

恭喜你解决了自己的问题,并感谢你分享你的发现。你的社区同事将来一定会觉得很有用。如果你想进一步贡献你的专业知识,可以从这里开始……

现在,回到问题:我们可以根据帖子中的标签找到相关用户。而且我们当然可以手动发送这些消息(到目前为止我们也是这样做的)。

但是,在以下方面是否有任何自动化可以实施:

  • 选择用户(是的,我们可以为此编写另一个报告……)
  • 发送消息
2 个赞