FreshChat API Availibility

Updating FreshChat Agent Availibilty via API

So, i’ve found this API-description, which explains how to update an agents intellisign-availibility: link
Found it in this ticket by @Zach link
However, I can’t get it to work while testing via Postman.

I’ve installed the app “IntelliAssign Status” and it fails without a specific error-message. Unfortunately it does not log the error, however, I suspect it has to do with the inability to update the status.

I hope someone can shed some light on the issue.

Kind regards,
Jeroen

@Jeroen, the application I built off of this api no longer works at the moment due to the security update that was made to the platform and the request method. This, however, should not prevent you from being able to do so in Postman. What error is postman giving you? Are you sure the authentication you are using is valid?

I tested this in postman just now and it worked as expected. One thing that I have noticed for authentication is that it must be set to “bearer token”, all other api’s seem to require you to set it to “basic auth” and pass the api key as the username.

For this to work you must send a PATCH request to https://api.freshchat.com/v2/agents/[agent_id] and format the body in json as follows

I hope this helps

-Zach

Hi @zach,

thank you for your reply!
I haven’t had the time to test it yet, it will be on Monday.

I did everything as you said it, with the exception of - you guessed it - using the bearer token.
I did try to use my plain API-key as a bearer token, but that did not seem to work.
However, I’ll try again this Monday, and update this ticket.

Cheers, have a good weekend.

1 Like

Hi @zach,

made a few changes in my call.
First was changing the API-endpoint to the EU-specific one, and secondly sending the API-token as a bearer-token.
Somehow the token does not have the rights, so I’ll contact Freshchat about it.

{
    "success": false,
    "error_code": 11,
    "error_message": "Unauthorized"
}

If you have any experience with this, I’d be more than grateful to hear about it :slight_smile:

Kind regards,

Jeroen

Hello @Jeroen,

I have not had to make any changes to the api endpoint, wasn’t even aware there were different ones based on region. Sounds like your api key/token is not valid. You could always try generating a new one in the freshchat application.

The url that I am using to send a “PATCH” request is https://api.freshchat.com/v2/agents/[agent_id]

Authorization set as Bearer token


This is a very long token fyi.

and sending the body as json

Sorry I can’t be more help. I did just rebuild my admin application using SMI to perform these actions and its working now as well, so I am pretty sure the api call is valid. I hope you are able to get some assistance from freshworks regarding this.

Take care,
Zach