Introduction

The following information covers the flow and messaging calls for an expert messaging API.

It is assumed that your application will handle user authentication and will track/store the tokens and identity of said user.

These are in order of flow for expert messaging.

JustAnswer Endpoint Examples

Obligatory headers

Authorization

This header is used to pass the accessToken which you will recieve when you call SSO API. Access Token can be used till its expiry after which new access token will be required.

XApiKey

This header is used to check ApiKey. ApiKey is validated if it is active and have access to the api. In this header ApiKey value should be passed, this ApiKey will be provided for each environment.

UserIdToken

This header is used to pass the userToken for api to then determine for which user the request is performed. In this header customer unique identificatory should be passed.

SSO Resource

To use the APIs provided by JustAnswer, start by fetching an access token from this endpoint. The access token is valid for 24 hours and must be included in the header as an "Authorization" when making calls to any other resources.

Access Token represents a token acquired for accessing JustAnswer APIs for 24 hours

Available endpoint

Description

Get Access Token

Get Access token to access JustAnswer APIs for 24 hours.

Question Resource

Question is the main entity in terms of this API. It represents customer and expert conversation. Use Question API endpoints to post or retrieve customer’s questions.

QuestionToken uniquely represents a question.

Available endpoint

Description

Post Customer Question

Post the customer question in order to get an expert answer.

Get Question

Returns question entity for specific customer.

Get All Questions for specific customer

Returns information about all questions posted by a customer.

Track Question View

Track that question was viewed by a customer.

Entity format:

Property

Description

Data Type

token

Question token that uniquely represents question

string

text

Question text that was posted by customer

string

attachments

List of the attachment entities

array

postedDate

DateTime in UTC when the question was posted

datetime

isclosed

Is the question is closed

bool

Message Resource

A message is the entity that represents the unit of the conversation. Messages could be posted by customers or experts.

MessageToken uniquely represents a message.

Available endpoint

Description

Get Question Messages

Retrieve question messages for a specific question.

Add Question Message

Add question message from customer

Accept Expert Answer

Accept the answer proposed by the expert.

Track Answer View

Tracks that expert response was viewed by a customer.

Mark Messages Read

Marks that messages were read by a customer.

Entity format:

Property

Description

Data Type

token

Message token that uniquely represents message

string

posted

DateTime in UTC when the message was posted

datetime

questionToken

Question token that uniquely represents question

string

type

Type of the message based on that who posted the message

string

feedback

Feedback entity

string

isexpertmessage

Is this message posted by Expert

bool

expert

Expert entity if this message was posted by expert

string

isMessageExpertProposedAnswer

Is this message is proposed answer from expert

 bool

isMessageExpertAcceptedAnswer

Is this message accepted as an answer from customer side

bool

isMessageCustomerResponse

Is this message posted by customer

bool

Feedback Resource

Feedback represents feedback that was posted by a customer to the question answer.

Available endpoint

Description

Post Answer Rating

Post answer rating after the conversation was finished

Entity format:

Property

Description

Data Type

text

Feedback text that was posted by customer

string

ratingfeedbacknumber

Feedback rating representation in number

int

datecreated

DateTime in UTC when the feedback was posted

datetime

Expert Resource

Expert resource represents general info about expert to show it on the question page.

ExpertToken uniquely represents expert.

Available endpoint

Description

Get Expert Profile

Retrieve the expert profile for the question

Entity format:

Property

Description

Data Type

token

Expert token that uniquely represents expert

string

name

Expert name

string

jobdescription

Expert’s professional experience and description

string
rating

Expert’s rating that was given on the JA platform

string

totalnumberofratings

Amount of customers that rated this expert

string

avatarUrlBig

Expert’s avatar big version url

url

avatarUrlSmall

Expert’s avatar small version url

url

Attachment Resource

Attachment resource represents an image that could be uploaded and added to the message. This image will then be reviewed by experts.

Attachments don’t have a token that uniquely represents it. Link uniquely represents it.

Available endpoint

Description

Upload Attachment

Upload the attachment. This endpoint is used only for file uploading to cloud and getting a url for this file.
After this - url should be added into corresponding message from user.

Entity format:

Property

Description

Data Type

url

Url where the image was uploaded

url

name

File name

string

contentlength

Image content length in bytes

bytes

Endpoint Details

Get Access Token

Get Access Token to use JustAnswer APIs for 24 hours

Endpoint

POST https://sso.justanswer.com/connect/token

//Request example

POST connect/token

Host: sso.justanswer.com

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8 {

"client_id":"SampleClientID"

"client_secret":"SampleClientSecret"

"grant_type":"SampleGrantType"

}

Parameters

Parameter

Required?

Description

Data Type

client_id

true

To be provided by JustAnswer Team

string

client_secret

true

To be provided by JustAnswer Team

string

grant_type

true

To be provided by JustAnswer Team

string

Example response

