Cases

List cases

GET https://SUB_DOMAIN.hugery.com/api/external/v1/cases

This endpoint allows you to get cases.

Query Parameters

Name
Type
Description

view

string

Possible values are: "unassigned", "assigned_to_me", "closed", "all".

currentTeamMember

string

For which Team Member.

{
  "cursor": {
    "next": "YToyOntzOjQ6InNvcnQiO2E6Mzp7aTowO2Q6MDtpOjE7aToxNTg2MjY5NTQ1MDAwO2k6MjtzOjM2OiIzMTI3ZWNhYi0zZDA0LTRiMDUtYTk4Yi03NTE5M2VlOTQ2NGMiO31zOjk6ImRpcmVjdGlvbiI7YjoxO30=",
    "prev": "YToyOntzOjQ6InNvcnQiO2E6Mzp7aTowO2Q6MDtpOjE7aToxNTg4Njg4MDAxMDAwO2k6MjtzOjM2OiJjNDE0ZDQyZi03ZjA2LTQ2YTMtODk3Mi1lNDFkZTFlZWE4ZjkiO31zOjk6ImRpcmVjdGlvbiI7YjowO30="
  },
  "data": [
    {
      "aid": 50,
      "assignedTeamMember": {
        "avatar": "https://static.hugery.com/200x200/bucket/1586644129928170/4a460cb03ad82baf2dcf079acd549853/Screenshot_2020_03_18_at_22_17_33.png",
        "id": "d9033c86-a86e-474e-85a3-ccacc21ebc1d",
        "name": "Ivan Ivanov",
        "nameColor": "#9c791c",
        "updatedAt": 1586644134
      },
      "closedAt": 1588688004,
      "conversation": {
        "channel": {
          "id": "1220e87f-2d03-458b-8de1-7b71687d1839",
          "label": "WhatsApp",
          "title": "DialogHunt",
          "type": "whatsapp",
          "updatedAt": 1588259318
        },
        "id": "0f359eec-0877-4526-8a08-4848432d13a0"
      },
      "createdAt": 1588262074,
      "defaultSubject": null,
      "endUser": {
        "avatar": null,
        "avatarStub": false,
        "channelType": "whatsapp",
        "id": "656c4afb-dc13-419c-8804-f08f28caeb30",
        "name": "Boris",
        "nameColor": "#16835e",
        "updatedAt": 1588263000
      },
      "id": "c414d42f-7f06-46a3-8972-e41de1eea8f9",
      "lastMessage": {
        "id": "6b93125c-c8d3-400a-9be2-9056507af844",
        "preview": {
          "content": "Hello!",
          "type": "text"
        },
        "teamMember": null,
        "updatedAt": 1588688001
      },
      "status": "closed",
      "unread": false,
      "updatedAt": 1588688001
    },
  ],
  "status": 200
}

Show case

GET https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id

Path Parameters

Name
Type
Description

id

string

Case id

{
  "data": {
    "aid": 51,
    "assignedTeamMember": {
      "avatar": null,
      "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
      "name": "Ivan Ivanov",
      "nameColor": "#372787",
      "updatedAt": 1588670719
    },
    "closedAt": 1588687894,
    "conversation": {
      "channel": {
        "id": "1220e87f-2d03-458b-8de1-7b71687d1839",
        "label": "WhatsApp",
        "title": "Hugery",
        "type": "whatsapp",
        "updatedAt": 1588259318
      },
      "id": "dcff380c-29c9-4713-948f-6add5a6832e7"
    },
    "createdAt": 1588264136,
    "defaultSubject": null,
    "endUser": {
      "aid": 476,
      "avatar": null,
      "avatarStub": true,
      "channelFields": {
        "channel": "246dacc7-04dd-4f2f-9001-f56614c27abb",
        "conversation": "f6851891-b083-44e4-87a9-f8a8916e9b9c",
        "id": "375291231212",
        "name": "Boris",
        "phoneNumber": "375291231212"
      },
      "createdAt": 1588264136,
      "extraFields": {
        "phoneNumber": "375291231212"
      },
      "id": "17146e68-8aff-4527-8a5d-e323d7ea2eaf",
      "lastActivityAt": 1588264136,
      "name": "Boris",
      "nameColor": "#a5371a",
      "qualification": "lead",
      "updatedAt": 1588264136
    },
    "id": "448b262e-1e56-4182-afc8-d2c40dc8f83c",
    "priority": "normal",
    "status": "closed",
    "subject": null,
    "team": {
      "color": "#000",
      "id": "a7a76a50-8a4c-4a29-8799-4aeb0164f15f",
      "title": "Default",
      "updatedAt": 1586213041
    },
    "updatedAt": 1588687891
  },
  "status": 200
}

List messages

GET https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/messages

Path Parameters

Name
Type
Description

id

string

Case id

