Messages

The laets Marketplace solution provides a message based communication through its API. Messages can be sent and read by accessing the user’s inbox and outbox.


Merchant Inbox Message

The merchant accesses to his inbox massages with the following request:

  
  GET  {{api_url}}/v1/merchant/{{MERCHANT_ID}}/inbox/

with the following response sample:

  
  {
    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
    },
    "objects": [
        {
            "application": {
                "id": 75,
                "pk": 75,
                "resource_uri": "https://api.sandbox.iceberg.technology/v1/application/75/"
            },
            "body": "Bonjour,<br><br>Pour la commande n°171106, le client a fait une demande de facture.<br>Pourriez-vous lui mettre à disposition.<br>",
            "body_raw": "Bonjour,\n\nPour la commande n°171106, le client a fait une demande de facture.\nPourriez-vous lui mettre à disposition.\",
            "from_display_name": "Romain Durant",
            "from_email": null,
            "from_location": null,
            "from_phone_number": null,
            "from_resource_uri": "/v1/user/2953/",
            "id": 5860,
            "merchant_order": {
                "id": 42989,
                "resource_uri": "https://api.sandbox.iceberg.technology/v1/merchant_order/4299/",
                "type": "merchant_order"
            },
            "parent_msg": null,
            "priority": 3,
            "quote": null,
            "receiver": {
                "id": "9770",
                "resource_uri": "/v1/merchant/977/",
                "to_display_name": "[977] MarchnadName"
            },
            "resource_uri": "https://api.sandbox.iceberg.technology/v1/message/586/",
            "response_mail_proxy": "",
            "sender": {
                "from_display_name": "Romain Durant",
                "id": "29583",
                "resource_uri": "/v1/user/2953/"
            },
            "sent_at": "2017-11-06T11:23:41+01:00",
            "starred": false,
            "status": "unread",
            "status_localized": "Non lu",
            "subject": "Objet : demande de facture 171106V1330390",
            "to_display_name": "[977] Marchnt 1",
            "to_resource_uri": "/v1/merchant/977/"
        }

      ]

  }

The following call is used to mark a message as read:

  
  POST {{api_url}}/v1/message/{{MESSAGE_ID}}/read/

with an empty body.


Send a message

A merchant can send a message to the operator or to a buyer with the following request:

  
  POST {{api_url}}/v1/message/

with the body:

 
   {
    "sender":{
        "id": {{MERCHANT_ID}},
        "resource_uri":"/v1/merchant/{{MERCHANT_ID}}/"
    },
    "receiver":{
        "id": {{ENTITY_ID}},
        "resource_uri":"/v1/{{entity}}/{{ENTITY_ID}}/"
    },
    "merchant_order": "/v1/merchant_order/{{MERCHANT_ORDER_ID}}/",
    "subject":"Message subject",
    "body":"This is the body of the message"
  }

where:

  • MERCHANT_ID: the id of the merchant
  • ENTITY_ID: the entity of the recipient: application or user
  • MERCHANT_ORDER_ID: (optional) the related merchant order id