Skip to Content

Create a conversation

Creates a new conversation with its initial contacts and returns it with a 201 status.

POST
/v1/conversations

Creates a new conversation with its initial contacts and returns it with a 201 status.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
namespaceId?|null
title?string|null
description?string|null
externalId?string|null
parentConversationId?|null
channels*array<>
primaryChannel*string
Value in"sms""whatsapp""email"
status?|null
statusReason?string|null
priority?|null
urgency?|null
complexity?|null
metadata?|null
context?|null|null
tags?array<string>|null
categories?array<string>|null
isTest?boolean|null
isInternal?boolean|null
isPrivate?boolean|null

Response Body

Success

application/json
  1. response
id*ConversationId
Match^conv_[0-9a-hjkmnp-tv-z]{16,24}$
namespaceId*|null
title*string|null
externalId*string|null
status*string
Value in"active""waiting""resolved""escalated""archived"
primaryChannel*string
Value in"sms""whatsapp""email"
channels*array<>
priority*integer
Range0 <= value <= 9007199254740991
urgency*string
Value in"low""medium""high""critical"
tags*array<string>
isTest*boolean
messageCount*integer
Range0 <= value <= 9007199254740991
lastActivityAt*string
createdAt*string
description*string|null
parentConversationId*|null
statusReason*string|null
complexity*string
Value in"simple""moderate""complex"
categories*array<string>
metadata*|null
context*|null
isInternal*boolean
isPrivate*boolean
contacts*array<>
startedAt*string
lastHumanActivityAt*string|null
resolvedAt*string|null
archivedAt*string|null
resolutionType*|null
resolutionNotes*string|null
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.conversations.create({
  "channels": [
    "sms"
  ],
  "primaryChannel": "sms"
});
Example Response
{
  "id": "string",
  "namespaceId": "string",
  "title": "string",
  "externalId": "string",
  "status": "active",
  "primaryChannel": "sms",
  "channels": [
    "sms"
  ],
  "priority": 0,
  "urgency": "low",
  "tags": [
    "string"
  ],
  "isTest": true,
  "messageCount": 0,
  "lastActivityAt": "string",
  "createdAt": "string",
  "description": "string",
  "parentConversationId": "string",
  "statusReason": "string",
  "complexity": "simple",
  "categories": [
    "string"
  ],
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "context": {
    "customerData": {
      "property1": "string",
      "property2": "string"
    },
    "previousConversations": [
      "string"
    ],
    "sessionVariables": {
      "property1": "string",
      "property2": "string"
    },
    "workflowState": {
      "currentStep": "string",
      "completedSteps": [
        "string"
      ],
      "pendingSteps": [
        "string"
      ],
      "workflowData": {
        "property1": "string",
        "property2": "string"
      }
    }
  },
  "isInternal": true,
  "isPrivate": true,
  "contacts": [
    {
      "id": "string",
      "name": "string",
      "displayName": "string",
      "identities": [
        {
          "type": "email",
          "identifier": "string",
          "verified": true
        }
      ]
    }
  ],
  "startedAt": "string",
  "lastHumanActivityAt": "string",
  "resolvedAt": "string",
  "archivedAt": "string",
  "resolutionType": "automated",
  "resolutionNotes": "string",
  "updatedAt": "string"
}

Related documentation