Send a message to the guest of a booking
/api/v1/bookings/{booking_id}/messagesmessages.writeSends the text right away, the way the ZenHost inbox does, and answers once it is sent. platform writes on the messaging of the Sales Channel of the booking; email and sms use the guest contact details ZenHost holds. The message is attributed to your App: the host sees "Sent by" and the name of your App in the inbox.
To attach photos, send the same fields as multipart/form-data with up to 5 photos parts (JPEG, PNG, WebP or AVIF, 10 MB each), on platform only; email and SMS answer validation_failed. In practice a whole call stays under about 4.5 MB (see below). The text and each photo reach the guest as separate messages, the way the ZenHost inbox sends them: the answer is the text message, and GET /bookings/{booking_id}/messages lists the photo messages right after it, with their files. Once the text has reached the guest, the request answers 201 with it even if a photo was refused or its fate is unknown: check that list for the photos before sending them again. Whatever these limits, the hosting platform refuses a request body above 4.5 MB with a 413 that is not the JSON error of the API: send fewer or smaller photos per call.
**SMS are billed to the host**, €0.10 per segment, on their ZenHost subscription. When the subscription cannot be billed, the request answers sms_billing_unavailable: nothing is sent and nothing is billed.
Refusals known before sending answer 422 and send nothing: channel_unavailable (the chosen channel cannot reach the guest, try another one: on platform, the Sales Channel of the booking has no messaging, no conversation exists there yet, or the host must restore their connection to it; on email, the account has no sending address), missing_guest_contact (no email or phone for the chosen channel; a platform relay address such as @guest.booking.com counts as no email). When the send fails, delivery_failed tells in details.delivery_outcome whether the message certainly did not leave (not_sent: safe to send again) or its fate is unknown (unknown: check GET /bookings/{booking_id}/messages before sending again).
For Zenny, a message from your App is a reply of the host: a reply Zenny was preparing for this conversation is dropped, and a conversation Zenny handed over to the host is released. Your message never becomes Knowledge. A booking outside the Connection Scope answers not_found, exactly like a missing one. Counts against the send rate limit.
Paramètres
Paramètres de chemin
booking_idstring (uuid)obligatoireBooking id.
En-têtes
Idempotency-KeystringReplaying the same key on the same App Connection within 24 hours answers what the first request did (the same message, or the same refusal) and sends nothing new. Reusing it with a different body answers
idempotency_key_reused; while the first request is still sending,idempotency_key_in_use.au plus 255 caractères
Corps de la requête
application/jsonSendMessageRequest
A text to the guest of the booking.
channelstringobligatoireplatformis the messaging of the Sales Channel of the booking (Airbnb, Booking.com…);emailandsmsreach the guest contact details ZenHost holds.Parmi :
platformemailsmstextstringobligatoireThe message. Shortcodes require their corresponding read permission, including nested custom values: bookings.read (plus prices.read for amounts), guests.read, properties.read for title/currency, property_guide.read for guide/custom values, or lock_codes.read. Missing permission refuses the send with forbidden_permission. Portal credentials and invoice/payment links cannot be expanded by Apps.
au plus 10000 caractères
subjectstringEmail only. Shortcodes follow the same read-permission checks as the text. Without it, the email takes the name of the Property.
au plus 255 caractères
Réponses
201The message, sent.
application/jsonMessage
idstring (uuid)obligatoiredirectionstringobligatoireinboundfrom the guest,outboundto the guest.Parmi :
inboundoutboundauthorMessageAuthorobligatoireWho wrote the message. Never carries a guest email or phone, nor the name of the team member.
Afficher 2 attributs enfantsMasquer les attributs enfants
typestringobligatoireguest(inbound),host(the host or a team member),zenny(written by Zenny, the ZenHost assistant),automation(a Scheduled Message) orapp(an App, seeapp_name). Version 1 may add values.Parmi :
guesthostzennyautomationappapp_namestringName of the App that sent the message, when
typeisapp.
channelstringobligatoireplatformis the messaging of the Sales Channel of the booking (Airbnb, Booking.com…). Version 1 may add values.Parmi :
platformemailsmstextstringobligatoiresubjectstring | nullobligatoireEmail subject.
attachmentsMessageAttachment[]obligatoireAfficher 5 attributs enfantsMasquer les attributs enfants
indexintegerobligatoirePosition of the file in the message, as in the download URL. Files that cannot be downloaded are left out, so indexes may skip.
min 0
typestringobligatoireOnly images in version 1; other types may be added.
Parmi :
imagefile_namestring | nullobligatoirecontent_typestring | nullobligatoireMIME type when known; the download answers with the actual one.
urlstring (uri)obligatoireDownload URL of the file. Call it with the access token of the App Connection, like any other endpoint.
delivery_statusstringobligatoirereceivedfor an inbound message. For an outbound one:pendingwhile it is not confirmed sent (in flight, or its fate is not known yet),sent, orrejectedwhen it did not reach the guest: the Sales Channel refused it, or its send failed or stayed unconfirmed for a minute, as the ZenHost inbox shows it. Version 1 may add values.Parmi :
receivedpendingsentrejectedsent_atstring (date-time)obligatoirecreated_atstring (date-time)obligatoireWhen ZenHost recorded the message; the list is sorted on it.
401Error code: unauthorized, connection_revoked.
Codes d’erreur
unauthorizedLe jeton d’accès est absent, inconnu, expiré ou révoqué, ou a été émis avant que le compte ne reconnecte l’App. Rafraîchissez-le ; si le rafraîchissement échoue, demandez au propriétaire de reconnecter l’App.connection_revokedLe propriétaire a révoqué la connexion d’App (ou votre App a révoqué son propre jeton de rafraîchissement). Cessez les appels pour ce compte et supprimez ses jetons.
402Error code: subscription_blocked.
Codes d’erreur
subscription_blockedL’abonnement ZenHost du compte est bloqué (impayé, résilié…). La connexion est conservée : prévenez votre client, les appels refonctionnent dès que l’abonnement est rétabli.
403Error code: app_suspended, forbidden_permission.
Codes d’erreur
app_suspendedZenHost a suspendu votre App, ou ne l’autorise plus sur ce compte. Cessez les appels et contactez ZenHost.forbidden_permissionVotre App n’a pas reçu la permission que cet endpoint exige.
404Error code: not_found.
Codes d’erreur
not_foundLa ressource n’existe pas ou est hors du périmètre de connexion (les deux cas sont indiscernables), ou le chemin n’est pas un endpoint de/api/v1.
409Error code: idempotency_key_in_use.
Codes d’erreur
idempotency_key_in_useUne requête avec cetteIdempotency-Keyest encore en cours de traitement. Réessayez dans quelques secondes pour obtenir sa réponse.
422Error code: validation_failed, idempotency_key_reused, channel_unavailable, missing_guest_contact, sms_billing_unavailable.
Codes d’erreur
validation_failedLa requête, les en-têtes ou le corps sont invalides ;details.issuesdésigne chaque problème (path,message, etmaximumquand une valeur ou une liste est trop grande).idempotency_key_reusedCetteIdempotency-Keya déjà été utilisée sur cette connexion d’App avec un autre corps.channel_unavailableLe canal choisi ne peut pas joindre le voyageur de cette réservation. Surplatform: le canal de vente n’a pas de messagerie pour elle, aucune conversation n’y existe encore, ou l’hôte doit rétablir sa connexion. Suremail: le compte n’a pas d’adresse d’envoi. Rien n’a été envoyé ; essayez un autre canal.missing_guest_contactLe voyageur de cette réservation n’a pas d’adresse email (pouremail) ou de numéro de téléphone (poursms). Rien n’a été envoyé.sms_billing_unavailableL’abonnement ZenHost du compte ne permet pas de facturer le SMS. Rien n’a été envoyé ni facturé ; utilisez un autre canal.
429Error code: rate_limited.
En-tête Retry-After — Seconds to wait before the next call is allowed. Limits per App Connection: 60 reads (GET), 10 writes (other POST) and 30 messages sent to guests per minute.
Codes d’erreur
rate_limitedTrop d’appels sur cette connexion d’App. Attendez le nombre de secondes indiqué dansRetry-After.
500Error code: internal_error.
Codes d’erreur
internal_errorZenHost n’a pas pu répondre. Réessayez plus tard avec un délai croissant.
502Error code: delivery_failed.
Codes d’erreur
delivery_failedLe message n’a pas pu être distribué.details.delivery_outcomevautnot_sents’il n’est sûrement pas parti (vous pouvez l’envoyer à nouveau) ouunknownsi son sort est inconnu (relisez les messages de la réservation avant de l’envoyer à nouveau).