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.

X-Api-Key

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 interact with the JustAnswer APIs, first obtain an access token by making a request to the designated endpoint. This response will include the access token along with its expiration time (in seconds).Be sure to include the access token in the header of all subsequent requests as an "Authorization" field to access additional resources.

Access Token represents a token acquired for accessing JustAnswer APIs.

Available endpoint

Description

Get Access Token

Get Access token to access JustAnswer APIs.

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.

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

Add Question Message

Add question message from customer

Accept Expert Answer

Accept the answer proposed by the expert.

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 HTTP/1.1

Host: sso.justanswer.com

Content-Type: application/x-www-form-urlencoded

Accept: application/json

client_id={SampleClientID}&client_secret={SampleClientSecret}&grant_type=external_client_credentials

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

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://externalintegrationapi.justanswer.com/api/v2/questions/post

//Request example

POST /api/v2/questions/post HTTP/1.1

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 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

categoryName

optional

CategoryName for Question.
If not passed, default category for organization will be picked

string

Example response

{ "status":true, "message":"", "data": { "questionToken":"e5e06b61d720437a8cd09c67b574e5e8" } }

Get Question

Returns question entity for specific customer.

Endpoint:

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

Request Example:

GET /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8 HTTP/1.1
Host: externalintegrationapi.justanswer.com
Authorization: Bearer {accessToken}
X-Api-Key: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",

}

],

"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://externalintegrationapi.justanswer.com/api/v2/questions

//Request example

GET /api/v2/questions?page=1&pageSize=10 HTTP/1.1
Host: externalintegrationapi.justanswer.com
X-Api-Key: 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"} ], "postedDate": "2022-02-02 12:12:12" } ] } }

Add Question Message

Add question message from customer

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

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages HTTP/1.1

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 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",

  }

 ]

}

Parameters

Parameter

Required?

Description

Data Type

questionToken

true

Question token for which the messaged is added

string
text

true

Message text

string

attachments

false

Array of attachment objects

array of objects

Example response

{ "status":true, "message":"", "data": { "messageId": "41ec32ee301f479ea77fd39eed839b42_18" } }

Accept Expert Answer

Accept the answer proposed by the expert.

Endpoint

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

//Request example

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

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 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":""}

Post Answer Rating

Post answer rating after the conversation was finished

Endpoint:

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

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages/!5261af8b5105422cabc89aac35d0b7aa_170263!/feedback HTTP/1.1

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: application/json

Accept: application/json

Accept-Charset: utf-8

{

 "feedbackSettings:

 {

  "text": "That was very useful answer",

  "feedbackLevel":5

 }

}

Parameters

Parameter

Required?

Description

Data Type

messageToken

true

Message token for which the feedback is posted

string

questionToken

true

Question token for which the feedback is posted

string

text

true

Feedback text

string

feedbackLevel

true

Rating from 1 to 5

int

Example response

{ "status":true, "message":"" }

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://externalintegrationapi.justanswer.com/api/v2/attachments/upload

Request example

POST /api/v2/attachments/upload HTTP/1.1

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 181d415f34379af07b2c11d144dfbe35d

UserIdToken: {userToken}

Content-Type: image/jpeg

Accept: application/json

Accept-Charset: utf-8

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

File in the body

Example response

{ "status":true, "message":"application/json", "data": { "attachment": { "url":"url", "name":"1400x800sr-60.jpg"} } }

Get Expert Profile

Retrieve the expert profile for the question.

Endpoint:

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

Request example

GET /api/v2/experts/8c60d3c3fd5d47cd89194b9d0d23e725/Cars HTTP/1.1
Host: externalintegrationapi.justanswer.com
X-Api-Key: 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

categoryName

true

Category Name for the posted question

string

Example response

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

Mark Messages Read

Marks that messages were read by a customer.

Endpoint

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

//Request example

POST /api/v2/questions/e5e06b61d720437a8cd09c67b574e5e8/messages/!41ec32ee301f479ea77fd39eed839b42_18!/view HTTP/1.1

Host: externalintegrationapi.justanswer.com

Authorization: Bearer {accessToken}

X-Api-Key: 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