Last updated

Messaging API quick guide

If you're a Managed Affiliate Partner enrolled in the early access pilot, you can start testing the Messaging API in your application today.


This guide walks you through realistic messaging scenarios using our dedicated test hotel—complete with automated replies.

⏱️ Estimated time to complete: 15 - 30 minutes

  • Purpose: Quickly try out the Messaging API in sandbox.
  • When to use: You want to test post-booking communication flows.
  • You´ll learn how to:
    1. Trigger auto-replies after a test booking.
    2. Send and receive messages.
    3. Test how special requests are handled.
  • Code samples: Minimal, only required fields.

Before you start

Before you start, make sure you:

You’ll need:

✓ A valid API key token.
✓ Your X-Affiliate-Id.
✓ Access to the sandbox environment.

Every Messaging API request must be authenticated using your Demand API v3.1 credentials.


Test setup

✓ Test accommodation ID 13921698 - Demand API Messaging Test Hotel

The Messaging Test Hotel is configured with automated replies:

  • Welcome message when booking is confirmed.
  • Reminder before check-in and checkout.
  • Special request rejection (if remarks.special_requests is set).

Note: That auto-replies use Booking.com’s extranet messaging centre, not the API itself.

End-to end flow

Here’s a simple flow on how messaging works:

Messaging-basic-flow

Use case 1 - Booking and welcome message

Follow these steps to test an initial communication flow with the following actions:

ParticipantsAction
Traveller (guest)
  1. Creates a test order in the Demand API Messaging Test Hotel via Demand API orders endpoints.
Accommodation (property)
  1. Receives a confirmation of the booking in Booking.com extranet messaging centre - A welcome message is automatically sent via Messaging Api.

Step 1 - Create a test order

Make a reservation at the Demand API Messaging Test Hotel (ID 13921698) using the /orders/preview and orders/create endpoints.

Important

Use a valid credit card in payment field as recommended in the Testing payments section.

When successful, the orders/create response includes:

{
  "data": {
    "accommodation": {
      "reservation": 55303962,
      "order": "5006302528200239",
      "pincode": "884512"
    }
  }
}

reservation → Use this id to fetch and send messages.

Resources

Step 2 - Auto-reply welcome message

As the reservation has been confirmed in the Demand API Messaging Test Hotel, the guest receives an automatic welcome message in the provided email.

  • By default, it automatically starts a new conversation, which is identified by a conversation id in Messaging API and tied to the reservation id.

Example of send/message request:

{
    "reservation": "55303962",
    "conversation": "55555",
    "accommodation": "13921698",
    "content": "Hello Ada Smith, Thanks for booking at Demand API Test Hotel! We are happy to see you on Thursday 22 August 2025"
}

When successfully sent, it generates a message_id that identifies the welcome message.

{
    "request_id": "cdb0b154-2eae-481b-8fee-fb2725296e1f",
    "data": {
        "message_id": "3164e570-19e0-11f0-baca-e5019c8df435",
    }
}

Try it yourself

Demand API Messaging Test Hotel has set all its auto-replies via Booking.com extranet messaging centre, from where it can directly handle this conversation with the guest:

Booking.com Extranet showing auto-reply welcome message

Accommodation hosts can use Booking.com extranet messaging center or any other channel to communicate with guests, depending on your system and integration preferences.

Step 3 - Send a reply

Use messages/send to respond to the accommodation:

{
  "reservation": "55303962",
  "conversation": "55555",
  "accommodation": 13921698,
  "content": "Thanks, looking forward to my stay!"
}

Success response:

{
  "data": {
    "message_id": "41a53b20-1a0d-11f0-baca-e5019c8df435"
  }
}

Use case 2 - Booking with a special request

Follow these steps to test the communication flow with the following actions:

ParticipantsAction
Traveller
  1. Creates a test order in the Demand API Messaging Test Hotel and sends a special request.

Accommodation

  1. Receives:
  • Confirmation of the booking with special request.
  1. Auto-reply:
  • Rejection to special request.

Step 1 - Create a test order with special request

Create a reservation at the Demand API Messaging Test Hotel (ID 13921698) using the /orders/preview and orders/create endpoints.

  • Specify in the request:
    • payment - Use a valid credit card as recommended in the Testing payments section.
    • Guests details - Include guests allocation and details such as complete name and email where messages will be sent.
    • special_requests under remarks field, in this case requesting an extra bed.

Example:

"remarks": {
        "estimated_arrival_time": {
          "hour": 12
        },
        "special_requests": "I would need an extra bed in the room. Is this possible? Thanks"
      }

Step 2 - Accommodation receives message

The accommodation host receive the request in this case via Booking.com Extranet messages center, where the Demand API Messaging Test Hotel has a pre-defined rejection reply that is automatically sent to the guest.

special request

Example of the automatic rejection message sent to the guest email:

rejected request

Step 3 - Guest receives rejection message

The guest receives the rejection message directly to the provided email (or registered app).

In this example, the guest has a Booking.com authenticated email and can access the full list of messages, and different conversations from the Booking.com platform.

messages guest


Troubleshooting

Not seeing auto-replies?

  • Confirm you’re using hotel ID 13921698 in sandbox.

  • Make sure the special_requests field includes a scenario that triggers an auto-reply.

  • Check guest email inbox or Booking.com account for the message.

Next steps

  • Integrate /messages/latest and /messages/confirm polling into your workflow.
  • Use /conversations to display history to agents or travellers.
  • Handle guest replies programmatically.
  • Monitor message delivery and failures.

Resources

Read the following guidelines to get familiar with the Messaging API: