---
title: "Chat and channels"
description: "Open a session in your app, or post into a WhatsApp, mail, or voice channel."
canonical_url: "https://docs.vettero.com/developer-api/chat"
---
# Chat and channels

> Open a session in your app, or post into a WhatsApp, mail, or voice channel.

## In your app

These calls keep the transcript in your application. Scope: `chat`. Paths are under `/api/developer/v1`.

<table>
<thead>
  <tr>
    <th>
      Call
    </th>
    
    <th>
      What it does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        POST /sessions
      </code>
    </td>
    
    <td>
      Opens a chat for an agent. Send <code>
        agentId
      </code>
      
       and <code>
        userId
      </code>
      
       or <code>
        guestToken
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST /sessions/{id}/messages
      </code>
    </td>
    
    <td>
      Sends the user's text. Body: <code>
        { "text": "..." }
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET /sessions/{id}/messages
      </code>
    </td>
    
    <td>
      Reads messages. Query: <code>
        page
      </code>
      
      , <code>
        limit
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET /sessions/{id}
      </code>
    </td>
    
    <td>
      Reads one session
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST /sessions/{id}/stop
      </code>
    </td>
    
    <td>
      Stops the current run
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET /sessions
      </code>
    </td>
    
    <td>
      Lists sessions. Query: <code>
        userId
      </code>
      
      , <code>
        agentId
      </code>
      
      , <code>
        channel
      </code>
      
      , <code>
        state
      </code>
      
      , <code>
        cursor
      </code>
      
      , <code>
        limit
      </code>
    </td>
  </tr>
</tbody>
</table>

### Fields that trip people up

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Session <code>
        {id}
      </code>
    </td>
    
    <td>
      Mongo id <strong>
        or
      </strong>
      
       the session <code>
        token
      </code>
      
       string
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        agentId
      </code>
    </td>
    
    <td>
      Agent Mongo id
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        guestToken
      </code>
    </td>
    
    <td>
      From <a href="https://docs.vettero.com/developer-api/guests">
        guest-tokens
      </a>
      
      . Prefer this when you already issued one
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        channel
      </code>
      
       (list filter)
    </td>
    
    <td>
      Channel type on the session (for example <code>
        web
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        accepted: true
      </code>
      
       on send
    </td>
    
    <td>
      Message was <strong>
        queued
      </strong>
      
      . The agent reply is asynchronous — poll messages or use webhooks
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nextCursor
      </code>
    </td>
    
    <td>
      Pass as <code>
        cursor
      </code>
      
       on the next list call. Null means no more pages
    </td>
  </tr>
</tbody>
</table>

## On a channel

`POST /channels/{id}/messages` posts into a workspace channel (WhatsApp, mail, or voice). Scope: `channels`.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        {id}
      </code>
      
       in the path
    </td>
    
    <td>
      Workspace <strong>
        channel
      </strong>
      
       id — not a session id
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        channelIdentifier
      </code>
    </td>
    
    <td>
      The other person's phone or email on that channel
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        text
      </code>
    </td>
    
    <td>
      Text posted into that conversation
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        agentId
      </code>
    </td>
    
    <td>
      Optional. Defaults to the channel's default agent
    </td>
  </tr>
</tbody>
</table>

The customer sees the conversation on that channel. It does not draw bubbles in your in-app web transcript. Use create session plus send message for the in-app transcript.


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
