Index

1. /messageuser

Pathname:

{{baseUrl}}/api/v1/{{codename}}/messageuser?skip=0&limit=10
{{baseUrl}}/api/v1/{{codename}}/messageuser?skip=0&limit=10&query={"account":"accountId"}

Method: GET

Header:

Accept: 'application/json'
Content-Type: 'application/json'
Authorization: 'Bearer ' + accessToken

Url params:

Parameter

type

Description

codename

String

Request the Chat-Tonic team.

Query params:

Parameter

type

Description

skip

String

Default 0.

limit

String

Default and max value 100.

query

Object

Optional value
{“account“:”accountId”}

Sort params:

Parameter

type

Description

createdAt

Number

-1

1

Response:

Returns users conversations to the bot.

{
  "limit": 10,
  "skip": 0,
  "objects": [
    {
      "allowedBroadcast": true,
      "_id": "5d7aa7b9a2b64670f6653afe",
      "firstName": "Fernando",
      "lastName": "Chamorro",
      "profilePictureURL": "https://platform-lookaside.fbsbx.com/platform/profilepic/?psid=2325865257505792&width=1024&ext=1570911417&hash=AeTl15Z4vRPvcnGr",
      "app": "57add9d952a84d940c9194a6",
      "account": "5970d180adf62b28c8630566",
      "platform": "messenger",
      "real": true,
      "pointers": [],
      "createdAt": "2019-09-12T20:16:57.907Z",
      "updatedAt": "2019-09-13T20:31:05.107Z",
      "blockedAt": null,
      "context": {
        "ingreso": "1000",
        "documentosLead": {
          "dni_front": null,
          "dni_back": null
        },
        "provincia": null,
        "localidad": null,
        "direccion": null,
        "horario": null
      },
      "inFlow": "askDniFrente",
      "lastMessageIn": {
        "flows": [
          "saveIngreso",
          "validateIngresoSuccess",
          "endIngreso",
          "interactionIngreso",
          "nextIngreso",
          "tryAskDniFrente",
          "askDniFrente"
        ],
        "_id": "5d7bfc8998317f98fa111fbb",
        "app": "57add9d952a84d940c9194a6",
        "account": "5970d180adf62b28c8630566",
        "platform": "messenger",
        "id": "7sPvpxGwZvuXiOtlBjtSgW3votOjoe8TdkGtkIrM12JzgwsuR7jo6e64sd0P35XPc_446gygt16Nyf0xlWRLYA",
        "receivedAt": "2019-09-13T20:31:04.287Z",
        "to": "self",
        "from": "2325865257505792",
        "entities": [],
        "type": "text",
        "text": "1000",
        "handledByBot": true,
        "inFlow": "saveIngreso",
        "messageUser": "5d7aa7b9a2b64670f6653afe",
        "createdAt": "2019-09-13T20:31:05.062Z",
        "updatedAt": "2019-09-13T20:31:05.062Z"
      },
      "lastMessageInAt": "2019-09-13T20:31:05.062Z",
      "lastMessageInByUser": {
        "flows": [
          "saveIngreso",
          "validateIngresoSuccess",
          "endIngreso",
          "interactionIngreso",
          "nextIngreso",
          "tryAskDniFrente",
          "askDniFrente"
        ],
        "_id": "5d7bfc8998317f98fa111fbb",
        "app": "57add9d952a84d940c9194a6",
        "account": "5970d180adf62b28c8630566",
        "platform": "messenger",
        "id": "7sPvpxGwZvuXiOtlBjtSgW3votOjoe8TdkGtkIrM12JzgwsuR7jo6e64sd0P35XPc_446gygt16Nyf0xlWRLYA",
        "receivedAt": "2019-09-13T20:31:04.287Z",
        "to": "self",
        "from": "2325865257505792",
        "entities": [],
        "type": "text",
        "text": "1000",
        "handledByBot": true,
        "inFlow": "saveIngreso",
        "messageUser": "5d7aa7b9a2b64670f6653afe",
        "createdAt": "2019-09-13T20:31:05.062Z",
        "updatedAt": "2019-09-13T20:31:05.062Z"
      },
      "lastMessageInByUserAt": "2019-09-13T20:31:05.062Z",
      "localeSelected": "es-AR",
      "profile": {
        "dni": "12345678",
        "celular": "1412345678",
        "email": "fer@gmail.com"
      },
      "lastMessageOut": {
        "flows": [],
        "_id": "5d7bfc8998317f98fa111fbe",
        "text": "Hacé todo lo que puedas para que la foto sea buena calidad.",
        "app": "57add9d952a84d940c9194a6",
        "account": "5970d180adf62b28c8630566",
        "platform": "messenger",
        "from": "self",
        "messageUser": "5d7aa7b9a2b64670f6653afe",
        "type": "text",
        "inFlow": "askDniFrente",
        "to": "2325865257505792",
        "createdAt": "2019-09-13T20:31:05.107Z",
        "updatedAt": "2019-09-13T20:31:05.107Z"
      },
      "lastMessageOutAt": "2019-09-13T20:31:05.107Z"
    }
  ]
}


2. /message

Pathname:

{{baseUrl}}/api/v1/{{codename}}/message?limit=10&sort={"createdAt":-1}
{{baseUrl}}/api/v1/{{codename}}/message?query={"messageUser":"messageUserId"}
&limit=10&sort={"createdAt":-1}

