I am also trying to post a reply to a thread from my app as an user but it gets posted as Admin.
The solution mentioned in the post does not work. Any idea where I might be doing wrong?
$userid is the customer id in freshdesk server. This is the user in our app.
api key is the only API key I get from my Profile in freshdesk account.
If that is admin API key, then as you mentioned I am not aware of any other API key. Can you please suggest where do I get that to post a reply as an user.
Hello @deepanjandas
First, let us welcome you to the Freshworks community
Thank you for reaching out with your question and additional details about what you are trying to achieve.
Every API Key is associated with a particular user in Freshdesk. Further, every user is associated with one or more Roles in Freshdesk, which define what the user can or cannot do within Freshdesk.
We aren’t familiar with how your application gets this $api_key parameter, but the API Key provided to this app must likely be one associated with an administrator, as @Saif hinted. Any changes made to Freshdesk using an API are always associated with the user whose API key was provided as authentication for the API request. In your case, you are seeing the ticket reply being created in the name of an administrator, likely because the $api_key provided to the app belongs to that administrator.
If you only plan to work with the Reply to Ticket API, you might be in luck, as noted in this solution from another thread.
If you plan to make other API calls as well, you likely have 3 options from here -
Modify your app so that it asks for an API key from each user using the app, so that the API requests made by the app are always using the actual end-users API key.
Create a new user just for this app, with a specific role and specific permissions required by this app, and use this user’s API key for the app. All replies will then show up in this user’s name so you know that the app created them.
Continue using the admin’s API key for this app, and consider including additional text in the message if you would like to call out this was created by the app on behalf of the end-user.