POST
/
data_import
/
messages
Import Messages
curl --request POST \
  --url https://{appid}.api-{region}.cometchat.io/v3/data_import/messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '{
  "messages": {
    "3118": {
      "muid": "3118",
      "sender": "s12",
      "receiverType": "user",
      "receiver": "r123",
      "type": "text",
      "category": "message",
      "data": {
        "text": "Hi there,",
        "attachments": [
          {
            "name": "hi.png",
            "extension": "png",
            "size": "350.2",
            "mimeType": "image/png",
            "url": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png"
          }
        ],
        "metadata": {
          "key": "value"
        },
        "custodata": {
          "key": "value"
        }
      },
      "sentAt": "1674104348",
      "deliveredAt": "1674224684",
      "readAt": "1674224684",
      "senderUserDetails": {
        "uid": "s12",
        "name": "user1",
        "avatar": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png",
        "createdAt": "1674228536",
        "metadata": {
          "key": "value"
        }
      },
      "receiverUserDetails": {
        "uid": "r123",
        "name": "superhero",
        "type": "public",
        "description": "Hello group",
        "icon": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png",
        "owner": "superhero1",
        "avatar": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png",
        "createdAt": "1674228536",
        "metadata": {
          "key": "value"
        }
      },
      "tags": [
        "tag1"
      ]
    }
  }
}'
{
  "data": {
    "3117": {
      "success": true,
      "data": {
        "id": "1029",
        "muid": "3117",
        "conversationId": "r123_user_s12",
        "sender": "s12",
        "receiverType": "user",
        "receiver": "r123",
        "category": "message",
        "type": "text",
        "data": {
          "text": "Hi there,",
          "attachments": [
            {
              "name": "hi.png",
              "extension": "png",
              "size": "350.2",
              "mimeType": "image/png",
              "url": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png"
            }
          ],
          "metad2ata": {
            "key": "value"
          },
          "custodata": {
            "key": "value"
          },
          "entities": {
            "sender": {
              "entity": {
                "uid": "s12",
                "name": "user1",
                "avatar": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png",
                "metadata": {
                  "key": "value"
                },
                "status": "offline",
                "role": "default",
                "createdAt": 1674228536,
                "updatedAt": 1674232131
              },
              "entityType": "user"
            },
            "receiver": {
              "entity": {
                "uid": "r123",
                "name": "superhero",
                "avatar": "https://data-eu.cometchat.io/assets/images/avatars/ironman.png",
                "metadata": {
                  "key": "value"
                },
                "status": "offline",
                "role": "default",
                "createdAt": 1674228536,
                "updatedAt": 1674232131,
                "conversationId": "r123_user_s12"
              },
              "entityType": "user"
            }
          }
        },
        "sentAt": 1674104348,
        "deliveredAt": 1674224684,
        "readAt": 1674224684,
        "updatedAt": 1674104348,
        "tags": [
          "tag1"
        ]
      }
    }
  }
}

Authorizations

apikey
string
header
required

API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).

Body

application/json

Response

200 - application/json

Import Message(s)

The response is of type object.