Send message to guest

Use /post_message to send messages. Depending on the situation, the request body needs different content. The examples below cover these situations:

Before you start

You'll need:

Note:

A message can be sent to the guest before stay, during stay and after stay. However, there are some limitations when sending a message after stay. A message can be sent up until 7 days after checkout or 14 days after the last message was received.


Send a new message

This example shows how to send a new message that is not a reply to a guest's previous message or special request.

HTTP request

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

Request body

As with all messages, the request body must contain selected_options. But unlike when you reply to an existing message, you cannot take reply_options from the previous message. Instead, copy what you need from the example below:

{
  "message": {
    "command": "/start",
    "command_params": {
      "entry_point": "hotel_free_text_to_guest",
      "hotelreservation_id": "{{ReservationID}}"
    },
    "reply_options": [],
    "selected_options": [
      { // Example plain text message.
        "input_value": "Please find attached two vouchers for a free meal in our restaurant!",
        "type": "PlainText"
      },
      { // Example image attachments. Remove if not needed.
        "image_urls": [
          "https://example.com/voucher-1.jpg",
          "https://example.com/voucher-2.jpg"
        ],
        "name": "attachment",
        "type": "AttachmentImages"
      }
    ],
    "type": "ContextualMessage"
  },
  "thread": {
    "auth": "{{MessagingAPIAuthToken}}",
    "id": "{{ThreadID}}", // Mandatory field.
    "type": "Contextual"
  }
}

Note: Thread ID is always mandatory. It indicates the thread you want to post a message on.

See Messaging API reference for details.

Response body

{
  "message_id": "{{NewMessageID}}",
  "thread_id": "{{ThreadID}}"
}

See Messaging API reference for details.


Reply to a text message

This example shows how to reply to a guest message that is not a special request.

HTTP request

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

Request body

{
  "message": {
    "type": "ContextualMessage",
    "in_reply_to": "{{PreviousMessageID}}",
    "selected_options": [
      {
        "button_template": {
          "params": {
            "filter": [],
            "reservation_id": "{{ReservationID}}",
            "type": "quick_reply"
          },
          "template_id": 465
        },
        "caption": "Reply to this message",
        "client_info": {},
        "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YWvxIL58qIFMXfA7G3vomO_TigwDEb0OpE-FSQZHAKjLJ9PBizVp6GZb1Lz5YYYh9dI2ZzThc_8cIK0F16dOrqkkIYDA2aueo0AoxXvtKvjioqIjKpCeaHSzoSKIfJl7eZ-zSqKHMwjZXxO3pA_mpACVs-1Md4pR1w",
        "generated_by_node": "send_to_property",
        "image_urls": [],
        "input_value": "Yes, there is a pharmacy next door.",
        "mandatory": 1,
        "name": "property_response",
        "options": [],
        "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YcTn1V1eOUWhUK7BOyiLtMYjNIBApJSLcCBwNe6OW_PusBhWlt47TdEn4TgM-gZVM6HUBwBajSdA1uOMwm1RdOXJzSohPOOQ-Nb9CXkIGt_xJHt8cHv2WxHRHssti12diM3gbIi24jp1BNzvxVjW6rwW1XUud72nSQ",
        "payload": "",
        "presentation": "",
        "type": "PlainText"
      }
    ],
  },
  "thread": {
    "auth": "{{MessagingAPIAuthToken}}",
    "id": "{{ThreadID}}",
    "type": "Contextual"
  }
}

See Messaging API reference for details.

Response body

{
    "message_id": "{{NewMessageID}}",
    "thread_id": "{{ThreadID}}"
}

See Messaging API reference for details.


Reply to a special request

This example shows how to reply to a special request. We provide a fixed set of reply options for special requests, which you can render as buttons in your UI.

HTTP request

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

Request body

