Returned user ID from API POST 404s upon /user request

I’m a front-end developer using the Freshchat API to integrate a chat feature into a mobile app I’m creating using Appgyver.

To initialize the conversation, I’m performing the following calls:

GET /channels
POST /users

I use the data returned from these requests to get the needed channel_id and to create a user_id for use in

POST /conversations

Every time I make this POST, I receive a 500 error in response.

The issue is that the user ID that the POST /users request returns seemingly doesn’t exist. I try doing a request later to /users/${user_id} with the returned ID and it 404s. The user also does not appear in the People list in Freshchat’s admin.

I’ve tried making these same series of requests in other settings (e.g., curl, browser console) and they work correctly, showing both the user and the newly created conversation in the admin.

I’ve tried making the same set of requests in Appgyver using hardcoded user_ids and that works.

I’ve also reviewed the request object structure and headers many times and could not find any errors.

So would there be any reason that this series of requests only wouldn’t work in Appgyver? I understand that this could be an issue with Appgyver. But that doesn’t make sense to me because I’m receiving the correct response when posting to /users. It’s like I’m receiving a phantom user of sorts that isn’t actually getting put into the database. In addition, Appgyver is built on React and is using the same underlying browser methods to perform HTTP requests, making this situation even more confusing.

This topic may be related.

Any help would be appreciated.

@aidanjones

Hi ,

Are you sure that the user id is properly send to the request body ? Because as you say thats working in the curl and if you pass static user id it’s working. In that case the user_id which you are passing may be missed or the call is not asynchronous.

Thanks,

1 Like

The user ID returned from the POST /user response and the user_id in the body of the subsequent POST /conversations request are the same, proof that the requests are synchronous. But this is besides the point because no matter when I make the call using the user_id returned from the original POST /user response, the response is a 404.

@Janani Has anybody been able to look into this issue yet?