Message Center


The Message Center is the place where the buyers and the sellers communicate each other. It is a combination of chat and e-mail, in which you will find correspondence conducted within Allegro, as well as messages from buyers.

You will find more information about the Message Center in Allegro Help.

List of threads

Using GET /messaging/threads you will retrieve list of threads (all correspondence with buyers). You must be logged into a seller account. You will receive 20 threads in the response by default.

To narrow your search list, you can use parameters:

limit - to specify the number of threads on the list (minimum 1, maximum 20),

offset - to indicate the place from which you want to download another portion of data (minimum 0).

For example: GET /messaging/threads?limit=4&offset=5


Sample request:

 curl -X GET \
 'https://api.allegro.pl/messaging/threads' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json'


Click to view sample response:
{
    "threads": [
{ "id": "4lN1A6WTKM8AcfP1bLiumXuJ14Es1fiCguyqRvj3qDf", - thread ID "read": false, - information whether the thread was read "lastMessageDateTime": "2021-07-13T19:53:05.051Z", - last message date "interlocutor": { - interlocutor details "login": "client:44300444", - user login "avatarUrl": - user avatar URL address "https://a.allegroimg.allegro.pl/ovwcolormcolorgreen300/1dbab0/8e6f13624ac8a4fd24764646cd48 " } }, { "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf", "read": false, "lastMessageDateTime": "2021-07-13T19:49:48.899Z", "interlocutor": { "login": "allegrofan", "avatarUrl": "https://a.allegroimg.allegro.pl/ovwcolormcolorteal300/1dbab0/8e6f13624ac8a4fd24764646cd48 " } } ], "offset": 0, "limit": 20 }

Information about a particular thread

Using GET /messaging/threads/{threadId} you will retrieve information about a particular thread. You must be logged into a seller account.


Sample request:

 curl -X GET \
 'https://api.allegro.pl/messaging/threads/dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json'


Click to view sample response:
{
    "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf",  - thread ID
    "read": false,                                        - information whether the thread was read
    "lastMessageDateTime": "2021-07-13T19:49:48.899Z",    - last message date
    "interlocutor": {                                     - interlocutor details
        "login": "allegrofan",                            - user login
        "avatarUrl":                                      - user avatar URL address
        "https://a.allegroimg.allegro.pl/ovwcolormcolorteal300/1dbab0/8e6f13624ac8a4fd24764646cd48 "
    }
}

List of the messages for the particular thread

Using GET /messaging/threads/{threadId}/messages you will retrieve a list of messages in a particular thread with the provided identifier. You must be logged into a seller account. You will receive 20 messages in the response by default.

To narrow your search list, you can use parameters::

  • limit - to specify the number of messages on the list (minimum 1, maximum 20),

  • offset - to indicate the place from which you want to download another portion of data (minimum 0).

For example: GET /messaging/threads/{threadId}/messages?limit=4&offset=5

  • before - to indicate messages created before a specific date,

  • after - to indicate messages created after the specified date.

For example: GET /messaging/threads/{threadId}/messages/?before=2021-07-14T08:00:00.000Z


Sample request:

 curl -X GET \
 'https://api.allegro.pl/messaging/threads/dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf/messages' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json'

Click to view sample response:
{
    "messages": [
        {
            "id": "3793aee2-7fd5-48b0-9de1-cfc804fbf002",   - message ID
            "status": "DELIVERED",                          - message status
            "type": "MESSAGE_CENTER",                       - message type
            "createdAt": "2021-07-13T19:49:48.899Z",        - message creation date
            "thread": {
                "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf" - thread ID
            },
            "author": {                                     - message author
                "login": "allegro",                         - user login
                "isInterlocutor": true                      - information whether the author is an interlocutor
            },
            "text": "What is the release year?",            - message text
            "subject": null,                                - message subject
            "relatesTo": {                                  - message relation
                "offer": {
                    "id": "7680560734"                      - offer ID
                },
                "order": null                               - order ID
            },
            "hasAdditionalAttachments": false,              - does message have additional attachments
            "attachments": []                               - attachments
        },
        {
            "id": "12fe4125-fca9-400a-8363-1739e86fe787",
            "status": "DELIVERED",
            "type": "MESSAGE_CENTER",
            "createdAt": "2021-07-13T19:37:52.571Z",
            "thread": {
                "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf"
            },
            "author": {
                "id": "43544040",
                "isInterlocutor": true
            },
            "text": "Is the phone new?",
            "subject": null,
            "relatesTo": {
                "offer": {
                    "id": "7680560740"
                },
                "order": null
            },
            "hasAdditionalAttachments": false,
            "attachments": []
        }
    ],
    "offset": 0,
    "limit": 20
}
information Note! You can retrieve the thread ID (threadId) from the “threads.id” field via GET /messaging/threads.