{
  "cursor": {
    "next": "YToyOntzOjQ6InNvcnQiO2E6Mzp7aTowO2Q6MDtpOjE7aTo1OTA7aToyO3M6MzY6ImNmOTE1N2NhLTc1MTgtNDE0NC05NGYwLTUwNjFhNGMwMWQzYiI7fXM6OToiZGlyZWN0aW9uIjtiOjE7fQ==",
    "prev": "YToyOntzOjQ6InNvcnQiO2E6Mzp7aTowO2Q6MDtpOjE7aTo1OTE7aToyO3M6MzY6IjRiNmEyOWY2LTU1ZDUtNGE2OS05NjY3LTMwODNmMjBmYzE4MiI7fXM6OToiZGlyZWN0aW9uIjtiOjA7fQ=="
  },
  "data": [
    {
      "aid": 591,
      "bot": null,
      "casesEvents": [],
      "createdAt": 1588865652,
      "endUser": {
        "avatar": "https://static.hugery.com/200x200/bucket/1588865651178356/97a49ee6688b28f1e9523748532cb8fe/image.jpg",
        "avatarStub": false,
        "id": "b763cdf9-23d5-4cda-aba3-0e861392055e",
        "name": "Boris",
        "nameColor": "#541c83",
        "updatedAt": 1588865652
      },
      "id": "4b6a29f6-55d5-4a69-9667-3083f20fc182",
      "messageContents": [
        {
          "content": "Hello!",
          "file": null,
          "id": "93fe6e9d-686c-4ea4-a6ef-919bcbe8487c",
          "status": "delivered",
          "type": "text",
          "updatedAt": 1588865652
        }
      ],
      "teamMember": null,
      "updatedAt": 1588865652
    }
  ],
  "status": 200
}

Assign case

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/assign

Assign case to team or team member

Path Parameters

Name
Type
Description

id

string

Case id

Request Body

Name
Type
Description

currentTeamMember

string

team

string

teamMember

string

{
  "data": {
    "cases": {
      "assignedTeamMember": {
        "avatar": null,
        "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
        "name": "Ivan Ivanov",
        "nameColor": "#372787",
        "updatedAt": 1588670719
      },
      "id": "a9c22a66-0728-44f5-b72e-05214660b833",
      "status": "open",
      "team": {
        "color": "#000",
        "id": "a7a76a50-8a4c-4a29-8799-4aeb0164f15f",
        "title": "Default",
        "updatedAt": 1586213041
      },
      "updatedAt": 1588844436
    },
    "casesEvents": [
      {
        "event": "assigned",
        "id": "bc06f028-c8cb-4295-9d82-e1425c9ce5ea",
        "initiatorTeamMember": {
          "avatar": null,
          "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
          "name": "Ivan Ivanov",
          "nameColor": "#372787",
          "updatedAt": 1588670719
        },
        "oldTeam": null,
        "targetTeam": {
          "color": "#000",
          "id": "a7a76a50-8a4c-4a29-8799-4aeb0164f15f",
          "title": "Default",
          "updatedAt": 1586213041
        },
        "targetTeamMember": {
          "avatar": null,
          "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
          "name": "Ivan Ivanov",
          "nameColor": "#372787",
          "updatedAt": 1588670719
        },
        "updatedAt": null
      }
    ],
    "createdAt": 1588844436,
    "id": "33eb3432-c68f-42e2-880b-272bda382e8d",
    "updatedAt": 1588844436
  },
  "status": 200
}

Unassign case

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/unassign

Path Parameters

Name
Type
Description

id

string

Case id

Request Body

Name
Type
Description

currentTeamMember

string

{
    "status": 200,
    "data": {
        "id": "2e2d673c-970f-40b3-946a-ca9d5c4a6dd8",
        "cases": {
            "id": "a9c22a66-0728-44f5-b72e-05214660b833",
            "assignedTeamMember": null,
            "team": null,
            "updatedAt": 1588844844
        },
        "casesEvents": [
            {
                "id": "dd11b847-bbe5-4a1a-84f3-ac86fc93b993",
                "event": "unassigned",
                "initiatorTeamMember": {
                    "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
                    "name": "Ivan Ivanov",
                    "nameColor": "#372787",
                    "avatar": null,
                    "updatedAt": 1588670719
                },
                "targetTeamMember": null,
                "targetTeam": null,
                "oldTeam": null,
                "updatedAt": null
            }
        ],
        "createdAt": 1588844844,
        "updatedAt": 1588844844
    }
}

Close case

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/close

Path Parameters

Name
Type
Description

id

string

Case id

Request Body

Name
Type
Description

currentTeamMember

string

