# Get User Messages

This API retrieves a list of messages for a specified thread within a given app ID and user ID.

The following error code is displayed when the Server Side Inbox is disabled for your tenant.

```json
{
    "code": 67,
    "description": "This functionality is not available as Server Side Inbox is disabled for your app asset."
}
```

> 📘 Note
>
> Only a tenant owner, full access user, or limited access user can enable or disable the Server Side Inbox for your tenant. To learn more, refer to [Server Side Inbox](https://help.webexconnect.io/docs/mobile-web#add-a-mobile-application) feature.

> 📘 Know Your Endpoint
>
> Based on the domain you use to log in to Webex Connect , the endpoint for your API varies. See the [endpoint](https://developers.imiconnect.io/reference/endpoints) section to understand which endpoint to use for your domain.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Thread API",
    "version": "6.21.0"
  },
  "servers": [
    {
      "url": "https://rtm.imiconnect.io/rtmsAPI/api/v1/"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/apps/{appid}/user/{userid}/threads/{threadid}/messages": {
      "get": {
        "summary": "Get User Messages",
        "description": "This API retrieves a list of messages for a specified thread within a given app ID and user ID.",
        "operationId": "user-messages-1",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "application/json",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretKey",
            "in": "header",
            "description": "Client key that can be accessed from your app asset configuration page on Webex Connect platform",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "appid",
            "in": "path",
            "description": "Specifies the ID of the app asset on Webex Connect platform",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "userid",
            "in": "path",
            "description": "Unique ID for a mobile/web app user.",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "threadid",
            "in": "path",
            "description": "The ID of the thread",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"total\": 1,\n    \"code\": \"0\",\n    \"count\": 1,\n    \"messages\": [\n        {\n            \"payload_type\": \"sentByUser\",\n            \"created_on\": \"2020-08-13T11:47:31.688Z\",\n            \"appid\": \"BA22091950\",\n            \"extras\": {},\n            \"read_at\": \"\",\n            \"media\": [],\n            \"thread\": {\n                \"id\": \"22110118-6352-4bbc-a53a-43b761ae18db\"\n            },\n            \"message\": \"hello\",\n            \"userId\": \"1420966801\",\n            \"delivered_at\": \"\",\n            \"tid\": \"Rbca18c81-ac37-4e0a-98ce-345b1c38fd11\",\n            \"status\": \"submited\"\n        }\n    ],\n    \"description\": \"success\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "code": {
                      "type": "string",
                      "example": "0"
                    },
                    "count": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "payload_type": {
                            "type": "string",
                            "example": "sentByUser"
                          },
                          "created_on": {
                            "type": "string",
                            "example": "2020-08-13T11:47:31.688Z"
                          },
                          "appid": {
                            "type": "string",
                            "example": "BA22091950"
                          },
                          "extras": {
                            "type": "object",
                            "properties": {}
                          },
                          "read_at": {
                            "type": "string",
                            "example": ""
                          },
                          "media": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {}
                            }
                          },
                          "thread": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "example": "22110118-6352-4bbc-a53a-43b761ae18db"
                              }
                            }
                          },
                          "message": {
                            "type": "string",
                            "example": "hello"
                          },
                          "userId": {
                            "type": "string",
                            "example": "1420966801"
                          },
                          "delivered_at": {
                            "type": "string",
                            "example": ""
                          },
                          "tid": {
                            "type": "string",
                            "example": "Rbca18c81-ac37-4e0a-98ce-345b1c38fd11"
                          },
                          "status": {
                            "type": "string",
                            "example": "submited"
                          }
                        }
                      }
                    },
                    "description": {
                      "type": "string",
                      "example": "success"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "-X GET https://rtm.imiconnect.io/rtmsAPI/api/v1/apps/{{appid}}/user/{{userid}}/threads/{{threadid}}/messages\n-H \"Content-Type : application/json\"\n-H \"secretKey: {secretKey}\"\n"
            },
            {
              "language": "ruby",
              "code": "require 'httparty'\n# Create the HTTP objects and post request\nhttp = HTTParty.get(\"https://rtm.imiconnect.io/rtmsAPI/api/v1/apps/{appid}/user/{userid}/threads/{{threadid}}/messages\",\n    :headers => {'Content-Type' => 'application/json',\n\t'secretKey ' => '{secretKey}’})\n# Print on console\nputs http\n\n"
            },
            {
              "language": "javascript",
              "code": "var data = null;\n\nvar xhr = new XMLHttpRequest();\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"GET\", \" https://rtm.imiconnect.io/rtmsAPI/api/v1/apps/{appid}/user/{userid}/threads/{{threadid}}/messages\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\nxhr.setRequestHeader(\"secretKey\", \"{secretKey}\");\nxhr.send(data);"
            },
            {
              "language": "python",
              "code": "import requests\n\nurl = \" https://rtm.imiconnect.io/rtmsAPI/api/v1/apps/{appid}/user/{userid}/threads/{{threadid}}/messages\"\n\nheaders = {'Content-Type': 'application/json', 'secretKey': '{secretKey}'}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)\n"
            }
          ],
          "samples-languages": [
            "curl",
            "ruby",
            "javascript",
            "python"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "content-type",
        "value": "application/json"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true,
  "_id": "6a7c6dbdd82fb949b4e99b69:6a7c6dbdd82fb949b4e99c24"
}
```