Issue while creating direct chat

I am calling 3 apis one after the other while trying to create direct chat.
The apis are as mentioned below.

Request URL: /v4/channels/direct
Request Method: POST
Status Code: 201 Created
Payload: ["omjiw51g93fpxcefmnixq9sibw","ikm54hoaj7ytmj7u9xjtipixcw"]
Response: {"id":"a6ftn18n8igj3ehaw3ky5pzgxh","create_at":1641534856457,"update_at":1641534856457,"delete_at":0,"team_id":"","type":"D","display_name":"","name":"ikm54hoaj7ytmj7u9xjtipixcw__omjiw51g93fpxcefmnixq9sibw","header":"","purpose":"","last_post_at":0,"total_msg_count":0,"extra_update_at":0,"creator_id":"","scheme_id":null,"props":null,"group_constrained":null,"shared":null}

Request URL: /v4/teams/ompypkc5pt87pk6r4y1r31yy9w/channels/name/ikm54hoaj7ytmj7u9xjtipixcw__omjiw51g93fpxcefmnixq9sibw
Request Method: GET
Status Code: 200 OK
Response: {"id":"a6ftn18n8igj3ehaw3ky5pzgxh","create_at":1641534856457,"update_at":1641534856457,"delete_at":0,"team_id":"","type":"D","display_name":"","name":"ikm54hoaj7ytmj7u9xjtipixcw__omjiw51g93fpxcefmnixq9sibw","header":"","purpose":"","last_post_at":0,"total_msg_count":0,"extra_update_at":0,"creator_id":"","scheme_id":null,"props":null,"group_constrained":null,"shared":null}

Request URL: /v4/users/ikm54hoaj7ytmj7u9xjtipixcw/preferences
Request Method: PUT
Status Code: 400 Bad Request
Payload: [{"user_id":"ikm54hoaj7ytmj7u9xjtipixcw","category":"direct_channel_show","name":"omjiw51g93fpxcefmnixq9sibw","value":"true"},{"user_id":"ikm54hoaj7ytmj7u9xjtipixcw","category":"channel_open_time","name":"a6ftn18n8igj3ehaw3ky5pzgxh","value":1641534837689}]
Response: {"id":"api.context.invalid_body_param.app_error","message":"Invalid or missing preferences in request body.","detailed_error":"","request_id":"o5jy8uk5ibgste95dihrx93gxw","status_code":400}

ANyone has idea about this issue?

Hi @rajeshwarpatlolla and welcome to the Mattermost Forums!

Sorry for the late response here, I just stumbled upon your posting. Not sure if you were able to solve this issue by now, but if not, could it be that you’re not using the full channel name in the preferences update call? I guess it should be ikm54hoaj7ytmj7u9xjtipixcw__omjiw51g93fpxcefmnixq9sibw but I did not try it out myself.