Create a new chat message in a specified space. The chat can include uploaded file(s). To upload a file with a chat message:

  1. Get the upload URL from /api/files/getuploadurl and note the fileKey value from the response.
  2. Use the fileKey from step one as the fileId in the request body.

URL Parameters

NameDescriptionLocationRequiredDefault Value
spaceIdUnique identifier of the space.pathYes

Body Parameters

NameDescriptionJSON typeRequiredDefault Value
contentObject with task properties.
  • bodyText: (string) message text to send
  • data: (array) array of objects representing attached files
    • fileId: (string) fileKey from /files/getuploadurl
    • fileSize: (int) size of file in bytes
    • fileType: (string) 'image', 'video', 'audio', or (default) 'document'
    • name: (string) file name
    • provider: (string) 'native'
    • providerFileType: (string) MIME type
    • thumbnailFile: (string) fileKey of thumbnail from /files/getuploadurl
objectYes

Authentication

JwtAuthenticator, Oauth2Authenticator, AnonymousAuthenticator

Example Request

URL

POST https://spaces/zang.io/api/spaces/{spaceId}/chats

Headers

Authorization: "jwt eyJhbGciOiJSUzI1NiIsIdfgdfgnR5cCI6IkpXVCJ9.eyJ1c2VyX2lkX3NpZyI6ImxPWHpxNzVzR3J3X0xwWEMyRGRMakhyYXJlWVhyTzFMdEZHZkhkOWNkTXciLCJwcm9kdWN0X3R5cGUiOiJhY2NvdW50cyIsImxhc3R1cGRhdGV0aW1lIjoiMjAxNy0wMS0zMFQxMzo1ODo0Ny4yMDYiLCJpc3MiOiJ6YW5nLmlvIiwicHVibGlja2V5aWQiOiJhZ3h6Zm05dVpYTnVZVEl3TVRSeUdnc1NEVWRLZDNSUWRXSnNhV05MWlhrdfgdWdJQ2dsUEtFakFvTSIsImV4cCI6MTQ5NTM5MTIwMywidXNlcl9pZCI6ImFneHpmbTl1WlhOdVlUSXdNVFJ5RVFzU0JGVnpaWElZZ0lEQXMtX25fUW9NIiwidmVyIjoiMi4wIn0.SqZpw1uPIebqW3qlDsm0-DWYFKEH0SgPwtD-tSESWOF-5hLkZMqJH28ooWux2S7s9riIew7pTVPnZpTgJa5zHcEAG0gXSEJVOqmpGp_4ufM8YtZoZMpBFjyAkwyAt-ILkGUYIo0GU5WyzMPLV8YLXfgdfgOgkE2MGGOajBkjPmC2Db3pA0D0M9k-21EL1gwWBC5YIq0PDAkgulegwl6khRmB8irJQ-dfg-d-KV9eYfFpsCdJKRGzSfqg"

Or

Authorization: "bearer f746696f5de4528u128ae2f274eea253e8a7943a"

Body

{
  "content": {
      "bodyText": "Hello world",
      "data": [{
          "fileId": "80b65d25-d960-4356-ab4d-8b09590efcd0",
          "fileSize": 3239,
          "fileType": "document",
          "icon": "",
          "name": "env2 (1)",
          "provider": "native",
          "providerFileType": ""
      }]              
  }
}

Example Response

{
  "data": [{
      "category": "chat",
      "topicId": "58c97998d56ed915c3d28e32",
      "modified": null,
      "_id": "59038a9be2cda45e3bbbfc6c",
      "content": {
          "bodyText": "Hello world",
          "data": [{
              "provider": "native",
              "providerFileType": "",
              "fileType": "document",
              "name": "env2 (1)",
              "fileId": "80b65d25-d960-4356-ab4d-8b09590efcd0",
              "icon": "",
              "thumbnail": "",
              "keywords": "",
              "description": "",
              "previewFile": "",
              "fileSize": 3239,
              "thumbnailFile": "",
              "metaData": {
                  "stgeProvd": "gcs",
                  "prvwProvd": "gcs",
                  "paging": 0
              },
              "pages": 0,
              "nextSchedule": null,
              "convertStart": null,
              "convertStatus": 0,
              "path": "https://storage.googleapis.com/onesnatesting/logan%2F80b65d25-d960-4356-ab4d-8b09590efcd0?GoogleAccessId=logan-testing@onesnatesting.iam.gserviceaccount.com&Expires=1493404916&Signature=S3c0L2pgEH0ATpEOXxUXPOQyUotS7volgnykoRsaaIfdbGtPToTW5QpOZhI4ZS5OpsyUurS8cB108fbnzEHFFIPtD3vnCsGWebk4G1SS4j5uPTbszsWhsIOyhpecj90AHoupe9lu6rRg9kKKrdyHxqjKGtN7Iy0fZMm%2BIquM8Ku9RHDca7V7%2FVoLTO6kMDeo2o6II7Dy50RqqbduRRcBrBXILbqx%2FrBPhT0Ts9eBse3oqknsgl1dJk%2BMbFBZny5E0C4r6oeKO8Zl1LjR8NnJUAIWXVZCFpe4lfw2jFsIzEwsAbMgc3ejyzkgNqN0HUICJqSN8l9zBo7zU3eypnLlQw%3D%3D&response-content-disposition=attachment%3B%20filename%3D%22env2%20(1)%22"
          }],
          "assignees": []
      },
      "created": "2017-04-28T18:31:55.936Z",
      "sender": {
          "_id": "5890b1243bab0e18ff044943",
          "type": "user",
          "username": "patrickhan@esna.com",
          "displayname": "Patrick-123 Han-han",
          "picture_url": "https://storage.googleapis.com/onesnatesting/pictures/pfpic_user_287f310f-aba5-4879-a18e-247c07c4894a"
      }
  }]
}