Webhooks are a way to receive data to your server (or another service like Zapier).

Webhooks can be sent whenever you receive a new reservation, and every time the "status" of the reservation has changed. This status change can include:

  • Pending

  • Accepted

  • Waiting for payment

  • Cancelled

  • Check-in or check-out date change

  • Number of guest change

Webhooks are sent to the given URL with a POST request. The data is in the request body, encoded in a JSON format.

In PHP for example, you can extract the webhook data as an array with:

$reservation = json_decode(file_get_contents('php://input'), true);  

The webhook will look like this, with the relevant reservation id for your host profile, the guest's profile, and the listing's id.

{
    "user_id": 123457890,
    "code": "HMABCDEF124",
    "channel":"airbnb"
    "start_date": "2017-04-13",
    "end_date": "2017-04-20",
    "nights": 3,
    "guests": 2,
    "status": "accepted",
    "listing": {
        "id": 12346789,
        "name": "Nice and functional private rom",
        "address": "888 Brannan Street, San Francisco, CA 94107",
        "picture_url": "https://a0.muscache.com/im/pictures/1062124560/8127e46f9_original.jpg",
        "lat": -35.8442,
        "lng": 100.98848
    },
    "guest": {
        "id": 12345,
        "first_name": "Pierre",
        "last_name": "Hamana",
        "picture_url": "https://a0.muscache.com/im/users/1234566/profile_pic/344232/original.jpg",
        "location": "Bruxelles, Belgium",
        "phone": "+33 X XX XX XX XX"
    },
    "currency": "USD",
    "security_price": 0,
    "security_price_formatted": "$0",
    "base_price": 171,
    "base_price_formatted": "$171",
    "guest_fee": 27,
    "guest_fee_formatted": "$27",
    "tax_amount": 0,
    "tax_amount_formatted": "$0",
    "extras_price": 23,
    "extras_price_formatted": "$23",
    "subtotal": 194,
    "subtotal_formatted": "$194",
    "total_price": 221,
    "total_price_formatted": "$221",
    "per_night_price": 57,
    "per_night_price_formatted": "$57",
    "payout_price": 187,
    "created_at": 1493416800,
    "updated_at":1494799200,
    "sent_at":1494799210,
}

The confirmation code, provided by the platform, is always identical in relation with the same reservation and can be treated as a unique ID.

If a webhook takes longer than 30 seconds to respond, it is considered a timeout and will be retried. We will resend webhook notifications progressively for up to 24 hours, until the webhook responds with a successful HTTP response code (i.e. ‘2xx’) within 30 seconds.

All webhooks include a "Content-Type: application/json" header in every POST request that is sent to your server. 

Did this answer your question?