Get messages by thread ID

Get all messages in a thread with /get_messages.

Before you start

You'll need:

Request

HTTP request

POST https://chat.booking.com/3/get_messages

Request body

{
  "thread": {
    "auth": "{AuthorisationToken}",
    "id": "{ThreadID}",
    "type": "Contextual"
  }
}

See Messaging API reference for details.

Response

{
  "messages": [
    {
      "fallback": "https://www.booking.com/error404.html?chat_fallback=1&message_id=22bd9d22-901d-11e8-a66e-e79f7cbde734",
      "message": {
        "client_info": {
          "gr_card": {
            "gr_id": "222956f8-901d-11e8-a66e-e79f7cbde734",
            "seq": "1"
          },
          "guest_request_params": {
            "request_tag": "type:special request",
            "request_text": "I would like to know if this works or not",
            "room_reservation_ids": [],
            "source": "my_booking"
          }
        },
        "in_reply_to": "21568d2c-901d-11e8-8a06-25aba34cc342",
        "metadata": {
          "send_no_email": 0
        },
        "prediction": null,
        "quoted_text": "I would like to know if this works or not",
        "quoted_text_sender": {
          "id": "0d859899bdd2ac28",
          "name": "Guest V0 request",
          "type": "Guestv0",
          "type_name": "Guest V0 request"
        },
        "reply_groups": [],
        "reply_options": [
          {
            "button_template": {
              "params": {
                "filter": [
                  "special_request"
                ],
                "reservation_id": "1749196622",
                "type": "quick_reply"
              },
              "template_id": 567
            },
            "caption": "Yes, we can arrange this free of charge",
            "client_info": {
              "partner_messaging": {
                "gr_card": {
                  "gr_id": "222956f8-901d-11e8-a66e-e79f7cbde734",
                  "seq": "2"
                }
              }
            },
            "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YfWzNmFJb-yyIb4ijf42MHy9xd2ZQliG_Q2WqErnb2K-PHZTyN9Vz9_Og3lUqn0bisvQUqGZZ_WcoZnNi8FXx-I6CD157mQtuNsrFGhcnQoJzbTUaD37TFNlJTZOMCTRiQO3pGNOun2G59b3PsCV_pClMQ4rEtXddA",
            "generated_by_node": "send_request_to_property",
            "image_urls": [],
            "input_value": "",
            "mandatory": 0,
            "name": "resolution",
            "options": [
              {
                "button_template": {
                  "params": {
                    "filter": [],
                    "reservation_id": "1749196622",
                    "type": "quick_reply"
                  },
                  "template_id": 399
                },
                "caption": "Additional information:",
                "client_info": {},
                "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YfWzNmFJb-yyIb4ijf42MHy9xd2ZQliG_Q2WqErnb2K-PHZTyN9Vz9_Og3lUqn0bisvQUqGZZ_WcoZnNi8FXx-I6CD157mQtuNsrFGhcnQoJzbTUaD37TFNlJTZOMCTRiQO3pGNOun2G59b3PsCV_pClMQ4rEtXddA",
                "generated_by_node": "send_request_to_property",
                "image_urls": [],
                "input_value": "",
                "mandatory": 0,
                "name": "comment",
                "options": [],
                "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YY5FvHuP9VsoaNzxBfjLmQ1SJgEl1XlqJ4soc-yZ1J2azych_YrJtsIb5eCPyv8LlDqjXf4xKEXpiTzQb_NXCk-PrXBv4KBDY_5FYJoOlv4xGtZHrJO3s-BF8L_HEIjR3yk-fZFy2G_XPvHfPPTVzLe68fcWngwx2A",
                "payload": "",
                "type": "PlainText"
              }
            ],
            "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YY5FvHuP9VsoaNzxBfjLmQ1SJgEl1XlqJ4soc-yZ1J2azych_YrJtsIb5eCPyv8LlDqjXf4xKEXpiTzQb_NXCk-PrXBv4KBDY_5FYJoOlv4xGtZHrJO3s-BF8L_HEIjR3yk-fZFy2G_XPvHfPPTVzLe68fcWngwx2A",
            "payload": "confirm",
            "type": "button"
          },
          // More reply options (if any).
        ],
        "selected_options": [],
        "text": "I have a special request.",
        "type": "ContextualMessage"
      },
      "message_id": "22bd9d22-901d-11e8-a66e-e79f7cbde734",
      "recipient": {
        "id": "b855ff916919cd8b",
        "images": {},
        "name": "Demo Hotel for Automated Testing 1000003 (Do not Touch)",
        "type": "Hotel",
        "type_name": "Property"
      },
      "sender": {
        "id": "db703eb009b71b32",
        "name": "Booking Assistant",
        "type": "Bot",
        "type_name": "Booking Assistant"
      },
      "thread_id": "4254059d-c32c-451a-9a98-da9243ab9db9",
      "time": 1532531544,
      "unread": true
    },
    // More messages (if any).
  ],
  "pages": {
    "after": "page-7670a4a4-901e-11e8-94fe-68b44dbc8d2e"
  },
  "poll_delay": 5,
  "thread": {
    "context_data": {
      "hotelreservation_id": "111111111"
    },
    "id": "4254059d-c32c-451a-9a98-da9243a",
    "readonly": false,
    "status": "closed",
    "topic": "special_request_special",
    "type": "Contextual"
  }
}

See Messaging API reference for details.

Parsing the response

Depending on who sent a message, you will find its content (i.e. text and any attached images) in different fields:

Sender Message text Attached images
Guest message.text message.images
Property message.selected_options[n].input_value message.selected_options[n].image_urls

For more details about the response body, see the Messaging API reference.

Next steps