The API allows you to impersonate another user during the API call. You can add a header to the request called "CallOptions" and set the value to ImpersonateUser=<userName>
This will perform the API on behalf of the user you entered. You must be an administrator and superuser to be able to impersonate.
Last note: I suggest to set the "Via" field of the discussion post in such situations (i.e. Via="Integration"). The string you put into the via field will appear under the post so users know this was an automatically generated message rather than actually posted by that user.