Information about a particular message

Using GET /messaging/messages/{messageId} you will retrieve information about a particular message. You must be logged into a seller account.

Sample request:

 curl -X GET \
 'https://api.allegro.pl/messaging/messages/3793aee2-7fd5-48b0-9de1-cfc804fbf002' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json'

Click to view sample response:
{
    "id": "3793aee2-7fd5-48b0-9de1-cfc804fbf002",    - message ID
    "status": "DELIVERED",                           - message status
    "type": "MESSAGE_CENTER",                        - message type
    "createdAt": "2021-07-13T19:49:48.899Z",         - message creation date
    "thread": {
        "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf" - thread ID
    },
    "author": {                                      - message author
        "login": "allegro",                          - user login
        "isInterlocutor": true                       - information whether the author is an interlocutor
    },
    "text": "What is the release year?",             - message text
    "subject": null,                                 - message subject
    "relatesTo": {                                   - message relation 
        "offer": {        
            "id": "7680560734"                       - offer ID
        },
        "order": null                                - order ID
    },
    "hasAdditionalAttachments": false,               - does message have additional attachments
    "attachments": []                                - attachments
}
information Note! You will retrieve a message Id (messageId) from the “messages.id” field, via GET /messaging/threads/{threadId}/messages.

Additionally, using PUT /messaging/threads/{threadId}/read you will mark a particular thread as read (“read”: true). If another message appears in the thread, we will change the field value to “read”: false.

Sample request:

 curl -X PUT \
 'https://api.allegro.pl/messaging/threads/dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf/read' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json' \
 -H 'Content-Type: application/vnd.allegro.public.v1+json' \
 -d '{
 "read": true
 }'

Click to view sample response:
{
    "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf", - thread ID
    "read": true,                                        - information whether the thread was read
    "lastMessageDateTime": "2021-07-13T19:49:48.899Z",   - last message date
    "interlocutor": {                                    - interlocutor details
        "login": "allegrofan",                           - user login
        "avatarUrl":                                     - user avatar URL address 
        "https://a.allegroimg.allegro.pl/ovwcolormcolorteal300/1dbab0/8e6f13624ac8a4fd24764646cd48"
    }
}
information Note! You can retrieve the thread ID (threadId) from the “threads.id” field via GET /messaging/threads.

Add a new message

You can create a new message and send it:

Sample request:

 curl -X POST \
 'https://api.allegro.pl/messaging/messages' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json' \
 -H 'Content-Type: application/vnd.allegro.public.v1+json' \
 -d '{
 "recipient": {
    "login": "allegrofan"
 },
 "text": "Please, call.",
 "attachments": []
 }'

Click to view sample response:
{
    "id": "b58e920b-4d1d-46d1-815a-702311a784c3",    - message ID
    "status": "VERIFYING",                           - message status
    "type": "MESSAGE_CENTER",                        - message type
    "createdAt": "2021-07-13T21:15:26.700Z",         - message creation date
    "thread": {
        "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf" - thread ID
    },
    "author": {                                      - messahge author
        "id": "44190193",                            - user ID
        "isInterlocutor": false                      - information whether the author is an interlocutior
    },
    "text": "Please, call me",                       - message text
    "subject": null,                                 - message subject
    "relatesTo": {                                   - message relation
        "offer": null,                               - offer ID
        "order": null                                - order ID
    },
    "hasAdditionalAttachments": false,               - does message have additional attachments
    "attachments": []                                - attachments
}