{
  "message": {
    "type": "ContextualMessage",
    "in_reply_to": "{{PreviousMessageID}}",
    "selected_options": [{
      "button_template": {
        "params": {
          "filter": [],
          "reservation_id": "{{ReservationID}}",
          "type": "quick_reply"
        },
        "template_id": 455
      },
      "caption": "Yes, we can arrange this at an extra charge",
      "client_info": {
        "partner_messaging": {
          "gr_card": {
            "gr_id": "7c238d40-c583-11e8-ad3d-6ce28058fe8c",
            "seq": "2"
          }
        }
      },
      "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YYyfTJZ2yHSGZf_whz8DAoGA_ea5njQkicbR7sAhdtKC9m1Iw39C8Gg_9VGvBk9GSMeWf84EWHbohYQBz_AEIjcUKnufDKz-fYXfHmtPri97n2cTtYUrfXjHzFvAvPMiKiWkIaXOaQ5VLm1ZpB0By9o1Y9xl9QGkJw",
      "generated_by_node": "send_request_to_property",
      "image_urls": [],
      "input_value": "",
      "mandatory": 0,
      "name": "resolution",
      "options": [
      ],
      "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YWHfUBKADC8q54FpwkMcrhunFNQuKBRe9ya5Ee945JIiu00JLUXpoE-hq-1BTbSwjT0DCEhEuBJvLqdC2uUWPkY5GL-p3ER7y0-RtlmF3UCR6F9za_XBgFHlIBKaqMlL-x1i2IBOIWzHdXk-1zH0tw7_S81nUiXkcw",
      "payload": "with_charges",
      "presentation": "",
      "type": "button"
    },
    {
          "button_template": {
            "params": {
              "currency": "EUR",
              "filter": [],
              "reservation_id": "{{ReservationID}}",
              "type": "quick_reply"
            },
            "template_id": 511
          },
          "caption": "Total cost (for entire stay), in EUR",
          "client_info": {},
          "currency": "EUR",
          "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YYyfTJZ2yHSGZf_whz8DAoGA_ea5njQkicbR7sAhdtKC9m1Iw39C8Gg_9VGvBk9GSMeWf84EWHbohYQBz_AEIjcUKnufDKz-fYXfHmtPri97n2cTtYUrfXjHzFvAvPMiKiWkIaXOaQ5VLm1ZpB0By9o1Y9xl9QGkJw",
          "generated_by_node": "send_request_to_property",
          "image_urls": [],
          "input_value": "125",
          "mandatory": 1,
          "name": "cost",
          "options": [],
          "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YWHfUBKADC8q54FpwkMcrhunFNQuKBRe9ya5Ee945JIiu00JLUXpoE-hq-1BTbSwjT0DCEhEuBJvLqdC2uUWPkY5GL-p3ER7y0-RtlmF3UCR6F9za_XBgFHlIBKaqMlL-x1i2IBOIWzHdXk-1zH0tw7_S81nUiXkcw",
          "payload": "",
          "presentation": "",
          "type": "Cost"
        },
        {
          "button_template": {
            "params": {
              "filter": [],
              "reservation_id": "{{ReservationID}}",
              "type": "quick_reply"
            },
            "template_id": 399
          },
          "caption": "Additional information:",
          "client_info": {},
          "entry_point_fingerprint": "UmFuZG9tSVYkc2RlIyh9YYyfTJZ2yHSGZf_whz8DAoGA_ea5njQkicbR7sAhdtKC9m1Iw39C8Gg_9VGvBk9GSMeWf84EWHbohYQBz_AEIjcUKnufDKz-fYXfHmtPri97n2cTtYUrfXjHzFvAvPMiKiWkIaXOaQ5VLm1ZpB0By9o1Y9xl9QGkJw",
          "generated_by_node": "send_request_to_property",
          "image_urls": [],
          "input_value": "Sorry!",
          "mandatory": 0,
          "name": "comment",
          "options": [],
          "parent_fingerprint": "UmFuZG9tSVYkc2RlIyh9YWHfUBKADC8q54FpwkMcrhunFNQuKBRe9ya5Ee945JIiu00JLUXpoE-hq-1BTbSwjT0DCEhEuBJvLqdC2uUWPkY5GL-p3ER7y0-RtlmF3UCR6F9za_XBgFHlIBKaqMlL-x1i2IBOIWzHdXk-1zH0tw7_S81nUiXkcw",
          "payload": "",
          "presentation": "",
          "type": "PlainText"
        }
    ],
  },
  "thread": {
    "auth": "{{MessagingAPIAuthToken}}",
    "id": "{{ThreadID}}",
    "type": "Contextual"
  }
}

See Messaging API reference for details.

Response body

{
    "message_id": "{{NewMessageID}}",
    "thread_id": "{{ThreadID}}"
}

See Messaging API reference for details.


Next steps