That should work. Are you grabbing the right post id from the json?
I think you could link it up to the posts table and use a topic id, which may be less faff than finding the post id. Something like:
-- [params]
-- topic_id :topic_id
SELECT ei.user_id, ei.status
FROM discourse_post_event_invitees ei
JOIN posts p ON p.id = ei.post_id
WHERE p.topic_id = :topic_id