{ "access_token": "1234567890123456789012345678901234567890QzAwMkRBNjEyNjAyMUFCNUU3RjFFMjhEIiwidHlwIjoiYXQrand0In0.eyJpc3MiOiJodHRwOi8vc3RzLm9yZC5wZWFybC5sb2NhbCIsIm5iZiI6MTcyOTg0Mjc5MiwiaWF0IjoxNzI5ODQyNzkyLCJleHAiOjE3Mjk5MjkxOTIsImF1ZCI6Imh0dHBzOi8vZXh0ZXJuYWxpbnRlZ3JhdGlvbmFwaS5qdXN0YW5zd2VyLmNvbSIsInNjb3BlIjpbImV4dGVybmFsQXBpLmNsaWVudCJdLCJjbGllbnRfaWQiOiJleHRlcm5hbC1hcGktcGFydG5lci5jbGllbnQiLCJqdGkiOiI3MTYyRjNBMDNENUU3ODkyMjZCNEJBMzk5NkJCQ0M4NiJ9.l6kllcIVlt9pyyw2rzFStDff-8PNQiLpRYiipBoh9-qdG0iwnfjJ2PPrKXzLZMTevfKr0pK2D5YzMHV4R6JrFc06HMbsLEFzqApAnswvW5A86VwgcrJBgqJWJ08FEIB_sddfghhjkq2er45y", "expires_in": 86400, "token_type": "Bearer", "scope": "externalApi.client" }

Post Customer Question

Post the customer question in order to get an expert answer.

Endpoint

POST https://api.justanswer.com/api/v2/questions/postquestion

//Request example

POST api/v2/questions/postquestion

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8 {

"Message":"This is question text"

}

Parameters

Parameter

Required?

Description

Data Type

Message

true

Question message that should be posted

string

Example response

{ "Status":true, "Message":"", "Data": { "questionToken":"e5e06b61d720437a8cd09c67b574e5e8" } }

Get Question

Returns question entity for specific customer.

Endpoint:

GET https://api.justanswer.com/api/v2/questions/{questionToken}

Request Example:

GET /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8
Host: api.justanswer.com 
Authorization: Bearer {accessToken} 
XApiKey:181d415f34379af07b2c11d144dfbe35d UserIdToken: {userToken}
Content-Type: application/json Accept: application/json
Accept-Charset: utf-8

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which information should be returned

string

Example response

{

"Status":true,

"Message":"",

"Data":

{

"question":

{

"token": "e5e06b61d720437a8cd09c67b574e5e8",

"isclosed": false,

"text": "This is a question"

"attachments":

[

{

"Url":"url",

"Name":"1400x800sr-60.jpg",

"ContentLength":null

}

],

"postedDate": "2022-02-02 12:12:12"

},

"messages":

[

{

"token": "!41ec32ee301f479ea77fd39eed839b42_1!",

"posted": "2022-02-02 12:12:25",

"questionToken": "e5e06b61d720437a8cd09c67b574e5e8",

"text": "answer",

"attachments"

[

{

"Url":"url",

"Name":"1400x800sr-60.jpg",

"ContentLength":null

}

],

"isExpertMessage": true,

"expert":

{

"token": "8c60d3c3fd5d47cd89194b9d0d23e725",

"name": "John Expert",

"getSmallestPhotoUri": "url"

},

"feedback":

{

"text": "feedback text",

"ratingFeedbackNumber": 5,

"dateCreated": "2022-02-02 12:12:25"

},

"hasFeedback": true,

"type": "ExpertResponse",

"isMessageExpertProposedAnswer": false,

"isMessageExpertAcceptedAnswer": false,

"isMessageCustomerResponse": false

}

],

"expert":

{

"token": "8c60d3c3fd5d47cd89194b9d0d23e725",

"name": "Expert",

"jobDescription": "JustAnswer expert",

"rating": 5,

"totalNumberOfRatings": 3082,

"avatarUrlBig": "url",

"avatarUrlSmall": "url"

}

}

}

Get All Questions for specific customer

Returns information about all questions posted by a customer.

Endpoint

GET https://api.justanswer.com/api/v2/questions

//Request example

GET /api/v2/questions Host: api.justanswer.com XApiKey: 181d415f34379af07b2c11d144dfbe35d Authorization: Bearer {accessToken} UserIdToken: {userToken} questionToken Content-Type: application/json Accept: application/json Accept-Charset: utf-8

Parameters

Parameter

Required?

Description

Data Type

page

false

Indicates the nth page of results is required. This is the same as saying skip (page - 1) * pageSize entries. Default 0

int

pagesize

false

Number of entries to return in this call. Default 20

int

state

false

Open or All. Default - all.

string

includequestiontext

false

True if the question text is to be returned. Default true.

bool

includemessages

false

True if the messages are to be returned. Default false.

bool

Example response

{ "Status":true, "Message":"", "Data": { "questions": [ { "token": "e5e06b61d720437a8cd09c67b574e5e8", "isclosed": false, "text": "This is a question" "attachments": [ { "Url":"url", "Name":"1400x800sr-60.jpg", "ContentLength":null } ], "postedDate": "2022-02-02 12:12:12" } ] } }

Get Question Messages

Retrieve question messages for a specific question.

Endpoint

GET https://api.justanswer.com/api/v2/questions/{questionToken}/messages

