Menu/message-threads

List the Message Threads of the Connection Scope

GET/api/v1/message-threads
Nécessite messages.read

One conversation per booking that has at least one message, on the Properties of the Connection Scope, latest message first and paged with next_cursor. Each gives the booking, its Property and Sales Channel, a preview of the latest message GET /bookings/{booking_id}/messages lists (a Scheduled Message not sent yet is left out) and its author, the number of unread messages and whether the conversation is closed.

The author never carries the guest email or phone: those stay under guests.read on GET /bookings. The preview is the message text as written, so it holds whatever the guest or the host typed.

Incremental sync: read every page, keep next_updated_since, and pass it as updated_since next time. A new message, a message read or unread in ZenHost, or a closed or reopened conversation brings the thread back. A thread whose latest message changes while you page through may move ahead of your cursor: the next poll returns it. Some threads may come twice: upsert them by booking_id.

Paramètres

Paramètres de requête

  • property_id[]string (uuid)[]

    Only these Properties (repeat the parameter, at most 100). Each must be in the Connection Scope. Leave it out to list the whole Connection Scope, page by page.

    au plus 100 éléments

  • updated_sincestring (date-time)

    Only Message Threads changed at or after this instant. Use next_updated_since of your previous listing.

  • cursorstring

    next_cursor of the previous page.

  • limitinteger

    Page size.

    min 1 · max 500 · par défaut 100

Réponses

200One page of Message Threads.

application/jsonMessageThreadList

  • dataMessageThread[]obligatoire
    Afficher 7 attributs enfants
    • booking_idstring (uuid)obligatoire

      The booking of the conversation; a booking has at most one Message Thread.

    • property_idstring (uuid)obligatoire
    • sales_channelobjectobligatoire

      Where the booking was made.

      Afficher 2 attributs enfants
      • codestringobligatoire

        direct, website, other, or the Sales Channel shortcode, as on GET /bookings.

      • namestringobligatoire
    • latest_messageLatestMessageobligatoire

      The latest message of the conversation.

      Afficher 5 attributs enfants
      • idstring (uuid)obligatoire
      • previewstringobligatoire

        First 200 characters of the message text.

      • authorMessageAuthorobligatoire

        Who wrote the message. Never carries a guest email or phone, nor the name of the team member.

        Afficher 2 attributs enfants
        • typestringobligatoire

          guest (inbound), host (the host or a team member), zenny (written by Zenny, the ZenHost assistant), automation (a Scheduled Message) or app (an App, see app_name). Version 1 may add values.

          Parmi : guest host zenny automation app

        • app_namestring

          Name of the App that sent the message, when type is app.

      • created_atstring (date-time)obligatoire
      • attachments_countintegerobligatoire

        min 0

    • unread_countintegerobligatoire

      Messages of the conversation not read in ZenHost yet.

      min 0

    • is_closedbooleanobligatoire

      In ZenHost a conversation is closed once its latest message is read; a new guest message reopens it.

    • updated_atstring (date-time)obligatoire

      Last change of the conversation: a message added, changed or removed, or its read state.

  • next_cursorstring | nullobligatoire

    Pass it as cursor, with the same filters, to read the next page; null on the last page.

  • next_updated_sincestring (date-time)obligatoire

    Once the last page is read, pass it as updated_since to receive every Message Thread changed since this listing began. Some may come again: upsert them by booking_id.

401Error code: unauthorized, connection_revoked.

Codes d’erreur

  • unauthorized Le 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_revoked Le 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_blocked L’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_suspended ZenHost a suspendu votre App, ou ne l’autorise plus sur ce compte. Cessez les appels et contactez ZenHost.
  • forbidden_permission Votre App n’a pas reçu la permission que cet endpoint exige.
422Error code: property_out_of_scope, validation_failed.

Codes d’erreur

  • property_out_of_scope Un logement demandé est hors du périmètre de connexion ; details.property_ids les liste.
  • validation_failed La requête, les en-têtes ou le corps sont invalides ; details.issues désigne chaque problème (path, message, et maximum quand une valeur ou une liste est trop grande).
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_limited Trop d’appels sur cette connexion d’App. Attendez le nombre de secondes indiqué dans Retry-After.
500Error code: internal_error.

Codes d’erreur

  • internal_error ZenHost n’a pas pu répondre. Réessayez plus tard avec un délai croissant.

Tous les codes d’erreur et la conduite à tenir