{
  "data": {
    "cases": {
      "assignedTeamMember": {
        "avatar": null,
        "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
        "name": "Ivan Ivanov",
        "nameColor": "#372787",
        "updatedAt": 1588670719
      },
      "id": "a9c22a66-0728-44f5-b72e-05214660b833",
      "status": "closed",
      "team": {
        "color": "#000",
        "id": "a7a76a50-8a4c-4a29-8799-4aeb0164f15f",
        "title": "Default",
        "updatedAt": 1586213041
      },
      "updatedAt": 1588845056
    },
    "casesEvents": [
      {
        "event": "closed",
        "id": "f8fda3e0-3ba6-4acc-903b-4368f3dcf26f",
        "initiatorTeamMember": {
          "avatar": null,
          "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
          "name": "Ivan Ivanov",
          "nameColor": "#372787",
          "updatedAt": 1588670719
        },
        "oldTeam": {
          "color": "#000",
          "id": "a7a76a50-8a4c-4a29-8799-4aeb0164f15f",
          "title": "Default",
          "updatedAt": 1586213041
        },
        "targetTeam": null,
        "targetTeamMember": null,
        "updatedAt": null
      }
    ],
    "createdAt": 1588845059,
    "id": "a3f86db2-f0b5-42e0-9de1-4e73b2bd11b7",
    "updatedAt": 1588845059
  },
  "status": 200
}

Send message

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/messages

Path Parameters

Name
Type
Description

id

string

Case id

Request Body

Name
Type
Description

teamMember

string

text

string

{
  "data": {
    "aid": 577,
    "createdAt": 1588856604,
    "id": "f2d54415-d510-4737-a3c4-58712e331d6d",
    "messageContents": [
      {
        "content": "Hello!",
        "file": null,
        "id": "2c734c36-e3bb-4bf7-aba3-eb6896f1ec4c",
        "status": "error",
        "type": "text",
        "updatedAt": 1588856604
      }
    ],
    "teamMember": {
      "avatar": null,
      "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
      "name": "Ivan Ivanov",
      "nameColor": "#372787",
      "updatedAt": 1588670719
    },
    "updatedAt": 1588856604
  },
  "status": 200
}

Send file

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/messages

Path Parameters

Name
Type
Description

id

string

Case id

Request Body

Name
Type
Description

teamMember

string

files

array

Array of file ids. See file uploading endpoint.

{
  "data": {
    "aid": 579,
    "createdAt": 1588857084,
    "id": "62e76880-7ddd-4860-bb0d-03563396e26d",
    "messageContents": [
      {
        "content": null,
        "file": {
          "id": "6b380079-fd23-4b9f-84d6-34ccd6d089d2",
          "info": {
            "mimeType": "image/png",
            "name": "image.png",
            "path": "/bucket/1588857072534100/a12887a71e786dbba0060db4fec708e9/image.png",
            "size": 26751
          },
          "meta": {
            "height": 326,
            "width": 576
          },
          "type": "image",
          "updatedAt": 1588809600,
          "url": {
            "1280x880": "https://static.hugery.com/1280x880/bucket/1588857072534100/a12887a71e786dbba0060db4fec708e9/image.png",
            "200x200": "https://static.hugery.com/200x200/bucket/1588857072534100/a12887a71e786dbba0060db4fec708e9/image.png",
            "640x760": "https://static.hugery.com/640x760/bucket/1588857072534100/a12887a71e786dbba0060db4fec708e9/image.png",
            "default": "https://static.hugery.com/bucket/1588857072534100/a12887a71e786dbba0060db4fec708e9/image.png"
          }
        },
        "id": "b6197073-4496-47cc-82ba-b5128485947c",
        "status": "error",
        "type": "file",
        "updatedAt": 1588857084
      }
    ],
    "teamMember": {
      "avatar": null,
      "id": "25b26fd1-42c0-4a3b-a223-b2db1a2287a2",
      "name": "Ivan Ivanov",
      "nameColor": "#372787",
      "updatedAt": 1588670719
    },
    "updatedAt": 1588857084
  },
  "status": 200
}

Send note

POST https://SUB_DOMAIN.hugery.com/api/external/v1/cases/:id/messages

Path Parameters

Name
Type
Description

id

string

Request Body

Name
Type
Description

teamMember

string

text

string

{
  "data": {
    "aid": 597,
    "createdAt": 1588867868,
    "id": "519378da-a7f0-4373-8cfd-6d1f0d0f4c79",
    "messageContents": [
      {
        "content": "hello",
        "file": null,
        "id": "3cd0cb15-53b5-4f9b-8e93-be30eef851b3",
        "status": "sent",
        "type": "note",
        "updatedAt": 1588867868
      }
    ],
    "teamMember": {
      "avatar": "https://static.hugery.com/200x200/bucket/1586644129928170/4a460cb03ad82baf2dcf079acd549853/image.png",
      "id": "d9033c86-a86e-474e-85a3-ccacc21ebc1d",
      "name": "Title",
      "nameColor": "#9c791c",
      "updatedAt": 1586644134
    },
    "updatedAt": 1588867868
  },
  "status": 200
}

Last updated