Use case 2 - Send request & handle rejection
This use case demonstrates how to send a special request to the accommodation and retrieve the automatic rejection message programmatically.
Scenario: A guest requests an extra bed at the Messaging Test Hotel (ID 13921698). The system automatically sends a predefined rejection message, which the partner retrieves via the Messaging API.
Workflow steps
This workflow has 4 steps:
1. Send the request message.
2. Accommodation receives the message.
3. Guest receives the rejection.
4. Poll latest messages programmatically.
Step 1 - Send the request message
Use messages/send to send a message to the accommodation:
{
"reservation": "6066547158",
"accommodation": "13921698",
"content": "I would need an extra bed in the room, is this possible? Thanks"
}
When successful, the response includes a message
id that identifies the sent message:
{
"data": {
"message": "ce18cdf0-8fb5-11f0-9aad-81db133940ac"
},
"request_id": "6483bacb-41a6-4f18-8747-9f04f40f2f45"
}
Step 2 - Accommodation receives the message
The accommodation host receives the request via the Booking.com Extranet messaging centre.
Since the Demand API Messaging Test Hotel has a pre-defined rejection for extra bed requests, an automatic rejection message is generated.
Example of the automatic rejection message:
Step 3 - Guest receives rejection
The guest receives the rejection message in their email or registered app.
If the guest has a Booking.com account, they can also access the full conversation history in the Booking.com platform.
Step 4 - Poll latest messages programmatically
To retrieve the rejection message without manually checking the guest’s inbox, use the /messages/latest endpoint endpoint.
See Use case 1 - Step 2 for more details.
Next steps
After completing these workflows, you can:
- Integrate automated responses into your system.
- Monitor conversations and ensure all messages are confirmed.
- Explore advanced features such as attachments and conversation history.
- Read the Manage attachments guide to learn how to send and download images.
- Review Messaging best practices to align your messaging flows.
- Check the Messaging troubleshooting guide for help with error resolution.