Continue a Shared Chat — Yophone → Hoory

A user shares their AI-assistant chat. Another user opens it and keeps talking, with the original chat as context.

Yophone owns the share record, the share page and the transcript shown on it. Hoory is told about the share only when someone continues it.


1. Announce the fork

When user B taps “Continue this chat”:

POST /webhooks/yophone/{bot_token}
{
  "empty_conversation": true,
  "chatId": "0193fcf9-0152-7821-93cb-a4c05ebc17e2",
  "sender": { "id": "0193fcf9-...", "firstName": "Anna", "lastName": "Petrosyan" },
  "shared_from": {
    "conversation_id": 4312,
    "last_message_id": "474e6502-b20a-11f1-bf7a-4201ac107206"
  }
}
Field Notes
empty_conversation Must be true. Forces a new conversation.
chatId / sender B’s chat and identity, as usual.
shared_from.conversation_id The conversation id of A’s chat.
shared_from.last_message_id Your version-1 UUID of the last message in the shared transcript. Its embedded time is the cutoff.

All four are required. No text field — this call creates the conversation, it does not send a message.

Response:

{ "conversation_id": 987 }

2. Send B’s messages as normal

{
  "id": 56,
  "text": "U28gaG93IGRvIEkgZG8gdGhhdD8=",
  "conversation_id": 987,
  "chatId": "0193fcf9-0152-7821-93cb-a4c05ebc17e2",
  "sender": { "id": "0193fcf9-...", "firstName": "Anna", "lastName": "Petrosyan" }
}

Do not send shared_from again. It is read once, when the conversation is created.


Rules

  • The time inside last_message_id is the cutoff. Only messages Hoory stored up to 10 seconds after that time are used as context. If A keeps chatting after sharing, B never sees it (unless A writes within those 10 seconds).
  • It must be a version-1 UUID (time-based). Other UUID versions and plain numbers are refused.
  • The 10 seconds cover the delay between you creating A’s message and Hoory storing it, so a transcript that ends on A’s own message keeps that message.
  • Capture it at share time, not when B opens the link. Store it on the share record and replay the same value every time.
  • Text only, last 40 messages. No attachments, images or buttons.
  • The source conversation must be in the same Yophone inbox as the bot token.

If something is wrong

Always HTTP 200. The conversation is created and works normally — just without context. Never a 4xx, so no retries.

This happens when the source conversation does not exist, is in another inbox, has no text to replay, or when last_message_id is missing, is not a version-1 UUID, or is older than every message of that conversation.

To check whether a share was accepted, read the new conversation’s additional_attributes.shared_from — present means accepted.


Checklist

  • Store conversation_id + last_message_id when A taps Share.
  • On “Continue”, POST with empty_conversation: true and shared_from.
  • Save the returned conversation_id.
  • Send it on every following message; never resend shared_from.
  • Guard against a double tap — each call creates a new fork.
  • Build the request server-side. Never expose the bot token to clients.