Method: GET

Header:

Accept: 'application/json'
Content-Type: 'application/json'
Authorization: 'Bearer ' + accessToken

Url params:

Parameter

type

Description

codename

String

Request the Chat-Tonic team.

Query params:

Parameter

type

Description

limit

String

Default and max value 100

query

Object

{“messageUser”:”messageUserId”}

Sort params:

Parameter

type

Description

createdAt

Number

-1

1

Response:

Return messages

{
    "limit": 100,
    "skip": 0,
    "objects": [
        {
            "flows": [],
            "_id": "5d9ddb8f25e83cf49b8d6051",
            "text": "Thank you for feedback. Have a great day further.",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "from": "self",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "type": "text",
            "inFlow": "finishLeadRoadside",
            "to": "2325865257505792",
            "createdAt": "2019-10-09T13:07:27.545Z",
            "updatedAt": "2019-10-09T13:07:29.050Z",
            "deliveredAt": "2019-10-09T13:07:28.364Z",
            "readAt": "2019-10-09T13:07:28.364Z"
        },
        {
            "flows": [
                "interactionFeedbackRoadside",
                "finishLeadRoadside"
            ],
            "_id": "5d9ddb8f25e83cf49b8d6050",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "id": "2325865257505792-5d9ddb8a25e83cf49b8d604b-postback",
            "receivedAt": "2019-10-09T13:07:26.547Z",
            "to": "self",
            "from": "2325865257505792",
            "entities": [],
            "type": "text",
            "text": "Poor",
            "handledByBot": true,
            "selectedOption": "Poor",
            "inFlow": "interactionFeedbackRoadside",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "createdAt": "2019-10-09T13:07:27.537Z",
            "updatedAt": "2019-10-09T13:07:27.538Z"
        },
        ...
}


3. /message/query/old

Pathname:

{{baseUrl}}/api/v1/{{codename}}/message/query/old?messageUser=5d960bfa732ae478e6ca36e3
&createdAt:2019-10-04T19:44:55.409Z

Method: GET

Header:

Accept: 'application/json'
Content-Type: 'application/json'
Authorization: 'Bearer ' + accessToken

Url params:

Parameter

type

Description

codename

String

Request the Chat-Tonic team.

Query params:

Parameter

type

Description

messageUser

String

Required value, message user id.

createdAt

String

Required value, message createdAt.

Response:

Returns messages prior to the requested date.

{
    "objects": [
        {
            "flows": [],
            "_id": "5d979ccbe4ca0d9e8f2e76bc",
            "text": "Hello",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "from": "self",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "type": "text",
            "inFlow": "menuRoadside",
            "to": "2325865257505792",
            "createdAt": "2019-10-04T19:26:03.908Z",
            "updatedAt": "2019-10-04T19:26:14.382Z",
            "deliveredAt": "2019-10-04T19:26:13.763Z",
            "readAt": "2019-10-04T19:26:13.763Z"
        },
        {
            "flows": [],
            "_id": "5d979ccbe4ca0d9e8f2e76bd",
            "text": "I am Thabo your Digital Assistant",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "from": "self",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "type": "text",
            "inFlow": "menuRoadside",
            "to": "2325865257505792",
            "createdAt": "2019-10-04T19:26:03.935Z",
            "updatedAt": "2019-10-04T19:26:14.389Z",
            "deliveredAt": "2019-10-04T19:26:13.763Z",
            "readAt": "2019-10-04T19:26:13.763Z"
        },
        ...
}


4. /message/query/new

Pathname:

{{baseUrl}}/api/v1/{{codename}}/message/query/new?messageUser=5d960bfa732ae478e6ca36e3
&createdAt=2019-10-04T19:44:55.409Z

Method: GET

Header:

Accept: 'application/json'
Content-Type: 'application/json'
Authorization: 'Bearer ' + accessToken

Url params:

Parameter

type

Description

codename

String

Request the Chat-Tonic team.

Query params:

Parameter

type

Description

messageUser

String

Required value, message user id.

createdAt

String

Required value, message createdAt.

Response:

Returns messages after the requested date.

{
    "objects": [
        {
            "flows": [],
            "_id": "5d979ccbe4ca0d9e8f2e76bc",
            "text": "Hello",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "from": "self",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "type": "text",
            "inFlow": "menuRoadside",
            "to": "2325865257505792",
            "createdAt": "2019-10-04T19:26:03.908Z",
            "updatedAt": "2019-10-04T19:26:14.382Z",
            "deliveredAt": "2019-10-04T19:26:13.763Z",
            "readAt": "2019-10-04T19:26:13.763Z"
        },
        {
            "flows": [],
            "_id": "5d979ccbe4ca0d9e8f2e76bd",
            "text": "I am Thabo your Digital Assistant",
            "app": "57add9d952a84d940c9194a6",
            "account": "5970d180adf62b28c8630566",
            "platform": "messenger",
            "from": "self",
            "messageUser": "5d960bfa732ae478e6ca36e3",
            "type": "text",
            "inFlow": "menuRoadside",
            "to": "2325865257505792",
            "createdAt": "2019-10-04T19:26:03.935Z",
            "updatedAt": "2019-10-04T19:26:14.389Z",
            "deliveredAt": "2019-10-04T19:26:13.763Z",
            "readAt": "2019-10-04T19:26:13.763Z"
        },
        ...
}