//Request example

GET /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json Accept-Charset: utf-8

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which message should be returned

string

Example response

{ "Status":true, "Message":"", "Data": { "messages": [ { "token": "!41ec32ee301f479ea77fd39eed839b42_18!", "posted": "2022-02-02 12:12:12", "questionToken": "e5e06b61d720437a8cd09c67b574e5e8", "type": "ExpertResponse", "text": "My name is Expert, and I will help you", "feedback": { "text": "feedback text", "ratingFeedbackNumber": 5, "dateCreated": "2022-02-02 12:12:25" }, "isExpertMessage": true, "expert": { "token": "8c60d3c3fd5d47cd89194b9d0d23e725", "name": "John Expert", "getSmallestPhotoUri": "url" }, "attachments": [ { "Url":"url", "Name":"1400x800sr-60.jpg", "ContentLength":null } ], "hasFeedback": true, "isMessageExpertProposedAnswer": false, "isMessageExpertAcceptedAnswer": false, "isMessageCustomerResponse": false } ] } }

Add Question Message

Add question message from customer

Endpoint POST https://api.justanswer.com/api/v2/questions/{questionToken}/messages

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

"Text": "My name is Customer, and I need help",

"Attachments":

[

{

"Url":"url",

"Name":"1400x800sr-60.jpg",

"ContentLength":null

}

]

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the rating is posted

string
text

true

Message text

string

attachments

false

Array of attachment objects

array of objects

Example response

{ "Status":true, "Message":"", "Data": { "MessageToken": "41ec32ee301f479ea77fd39eed839b42_18" } }

Accept Expert Answer

Accept the answer proposed by the expert.

Endpoint

POST https://api.justanswer.com/api/v2/questions/{questionToken}/messages/{messageToken}/accept

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages/41ec32ee301f479ea77fd39eed839b42_18/accept

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

Parameters

Parameter

Required?

Description

Data Type

messageToken

true

Message token that should be accepted

string

questionToken

true

Question token for which the rating is posted

string

Example response

{ "Status":true, "Message":"", "Data":null }

Post Answer Rating

Post answer rating after the conversation was finished

Endpoint:

POST https://api.justanswer.com/api/v2/questions/{questionToken}/answer/feedback

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/answer/feedback

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

"text": "That was very useful answer"

"rating":5

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the rating is posted

string

text

true

Feedback text

string

rating

true

Rating from 1 to 5

int

Example response

{ "Status":true, "Message":"", "Data": { "Feedback": { "Text":"feedback text", "RatingFeedbackNumber":5, "DateCreated":"2022-06-14T09:34:22Z" } } }

Upload Attachment

Upload the attachment. This endpoint is used only for file uploading to the cloud and getting a url for this file. After this - url should be added into corresponding message from user.

Endpoint

POST https://api.justanswer.com/api/v2/attachments/upload

Request example

POST /api/v2/attachments/upload

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Accept: application/json

Accept-Charset: utf-8

Content-Disposition: form-data; name="fileUpload"; filename="attachment.jpg"

Content-Type: image/jpeg

File in the body

Example response

{ "Status":true, "Message":"application/json", "Data": { "Attachment": { "Url":"url", "Name":"1400x800sr-60.jpg", "ContentLength":123456 } } }

Get Expert Profile

Retrieve the expert profile for the question.

Endpoint:

GET https://api.justanswer.com/api/v2/experts/{expertToken}

Request example

GET /api/v2/experts/8c60d3c3fd5d47cd89194b9d0d23e725 Host: api.justanswer.com XApiKey: 181d415f34379af07b2c11d144dfbe35d Authorization: Bearer {accessToken} UserIdToken: {userToken} Content-Type: application/json Accept: application/json Accept-Charset: utf-8

Parameters

Parameter

Required?

Description

Data Type

expertToken

true

Expert token for which we are retrieving profile

string

Example response

{ "status":true, "message":null, "data": { "token":"8c60d3c3fd5d47cd89194b9d0d23e725", "name":"Expert", "jobDescription":"Answering question", "rating":4, "totalNumberOfRatings":1, "avatarUrlBig":"url", "avatarUrlSmall":"url" } }

Track Question View

Track that question was viewed by a customer.

Endpoint

POST https://api.justanswer.com/api/v2/questions/{questionToken}/view

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/view

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the answer is posted

string

Example response

{ "Status":true, "Message":"", "Data":null }

Track Answer View

Tracks that expert response was viewed by a customer.

Endpoint

POST https://api.justanswer.com/api/v2/questions/{questionToken}/answer/view

//Request example

POST:

/api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/answer/view

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the answer is posted

string

Example response

{ "Status":true, "Message":"", "Data":null }

Mark Messages Read

Marks that messages were read by a customer.

Endpoint

POST https://api.justanswer.com/api/v2/questions/{questionToken}/messages/{messageToken}/view

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages/41ec32ee301f479ea77fd39eed839b42_18/view

Host: api.justanswer.com

Authorization: Bearer {accessToken}

XApiKey: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the answer is posted

string

messageToken

true

Latest read message token

string
API Developer page