Sample request:

 curl -X POST \
 'https://api.allegro.pl /messaging/threads/dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf/messages' \
 -H 'Authorization: Bearer {token}' \  
 -H 'Accept: application/vnd.allegro.public.v1+json' \
 -H 'Content-Type: application/vnd.allegro.public.v1+json' \
 -d '{
 "text": "Hello",
 "attachments": []
 }'

Click to view sample response:
{
    "id": "669a15f6-4f14-4a65-958f-268d628f796f",  - message ID
    "status": "VERIFYING",                         - message status
    "type": "MESSAGE_CENTER",                      - message type
    "createdAt": "2021-07-14T05:03:54.598Z",       - message creation date
    "thread": {
        "id": "dpYCg9auts9xpSojwC6DWPvyVKHraqDCZCiT70j6pcf" - thread ID
    },
    "author": {                                    - message author
        "id": "44190193",                          - user ID
        "isInterlocutor": false                    - information whether the author is an interlocutor
    },
    "text": "Hello",                               - message text
    "subject": null,                               - message subject
    "relatesTo": {                                 - message relation
        "offer": null,                             - offer ID
        "order": null                              - orded ID
    },
    "hasAdditionalAttachments": false,             - does message have additional attachments
    "attachments": []                              - attachments
}
information Note! In the “text” field you can use up to 2000 characters. You can also add an offer number.

Delete a message

Using DELETE /messaging/messages/{messageId} you will delete a selected message. However, keep in mind that the message will still be visible to the recipient.

Sample request:

 curl -X DELETE \
 'https://api.allegro.pl/messaging/meesages/3793aee2-7fd5-48b0-9de1-cfc804fbf002' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json' \

Sample request:

status 204 No Content

Attachments

In our API we provide three resources responsible for managing attachments in Message Center:

information Note! You can only add attachments in .pdf format and image formats such as: gif, bmp, tiff, jpeg, png.

Using GET /messaging/message-attachments/{attachmentId} you will download an attachment from the Message Center.

You will find the “attachmentId” value in the “attachment.url”, field, when you use one of the following resources:

Sample request:

 curl -X GET \
 'https://api.allegro.pl/messaging/message-attachments/97dc0b60-2da4-4247-92ba-b748630ba0f6' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: */*'


Click to view sample response:
{
 …
 "attachments": [
        {
            "fileName": "image.png",            - file name
            "mimeType": "image/png",            - file type
            "url": "https://upload.allegro.pl/message-center/message-attachments/97dc0b60-2da4-4247-92ba-b748630ba0f6 ", - file URL address
            "status": "SAFE"                    - file status
        }
    ]
 …
}

Attachment declaration

Using POST /messaging/message-attachments you will send an attachment declaration and define its size (in bytes) and name. In response you will receive “attachmentId” - an attachment’s identifier.

Sample request:

 curl -X POST \
 'https://api.allegro.pl/messaging/message-attachments' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json' \
 -H 'Content-Type: application/vnd.allegro.public.v1+json' \
 -d '{
 "filename": "image.png",            - file name
 "size": 21876                       - file size
 }'

Sample response:

 { 
    "id": "97dc0b60-2da4-4247-92ba-b748630ba0f6"    - attachment ID
 }

Add an attachment

Use PUT /messaging/message-attachments/{attachmentId} to upload the attachment to our server. Please provide its ID (attachmentId) in your request. You will retrieve the attachment ID with POST /messaging/message-attachments. As content-type, provide the type of file you want to add:

  • image/png,

  • image/gif,

  • image/bmp,

  • image/tiff,

  • image/jpeg,

  • application/pdf.

information Note! You must send the attachment in binary form.

Sample request:

 curl -X PUT \
 'https://api.allegro.pl/messaging/message-attachments/97dc0b60-2da4-4247-92ba-b748630ba0f6' \
 -H 'Authorization: Bearer {token}' \
 -H 'Accept: application/vnd.allegro.public.v1+json' \
 -H 'Content-Type: image/png'

Sample response:

 {
    "id": "97dc0b60-2da4-4247-92ba-b748630ba0f6"
 }

List of resources


You will find full documentation of resources in the swagger.yaml form file here.

List of basic resources used in tutorial::