How to update user_id of post using api?

I’m using ruby api to integrate discourse in my website. I’m successfully posting comments for a topic using api, but posted_by is showing as admin user. How can i replace it by logged in user.


Can you share the code you’re using to post the replies?

$client ="")
$client.api_key = "api_key"
$client.api_username = "admin_username"

post_comment = $client.create_post(
      :topic_id => params[:discourse_topic_id],
      :raw => params[:post_content]

I would assume it’s using the system user since you’re not passing a user id to the create_post method. Try adding something along these lines: :user_id => params[:user_id]