Shyft Customer > Chats > ChatSessions API
The Customer > Chats > ChatSessions API from Shyft — 5 operation(s) for customer > chats > chatsessions.
The Customer > Chats > ChatSessions API from Shyft — 5 operation(s) for customer > chats > chatsessions.
openapi: 3.0.0
info:
title: Shyft Customer Authentication > Email Customer > Chats > ChatSessions API
description: "Welcome to the Shyft Customer App API.\n\nShyft customer App API is designed to support the function of Shyft Mobile App(iOS, Android), Web App and Manager Dashboard.\n\nNOTES:\n\n- In parameters section, the letter `R` stands for `Required`.\n \n- All API examples show only essential data set.\n \n\n## Authentication\n\n---\n\nInclude as headers for API calls after authentication token.\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| Session-Uukey | | \\* | The value got from authentication API call (SignIn/Confirm) |\n\n## Global Information\n\n---\n\n#### Query Parameters\n\n###### For All API:\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| api_version | String | | Ex. 6_0_0 |\n| response\\[nested\\] | Integer | | Ex. 1 |\n| response\\[keep\\] | String | | Ex. location\\[current_user_privilege\\],name,id |\n| response\\[only\\] | String | | Ex. id,location\\[id,location_name,current_user_privilege\\] |\n| response\\[except\\] | String | | Ex. name,location\\[id,location_name,swift_code\\],owner\\[id\\] |\n\n- The query parameter `response[only]` is needed to help API performance by limiting the size of returned data.\n \n- On test server, `response[only]` support wildcard, you can supply `response[only]=\\*` to get everything.\n \n- Production server does not support wildcard, you need to figure out and supply your `response[only]` for each API call.\n \n\n###### For Index API:\n\n- Pagination Option 1)\n \n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| page | Integer | | Ex. 1 |\n| per_page | Integer | | Ex. 5 |\n| total | boolean | | true/false |\n| order | String | | Ex. start_at_desc, start_at_asc |\n\n- Pagination Option 2)\n \n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| limit | Integer | | Ex. 10 |\n| offset | Integer | | Ex. 5 |\n| order | String | | Ex. start_at_desc, start_at_asc |\n| last_id | Integer | | Ex. 101 |\n\n###### For Update API:\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| response\\[put_return_resource\\] | String | | Ex. true |\n\n#### Headers\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| Platform | ios|android|web | \\* | |\n| Api-Version | 6_0_0 | \\* | Ex: 6_0_0 |\n| Build-Number | | \\* | |\n| Push-Id | | | |\n| X-Method | | | Deprecated |\n| Content-Type | application/json | \\* | |\n\n#### Success Codes\n\n| SUCCESS Code | Meaning |\n| --- | --- |\n| 200 | Created -- Objet created. |\n| 201 | Unauthorized -- Your API key is wrong. |\n| 204 | No Content -- Success without returning resource. |\n\n#### Error Codes\n\n| Error Code | Meaning |\n| --- | --- |\n| 400 | Bad Request -- Your request is invalid. |\n| 401 | Unauthorized -- Your API key is wrong. |\n| 403 | Forbidden -- The records requested is hidden for administrators only. |\n| 404 | Not Found -- The specified record could not be found. |\n| 405 | Method Not Allowed -- You tried to access a record with an invalid method. |\n| 406 | Not Acceptable -- You requested a format that isn't json. |\n| 410 | Gone -- The record requested has been removed from our servers. |\n| 422 | Unprocessable Entity -- Invalid input data. |\n| 429 | Too Many Requests -- You're requesting too many requests! Slow down! |\n| 500 | Internal Server Error -- We had a problem with our server. Try again later. |\n| 502 | Bad Gateway -- |\n| 504 | Gateway Timeout -- |\n| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |\n\n#### Error Response Formats\n\n422\n\n``` json\n{\n \"errors\": {\n \"base\": [\n \"a private session for same two users already exists: 3034\"\n ]\n }\n}\n\n ```\n\n422\n\n```\n{\n \"errors\": {\n \"google_map_id\": [\n \"can't be blank\"\n ],\n \"time_zone\": [\n \"can't be blank\"\n ],\n \"longitude\": [\n \"can't be blank\"\n ]\n }\n}\n{\n \"errors\": {\n \"record_invalid\": [\n \"Validation failed: User has already been taken\"\n ]\n }\n}\n\n ```\n\n404\n\n``` json\n{\n \"errors\": {\n \"not_found\": [\n \"Couldn't find Post\"\n ]\n }\n}\n\n ```\n\n500\n\n``` json\n{\n \"errors\": {\n \"internal_server_error\": [\n \"Invalid nil value\"\n ]\n }\n}\n\n ```"
version: 1.0.0
servers:
- url: http://{{host}}
- url: http://{{local-host}}
- url: http://{{sp3-host}}
- url: http://test-service.myshyft.com
- url: http://localhost:4001
- url: http://localhost:3000
- url: http://{{local-host}}api
- url: https://test-unfurl.myshyft.com
tags:
- name: Customer > Chats > ChatSessions
paths:
/api/customer/user_role/chat_sessions:
post:
tags:
- Customer > Chats > ChatSessions
summary: create a chat session
description: "Description\n- - - \n- Ceate a chat session between two users\n- Return error with existing session ID if same group users session exists\n\n\n\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---\ntitle | | | Chat session title|\nuser_ids | | | array of both user ids. Ex. [9594, 9568] |"
requestBody:
content:
'*/*':
schema:
type: string
example: '"{\n \"chat_session\": { \n \"user_ids\": [9540, 9568]\n }\n}"'
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
responses:
'201':
description: Created
headers:
X-Frame-Options:
schema:
type: string
example: SAMEORIGIN
X-XSS-Protection:
schema:
type: string
example: 1; mode=block
X-Content-Type-Options:
schema:
type: string
example: nosniff
X-LS-License:
schema:
type: string
example: All Rights Reserved © Coffee Enterprise
X-LS-Application:
schema:
type: string
example: Coffee Mobile
X-Request-Method:
schema:
type: string
example: '{{x_method}}'
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
ETag:
schema:
type: string
example: W/"3c4804471860ed29e06f2d9766cff29b"
Cache-Control:
schema:
type: string
example: max-age=0, private, must-revalidate
Set-Cookie:
schema:
type: string
example: _shyft_api_server_session=TGJaQnRJdlhueHFRN012ek0wNFJCZlhvMDQrUHV6UjdTUEtZOXVhRUhBWHVVeXpmRzdvNFAvY21va2o0YnBXWXovUnB4aFc5bXdEN0c5WnZha05Cb3c9PS0tZUhGY3pscXp4SHp6VHJLQm1DclRoUT09--8741d3aa3e25386f70afc2804e97c18d14fdf7ef; path=/; HttpOnly
X-Rack-Dev-Mark-Env:
schema:
type: string
example: Bin%27s+Local+Server
X-Request-Id:
schema:
type: string
example: 41798aad-7fee-4e8f-9a04-f27259798e10
X-Runtime:
schema:
type: number
example: '0.903121'
Vary:
schema:
type: string
example: Origin
Connection:
schema:
type: string
example: close
Server:
schema:
type: string
example: thin 1.5.1 codename Straight Razor
content:
application/json:
schema:
type: object
example:
chat_session:
_parent_object_id: null
id: 3034
org_id: 1
message_count: 0
participant_count: 0
title: null
latest_message: null
multiuser_chat: false
updated_at: '2018-11-03T04:00:30.259Z'
srn: null
participants:
- _parent_object_id: 3034
id: 9660
session_id: 3034
unread_count: 0
owner:
_parent_object_id: 9660
id: 9540
active_org: 0
first_name: Bin
last_name: Li
email: bin@myshyft.com
gender: 0
user_group: 0
profile_image: null
recent_user_privilege: null
- _parent_object_id: 3034
id: 9661
session_id: 3034
unread_count: 0
owner:
_parent_object_id: 9661
id: 9568
active_org: 0
first_name: Bin
last_name: Li
email: bin6080@myshyft.com
phone_number: '18083836511'
gender: 0
chat_handle: 38d65ba6e1369bb0ac883c70c983a3c3
user_group: 0
status: ''
profile_image: null
recent_user_privilege:
_associations_removed: true
_parent_object_id: 9568
id: 11342
email: bin6080@myshyft.com
wage: 15
position: null
is_approved: true
owner_id: 9568
location_id: 2634
org_id: 1
is_admin: false
read_only: false
first_name: Bin
last_name: Li
phone_number: '18083836511'
profile_image_thumb_url: https://s3.amazonaws.com/shyftassets/avatar1.png
admin_claim_pending: false
'422':
description: Unprocessable Entity (WebDAV) (RFC 4918)
headers:
X-Frame-Options:
schema:
type: string
example: SAMEORIGIN
X-XSS-Protection:
schema:
type: string
example: 1; mode=block
X-Content-Type-Options:
schema:
type: string
example: nosniff
X-LS-License:
schema:
type: string
example: All Rights Reserved © Coffee Enterprise
X-LS-Application:
schema:
type: string
example: Coffee Mobile
X-Request-Method:
schema:
type: string
example: '{{x_method}}'
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
Cache-Control:
schema:
type: string
example: no-cache
Set-Cookie:
schema:
type: string
example: _shyft_api_server_session=MURENHNLYS9nUVIzOXkwa2tIMHJkM2ZtdkNsbVcwaldwRXJPbVViaUJDWEFHNjdVSWM4SVBBZmprZ0pkSSt4T2dFaDRBakV4bXFuUWxBdWUxUXdZT1E9PS0tRjJZTnNRb3RTMkpaWTNpM0wrcjFQUT09--a81301b11cf21ba491e4e5c6d00c49c7c1634cfe; path=/; HttpOnly
X-Rack-Dev-Mark-Env:
schema:
type: string
example: Bin%27s+Local+Server
X-Request-Id:
schema:
type: string
example: 88d567e3-f4f1-4ce3-a18e-69351e4cfe86
X-Runtime:
schema:
type: number
example: '0.376401'
Vary:
schema:
type: string
example: Origin
Connection:
schema:
type: string
example: close
Server:
schema:
type: string
example: thin 1.5.1 codename Straight Razor
content:
application/json:
schema:
type: object
example:
errors:
base:
- 'a private session for same two users already exists: 3033'
get:
tags:
- Customer > Chats > ChatSessions
summary: get chat sessions
description: "Description\n- - - \n- Get all associated chat sessions\n\n\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---"
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
responses:
'200':
description: OK
headers:
X-Frame-Options:
schema:
type: string
example: SAMEORIGIN
X-XSS-Protection:
schema:
type: string
example: 1; mode=block
X-Content-Type-Options:
schema:
type: string
example: nosniff
X-LS-License:
schema:
type: string
example: All Rights Reserved © Coffee Enterprise
X-LS-Application:
schema:
type: string
example: Coffee Mobile
X-Request-Method:
schema:
type: string
example: '{{x_method}}'
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
ETag:
schema:
type: string
example: W/"612f5da36ba12b893553b241f84ff69a"
Cache-Control:
schema:
type: string
example: max-age=0, private, must-revalidate
Set-Cookie:
schema:
type: string
example: _shyft_api_server_session=cG8rb0cvNzhvWTRMNXl0WHZ6Y2tsNEZHY1hmUGpLYkE3VHk1SWtlQTA4Rjh2NTJMWGd6cjdlUzNBVENNMXVCTmJSLzVac2xTYVFxK29tZnVBb0IyU0E9PS0tcXdJVnNRZ3VVNmJuMWVYYWljTEZlZz09--910f0ae3ad241b6d7f8a125966781daa4de2b8d6; path=/; HttpOnly
X-Rack-Dev-Mark-Env:
schema:
type: string
example: Bin%27s+Local+Server
X-Request-Id:
schema:
type: string
example: c1ee3ce4-0762-4904-abe7-88a9ac66f2cf
X-Runtime:
schema:
type: number
example: '9.842856'
Vary:
schema:
type: string
example: Origin
Connection:
schema:
type: string
example: close
Server:
schema:
type: string
example: thin 1.5.1 codename Straight Razor
content:
application/json:
schema:
type: object
example:
chat_sessions:
- _associations_removed: true
_parent_object_id: null
id: 3033
org_id: 1
message_count: 0
participant_count: 2
title: hello world
latest_message: null
multiuser_chat: false
updated_at: '2018-11-01T21:50:10.284Z'
srn: c3bb3cdb-5358-4fae-b7c2-57f50da36a93
/api/customer/user_role/chat_sessions/76:
get:
tags:
- Customer > Chats > ChatSessions
summary: get a chat session
description: "Description\n- - - \n- Get a chat sessions\n\n\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---"
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
responses:
'200':
description: Successful response
content:
application/json: {}
/api/customer/user_role/chat_sessions//{chat_session_id}/archive:
put:
tags:
- Customer > Chats > ChatSessions
summary: archive a chat sessions
description: "Description\n- - - \n- Archive a chat session\n- Removed from user's chat sessions list\n- Will be added back when there is a new message added, can still see history messages\n\n\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---"
requestBody:
content:
'*/*':
schema:
type: string
example: '""'
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: chat_session_id
in: path
schema:
type: string
required: true
responses:
'200':
description: Successful response
content:
application/json: {}
/api/customer/user_role/chat_sessions/{chat_session_id}/quit:
put:
tags:
- Customer > Chats > ChatSessions
summary: quit a chat sessions
description: "Description\n- - - \n- Quit a chat session\n- Removed from user's chat sessions list\n- Will be added back when there is a new message added, but not see history messages any more\n\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---"
requestBody:
content:
'*/*':
schema:
type: string
example: '""'
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: chat_session_id
in: path
schema:
type: string
required: true
responses:
'200':
description: Successful response
content:
application/json: {}
/api/customer/user_role/chat_sessions/{chat_session_id}/read_all:
put:
tags:
- Customer > Chats > ChatSessions
summary: read all a chat session
description: "Description\n- - - \n- Mark all messages as read for this chat session\n\n\nParams\n- - -\nParam | Values | R |Description\n--- | --- | --- | ---\n\n\nHeaders\n- - -\nHeader | Values | R |Description\n--- | --- | --- | ---\n\n\n\nInput\n- - - \n\nAttribute | Values | R |Description\n--- | --- | --- | ---"
requestBody:
content:
'*/*':
schema:
type: string
example: '""'
parameters:
- name: Session-Uukey
in: header
schema:
type: string
example: '{{session_uukey}}'
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: chat_session_id
in: path
schema:
type: string
required: true
responses:
'200':
description: Successful response
content:
application/json: {}
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
noauthAuth:
type: http
scheme: noauth