{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial","admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"Live Chat","description":"Complete developer documentation for the eCommunicate Omnichannel platform. WhatsApp Cloud, WhatsApp Lite, SMS, Live Chat, and Conversations APIs. Send messages, manage templates, configure webhooks, and build customer engagement at scale.","siteUrl":"https://docs.ecommunicate.co.za","lang":"en-ZA","image":"/assets/og-cover.93cb0a29e46afb76d2e2ad760ae643881a756bfe5784b4b0c3553ecb20635632.db81178d.png","keywords":["eCommunicate API","WhatsApp Business API","SMS API","omnichannel messaging","WhatsApp templates","messaging platform","South Africa messaging API","bulk SMS API","two-way SMS","SMS gateway","delivery receipts"],"meta":[{"name":"author","content":"eCommunicate (Pty) Ltd"},{"name":"robots","content":"index, follow"}],"jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.ecommunicate.co.za/#organization","name":"eCommunicate","url":"https://www.ecommunicate.co.za/","logo":"https://docs.ecommunicate.co.za/images/logo.png","sameAs":["https://www.ecommunicate.co.za/"],"contactPoint":{"@type":"ContactPoint","email":"support@ecommunicate.co.za","contactType":"customer support"}},{"@type":"WebSite","@id":"https://docs.ecommunicate.co.za/#website","name":"eCommunicate API Documentation","url":"https://docs.ecommunicate.co.za","publisher":{"@id":"https://www.ecommunicate.co.za/#organization"}}]},"llmstxt":{"hide":false,"title":"eCommunicate Omnichannel API","description":"Developer documentation for the eCommunicate Omnichannel platform — WhatsApp Cloud, WhatsApp Lite, SMS, Live Chat, and Conversations APIs.","sections":[{"title":"Guides","includeFiles":["guides/**/*.md"],"excludeFiles":[]},{"title":"Tutorials","includeFiles":["tutorials/**/*.md"],"excludeFiles":[]},{"title":"API Reference","includeFiles":["apis/**/*.yaml"],"excludeFiles":[]},{"title":"Changelog","includeFiles":["changelog.md"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"live-chat","__idx":0},"children":["Live Chat"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Live Chat system enables agent-based customer conversations with ticket tracking, team assignment, and message history across WhatsApp, Web, and Facebook channels."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Authentication Required"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All API requests require your Developer Key in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," header. No ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Bearer"]}," prefix — pass the key directly."," ","See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/authentication"},"children":["Authentication"]}," for setup and security best practices."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"architecture","__idx":1},"children":["Architecture"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Live Chat system is built around three core concepts:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Concept"},"children":["Concept"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Chat Participants"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Active conversations between a customer and your platform"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tickets"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Track and manage conversations with status workflows"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agents & Teams"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Support staff organized with team assignment and supervisor oversight"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"conversation-flow","__idx":2},"children":["Conversation flow"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Customer Message ──> Unassigned Queue ──> Agent Picks Up ──> Active Chat\n                                                                  │\n                                                    ┌─────────────┼─────────────┐\n                                                    ▼             ▼             ▼\n                                                 Resolved    Transferred     Closed\n                                                  (Ticket)   (to team)    (Rating widget)\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"chatbot-conversation-flow","__idx":3},"children":["Chatbot conversation flow"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Follow this three-step flow to receive an incoming WhatsApp message and retrieve the full conversation history."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Incoming Message ──> Webhook fires ──> Look up ChatParticipant ──> Get messages\n    (customer)       (your server)      (by sender number)        (by participant ID)\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-1-receive-the-incoming-message-webhook","__idx":4},"children":["Step 1: Receive the incoming message webhook"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a customer sends a message, your configured ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["incomingMessageURL"]}," receives a POST with the message payload. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/webhooks#incoming-message-payload"},"children":["Webhooks — Incoming message payload"]}," for full details."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"profileName\": \"John Smith\",\n  \"sender\": \"+27987654321\",\n  \"senderUserId\": \"ZA.1021033720668862\",\n  \"username\": \"john_smith\",\n  \"receiver\": \"+27123456789\",\n  \"text\": \"Hi, I need help with my order\",\n  \"messageType\": \"INTERACTION\",\n  \"messageContentType\": \"TEXT\",\n  \"gstId\": \"a1b2c3d4-5678-90ab-cdef-1234567890ab\",\n  \"participantId\": \"participant-uuid\",\n  \"sentTime\": \"2026-01-15T10:30:00.000+00:00\",\n  \"status\": \"RECEIVED\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Alpha usernames (BSUID)"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["WhatsApp is rolling out ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["alpha usernames"]},". Each customer now has a durable, business-scoped user id (",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["BSUID"]},", e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ZA.1021033720668862"]},") that is stable for your business even if the customer changes their phone number — and that stays present on inbound events ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["even when the phone number is withheld"]},". Customers may also set an optional ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["username"]}," (display only)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Incoming, chatbot, and status webhooks carry the customer BSUID as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["senderUserId"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recipientUserId"]},", plus the optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["username"]},". ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The phone number (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sender"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["senderMsisdn"]},") remains the primary identifier today"]}," — the BSUID is an additional, more durable key you can store now and rely on as phone numbers become optional. The BSUID is always present on these payloads; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["username"]}," is omitted only when the customer hasn't set one."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sender"]}," field without a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+"]}," to look up the chat participant in Step 2. When the phone number is withheld, match on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}," (the customer BSUID) instead — it is present on the chat participant even when the number is not."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"`participantId` is not the live-chat participant id"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["participantId"]}," field on the incoming-message webhook payload identifies a participant in the conversation engine. It is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," the same as the live-chat ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["chatParticipantId"]}," used to fetch messages or send agent replies. Always resolve the live-chat participant by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sender"]}," (Step 2) before calling any ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/pl4chat-service/api/v2/messages"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/pl4chat-service/api/v2/chats"]}," endpoints."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-2-get-the-chat-participant-by-sender-number","__idx":5},"children":["Step 2: Get the chat participant by sender number"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["List your chats and filter by the sender's phone number to find the latest conversation. The v2 list"," ","endpoint selects which conversations to return with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}," filter — the agent and client are"," ","resolved from your API key, so you only choose the tab:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"GET /pl4chat-service/api/v2/chats?scope=my\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"choose-your-scope","__idx":6},"children":["Choose your scope"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"scope"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Returns"},"children":["Returns"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Conversations assigned to you (the authenticated agent)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["team"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Conversations assigned to your team members"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unassigned"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Conversations waiting in queue"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["closed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Closed conversations"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["missed-agent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Missed conversations"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["missed-after-hours"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["After-hours missed conversations"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my-missed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your missed conversations"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["All open client conversations"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["all"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["All conversations (open and closed)"]}]}]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Which list to return (see above). ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Required"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page number (0-based). Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page size. Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["search"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter by phone number, name, or customer id"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["search"]}," parameter with the sender's phone number or BSUID (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["senderUserId"]},") to narrow"," ","results directly, or filter client-side after fetching. The response is a page of"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ChatParticipantResponse"]}," objects. Match on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["or"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}," — a customer with a"," ","withheld phone number is identified only by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}," (BSUID)."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \\\n  \"https://api.payless4messaging.com/pl4chat-service/api/v2/chats?scope=unassigned&page=0&size=50&search=27987654321\" \\\n  -H \"Authorization: $ECOMM_API_KEY\"\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const API_KEY = process.env.ECOMM_API_KEY;\nconst BASE_URL = 'https://api.payless4messaging.com';\n\n// The sender number from the webhook payload\nconst senderNumber = '27987654321';\n\nconst response = await fetch(\n  `${BASE_URL}/pl4chat-service/api/v2/chats?scope=unassigned&page=0&size=50&search=${encodeURIComponent(senderNumber)}`,\n  { headers: { 'Authorization': API_KEY } }\n);\n\nconst data = await response.json();\n\n// Match on phone number OR userId (BSUID) — the customer may have no phone number\nconst participant = data.content\n  .filter(p => p.phoneNumber === senderNumber || p.userId === senderNumber)\n  .sort((a, b) => new Date(b.lastMessageTime) - new Date(a.lastMessageTime))[0];\n\nif (!participant) {\n  throw new Error(`No chat participant found for ${senderNumber}`);\n}\n\nconsole.log(`Participant ID: ${participant.id}`);\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import os\nimport requests\n\nAPI_KEY = os.environ[\"ECOMM_API_KEY\"]\nBASE_URL = \"https://api.payless4messaging.com\"\n\n# The sender number from the webhook payload\nsender_number = \"27987654321\"\n\nresponse = requests.get(\n    f\"{BASE_URL}/pl4chat-service/api/v2/chats\",\n    headers={\"Authorization\": API_KEY},\n    params={\"scope\": \"unassigned\", \"page\": 0, \"size\": 50, \"search\": sender_number},\n)\n\ndata = response.json()\n\n# Match on phone number OR userId (BSUID) — the customer may have no phone number\nparticipants = [\n    p for p in data[\"content\"]\n    if p.get(\"phoneNumber\") == sender_number or p.get(\"userId\") == sender_number\n]\nif not participants:\n    raise ValueError(f\"No chat participant found for {sender_number}\")\nparticipant = sorted(participants, key=lambda p: p[\"lastMessageTime\"], reverse=True)[0]\n\nprint(f\"Participant ID: {participant['id']}\")\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"import java.net.URI;\nimport java.net.http.*;\nimport java.net.http.HttpResponse.BodyHandlers;\nimport com.fasterxml.jackson.databind.*;\n\nString API_KEY = System.getenv(\"ECOMM_API_KEY\");\nString BASE_URL = \"https://api.payless4messaging.com\";\nString senderNumber = \"27987654321\";\nHttpClient client = HttpClient.newHttpClient();\n\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(BASE_URL + \"/pl4chat-service/api/v2/chats?scope=unassigned&page=0&size=50&search=\"\n        + URLEncoder.encode(senderNumber, StandardCharsets.UTF_8)))\n    .header(\"Authorization\", API_KEY)\n    .GET()\n    .build();\n\nHttpResponse<String> response = client.send(request, BodyHandlers.ofString());\nObjectMapper mapper = new ObjectMapper();\nJsonNode data = mapper.readTree(response.body());\n\n// Match on phone number OR userId (BSUID) — the customer may have no phone number\nString participantId = null;\nString latestTime = \"\";\nfor (JsonNode p : data.get(\"content\")) {\n    String phone = p.has(\"phoneNumber\") ? p.get(\"phoneNumber\").asText() : \"\";\n    String userId = p.has(\"userId\") ? p.get(\"userId\").asText() : \"\";\n    if (phone.equals(senderNumber) || userId.equals(senderNumber)) {\n        String msgTime = p.get(\"lastMessageTime\").asText();\n        if (msgTime.compareTo(latestTime) > 0) {\n            latestTime = msgTime;\n            participantId = p.get(\"id\").asText();\n        }\n    }\n}\nSystem.out.println(\"Participant ID: \" + participantId);\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-3-get-the-conversation-messages","__idx":7},"children":["Step 3: Get the conversation messages"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the participant ID from step 2 to retrieve the full message history:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \\\n  \"https://api.payless4messaging.com/pl4chat-service/api/v2/messages?participantId=participant-uuid\" \\\n  -H \"Authorization: $ECOMM_API_KEY\"\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const messages = await fetch(\n  `${BASE_URL}/pl4chat-service/api/v2/messages?participantId=${participant.id}`,\n  { headers: { 'Authorization': API_KEY } }\n).then(r => r.json());\n\nmessages.forEach(msg => {\n  const who = msg.direction === 'INCOMING' ? 'Customer' : 'Bot';\n  console.log(`[${msg.createdTime}] ${who}: ${msg.text}`);\n});\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"response = requests.get(\n    f\"{BASE_URL}/pl4chat-service/api/v2/messages\",\n    headers={\"Authorization\": API_KEY},\n    params={\"participantId\": participant[\"id\"]},\n)\n\nfor msg in response.json():\n    who = \"Customer\" if msg[\"direction\"] == \"INCOMING\" else \"Bot\"\n    print(f\"[{msg['createdTime']}] {who}: {msg['text']}\")\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"HttpRequest msgRequest = HttpRequest.newBuilder()\n    .uri(URI.create(BASE_URL + \"/pl4chat-service/api/v2/messages?participantId=\" + participantId))\n    .header(\"Authorization\", API_KEY)\n    .GET()\n    .build();\n\nHttpResponse<String> msgResponse = client.send(msgRequest, BodyHandlers.ofString());\nJsonNode messages = mapper.readTree(msgResponse.body());\n\nfor (JsonNode msg : messages) {\n    String who = \"INCOMING\".equals(msg.get(\"direction\").asText()) ? \"Customer\" : \"Bot\";\n    System.out.printf(\"[%s] %s: %s%n\",\n        msg.get(\"createdTime\").asText(), who, msg.get(\"text\").asText());\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"alternative-get-messages-by-tracking-number","__idx":8},"children":["Alternative: Get messages by tracking number"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you have the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["GSTN"]}," (Global System Tracking Number) or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["CTN"]}," (Customer Tracking Number) from the chat participant object, you can retrieve messages directly without needing the participant ID:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"GET /pl4chat-service/api/v2/messages/tracking/{trackingNumber}\n"},"children":[]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \\\n  \"https://api.payless4messaging.com/pl4chat-service/api/v2/messages/tracking/a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890\" \\\n  -H \"Authorization: $ECOMM_API_KEY\"\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const gstn = 'a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890'; // from chat participant\n\nconst messages = await fetch(\n  `${BASE_URL}/pl4chat-service/api/v2/messages/tracking/${gstn}`,\n  { headers: { 'Authorization': API_KEY } }\n).then(r => r.json());\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"gstn = \"a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890\"  # from chat participant\n\nresponse = requests.get(\n    f\"{BASE_URL}/pl4chat-service/api/v2/messages/tracking/{gstn}\",\n    headers={\"Authorization\": API_KEY},\n)\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"String gstn = \"a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890\"; // from chat participant\n\nHttpRequest trackingRequest = HttpRequest.newBuilder()\n    .uri(URI.create(BASE_URL + \"/pl4chat-service/api/v2/messages/tracking/\" + gstn))\n    .header(\"Authorization\", API_KEY)\n    .GET()\n    .build();\n\nHttpResponse<String> trackingResponse = client.send(trackingRequest, BodyHandlers.ofString());\nJsonNode trackingMessages = mapper.readTree(trackingResponse.body());\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"mark-a-conversation-as-read","__idx":9},"children":["Mark a conversation as read"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After retrieving messages, mark the conversation as read — this clears the unread badge and sends a read receipt to the customer in one call:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/messages/read?participantId=cp-a1b2c3d4\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"chat-participants","__idx":10},"children":["Chat participants"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each chat participant carries:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Chat participant id"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer phone number. May be absent when the number is withheld"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["BSUID"]}," (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ZA.1021033720668862"]},"), durable across phone-number changes. Present even when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}," is not"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["username"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer's optional WhatsApp username (display only)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Display name"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"terminate-or-reopen-a-chat","__idx":11},"children":["Terminate or reopen a chat"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Close or reopen a conversation with its id — the acting agent is resolved from your API key, so there's no request body to assemble:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/chats/{id}/terminate   # close (sends the rating widget if configured)\nPOST /pl4chat-service/api/v2/chats/{id}/open        # reopen and assign to you\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both return the updated ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ChatParticipantResponse"]},"."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"The assigned-agent slot is freed for you"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Terminating a chat moves its current ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["assignedTo"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastAssignedAgent"]}," and frees the slot in the agent's chat-limit count automatically. (The deprecated ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT /pl4chat-service/ChatParticipant/terminateChatParticipantChat"]}," required you to echo the full object back to make that happen — v2 does it server-side.)"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"agent-messaging","__idx":12},"children":["Agent messaging"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Why this endpoint, not the notifications one?"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only messages sent through the live-chat send endpoint show up in the live-chat UI. Outbound sends through the notifications endpoint (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/whatsapp-api-service/v2/channels/whatsapp"]},") reach the customer but bypass the chat service entirely — agents won't see them. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/getting-started#how-the-system-fits-together"},"children":["How the system fits together"]}," for the architecture."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"send-a-reply","__idx":13},"children":["Send a reply"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["One endpoint sends on every channel. Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["channel"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WHATSAPP"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WEB"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FACEBOOK"]},") and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," — the agent is resolved from your API key:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/messages\n"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"participantId\": \"participant-uuid\",\n  \"channel\": \"WHATSAPP\",\n  \"tempId\": \"unique-temp-uuid\",\n  \"text\": \"Here is the information you requested.\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tempId"]}," is optional — supply a client-generated string only if you want it echoed back to reconcile an optimistic UI message; otherwise omit it. The response is the stored ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MessageResponse"]}," (with your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tempId"]}," echoed back when you sent one). To quote/reply to an earlier message, also set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["quotedExternalMessageId"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"send-media","__idx":14},"children":["Send media"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Upload the file, then send the returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mediaUrl"]}," — the same flow works for any channel:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/messages/media   # multipart/form-data, field \"file\" -> { mediaUrl, mediaType }\nPOST /pl4chat-service/api/v2/messages         # { participantId, channel, mediaUrl, text? }\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The content type defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MEDIA"]}," when a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mediaUrl"]}," is present, so you don't need to set it."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"typing-indicator","__idx":15},"children":["Typing indicator"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/messages/typing?participantId=participant-uuid\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Shows a typing bubble to the customer while the agent is composing a reply."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"mark-a-conversation-as-read-1","__idx":16},"children":["Mark a conversation as read"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /pl4chat-service/api/v2/messages/read?participantId=participant-uuid\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"tickets","__idx":17},"children":["Tickets"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"search-tickets","__idx":18},"children":["Search tickets"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"GET /pl4chat-service/ticket/search\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Required parameters:"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page number (0-based)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page size"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startDateTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Start of date range"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["endDateTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["End of date range"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientRef"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Client reference"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Optional filters:"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Filter"},"children":["Filter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["whatsAppNumber"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer WhatsApp number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rating"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["enum"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["poor"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["average"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["excellent"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ticketNumber"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Specific ticket number (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TCK-001"]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["agentId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter by assigned agent"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["selectedStatus"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["enum"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["closed"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["awaiting agent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["awaiting customer"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["resolved"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-ticket-status","__idx":19},"children":["Update ticket status"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"PUT /pl4chat-service/ticket/{ticketId}/status?newStatus=RESOLVED\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Available statuses:"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OPEN"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Ticket is active and being worked on"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AWAITING_AGENT"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Waiting for an agent to respond"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AWAITING_CUSTOMER"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Waiting for the customer to respond"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RESOLVED"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Issue has been resolved but ticket remains accessible"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CLOSED"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Ticket is closed and archived"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-ticket-by-number","__idx":20},"children":["Get ticket by number"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"GET /pl4chat-service/ticket/by-ticket-number?ticketNumber=TCK-001\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"contacts","__idx":21},"children":["Contacts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Manage customer contact records linked to your account."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Endpoint"},"children":["Endpoint"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/payless4messaging-service/WhatsApp/contacts"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Get all contacts (paginated)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/payless4messaging-service/WhatsApp/contacts"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Create a contact"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/payless4messaging-service/WhatsApp/contacts/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Update a contact"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DELETE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/payless4messaging-service/WhatsApp/contacts/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Delete a contact"]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Limited update fields"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Currently, only the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fullName"]}," field can be updated on an existing contact. Other fields (phone number, business name, etc.) are read-only after creation."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"PUT /payless4messaging-service/WhatsApp/contacts/{id}\n\n{\n  \"fullName\": \"Jane Smith\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"supported-channels","__idx":22},"children":["Supported channels"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Channel"},"children":["Channel"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["WhatsApp"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WHATSAPP"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["WhatsApp conversations via Cloud or Lite"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Web"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WEB"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Web chat widget embedded in your website"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Facebook"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FACEBOOK"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Facebook Messenger conversations"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"message-content-types","__idx":23},"children":["Message content types"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TEXT"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Plain text message"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Image attachment (JPG, PNG, GIF)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DOCUMENT"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Document attachment (PDF, DOCX, XLSX)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VIDEO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Video attachment (MP4)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AUDIO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Audio message"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VOICE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Voice note"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FILE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Generic file attachment"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["LOCATION"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Location with latitude/longitude"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BUTTON"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Button interaction response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CAROUSEL"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Carousel card"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RATING"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer rating response"]}]}]}]}]}]},"headings":[{"value":"Live Chat","id":"live-chat","depth":1},{"value":"Architecture","id":"architecture","depth":2},{"value":"Conversation flow","id":"conversation-flow","depth":3},{"value":"Chatbot conversation flow","id":"chatbot-conversation-flow","depth":2},{"value":"Step 1: Receive the incoming message webhook","id":"step-1-receive-the-incoming-message-webhook","depth":3},{"value":"Step 2: Get the chat participant by sender number","id":"step-2-get-the-chat-participant-by-sender-number","depth":3},{"value":"Choose your scope","id":"choose-your-scope","depth":4},{"value":"Step 3: Get the conversation messages","id":"step-3-get-the-conversation-messages","depth":3},{"value":"Alternative: Get messages by tracking number","id":"alternative-get-messages-by-tracking-number","depth":3},{"value":"Mark a conversation as read","id":"mark-a-conversation-as-read","depth":3},{"value":"Chat participants","id":"chat-participants","depth":2},{"value":"Terminate or reopen a chat","id":"terminate-or-reopen-a-chat","depth":3},{"value":"Agent messaging","id":"agent-messaging","depth":2},{"value":"Send a reply","id":"send-a-reply","depth":3},{"value":"Send media","id":"send-media","depth":3},{"value":"Typing indicator","id":"typing-indicator","depth":3},{"value":"Mark a conversation as read","id":"mark-a-conversation-as-read-1","depth":3},{"value":"Tickets","id":"tickets","depth":2},{"value":"Search tickets","id":"search-tickets","depth":3},{"value":"Update ticket status","id":"update-ticket-status","depth":3},{"value":"Get ticket by number","id":"get-ticket-by-number","depth":3},{"value":"Contacts","id":"contacts","depth":2},{"value":"Supported channels","id":"supported-channels","depth":2},{"value":"Message content types","id":"message-content-types","depth":2}],"frontmatter":{"title":"Live Chat","description":"Agent-based live chat with ticket management, team assignment, and conversation history.","seo":{"title":"Live Chat"}},"lastModified":"2026-07-16T11:38:48.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/live-chat","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}