Estrai la lista RSVP dell'evento Pull tramite Data Explorer

Stiamo cercando di aumentare la partecipazione ai nostri eventi trovando utenti che hanno interagito con contenuti simili esistenti. Con l’aiuto del bot AI, siamo riusciti a elaborare la seguente query.

-- [params]
-- text :keyword
-- int :min_engagements
-- null string :tag_name

WITH keyword_posts AS (
    SELECT
        p.id AS post_id
    FROM
        posts p
    JOIN
        topics t ON t.id = p.topic_id
    LEFT JOIN
        topic_tags tt ON tt.topic_id = t.id
    LEFT JOIN
        tags tg ON tg.id = tt.tag_id
    WHERE
        p.raw ILIKE '%' || :keyword || '%'
        AND (:tag_name is null OR tg.name = :tag_name)
),
user_engagement AS (
    SELECT
        ua.user_id,
        COUNT(DISTINCT ua.target_post_id) AS engaged_posts_count
    FROM
        user_actions ua
    JOIN
        keyword_posts kp ON kp.post_id = ua.target_post_id
    WHERE
        ua.action_type IN (1, 4, 5, 6)
    AND ua.user_id NOT IN (
        SELECT gu.user_id
        FROM group_users gu
        JOIN groups g ON g.id = gu.group_id
        WHERE g.name = 'developer_relations'
    )
    GROUP BY
        ua.user_id
)
SELECT
    ue.user_id,
    ue.engaged_posts_count
FROM
    user_engagement ue
WHERE
    ue.engaged_posts_count >= :min_engagements
ORDER BY
    ue.engaged_posts_count DESC

Stiamo dando agli utenti il tempo di scoprire e RSVP ai nostri eventi organicamente, ma man mano che ci avviciniamo all’evento vogliamo inviare inviti più mirati. Per fare ciò, dobbiamo incrociare la lista RSVP esistente ed escluderla dalla lista utenti target. Esiste un modo per accedere a questa lista RSVP tramite data-explorer?
L’unico modo che ho trovato per accedervi manualmente è utilizzare l’opzione Esporta su un oggetto Evento:

Il problema è che questo genera un file zippato che mi viene inviato in PM, che presumo non sia visibile a Data Explorer.

Penso che vorrai usare le tabelle discourse_post_event_events e discourse_post_event_invitees per questo.

Sono riuscito a lavorare sui seguenti con il bot, ma restituisce 0 risultati (anche se posso vedere che più di 30 persone hanno risposto. La query funziona se rimuovo l’istruzione WHERE.

-- [params]
-- text :event_url = 'https://developer.sailpoint.com/discuss/t/deploying-the-beyondtrust-password-safe-connector-for-identityiq-with-michel-bluteau/68228'

SELECT
    users.username AS "Username",
    invitees.status AS "RSVP Status",
    invitees.updated_at AS "Last Updated"
FROM
    discourse_post_event_events AS events
JOIN
    discourse_post_event_invitees AS invitees
ON
    events.id = invitees.post_id
JOIN
    users
ON
    invitees.user_id = users.id
WHERE
    events.url = :event_url

Che ne dici di qualcosa del genere:

-- [params]
-- text :keyword
-- int :min_engagements
-- null string :tag_name
-- post_id :event_post

WITH keyword_posts AS (

    SELECT
        p.id AS post_id
    FROM posts p
      JOIN topics t ON t.id = p.topic_id
      LEFT JOIN topic_tags tt ON tt.topic_id = t.id
      LEFT JOIN tags tg ON tg.id = tt.tag_id
    WHERE p.raw ILIKE '%' || :keyword || '%'
      AND (:tag_name is null OR tg.name = :tag_name)
),

user_engagement AS (

    SELECT
        ua.user_id,
        COUNT(DISTINCT ua.target_post_id) AS engaged_posts_count
    FROM user_actions ua
    JOIN keyword_posts kp ON kp.post_id = ua.target_post_id
    WHERE ua.action_type IN (1, 4, 5, 6)
    AND ua.user_id NOT IN (SELECT user_id FROM group_users WHERE group_id = 41)
    GROUP BY ua.user_id
)

SELECT
    ue.user_id,
    ue.engaged_posts_count
FROM user_engagement ue
WHERE ue.engaged_posts_count >= :min_engagements
  AND ue.user_id NOT IN (SELECT user_id FROM discourse_post_event_invitees WHERE post_id = :event_post AND status = 0)
ORDER BY ue.engaged_posts_count DESC

Per il parametro event_url accetta l’URL dell’argomento ma con il numero del post alla fine, quindi https://developer.sailpoint.com/discuss/t/deploying-the-beyondtrust-password-safe-connector-for-identityiq-with-michel-bluteau/68228/1 (invece della versione dell’argomento che non ha /1 alla fine)

1 Mi Piace