דלג לתוכן הראשי
POST
/
chats
/
{chatId}
/
crm-data
curl --request POST \
  --url https://{projectID}.texterchat.com/server/api/v2/chats/{chatId}/crm-data \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "plan": "premium",
    "tags": [
      "vip",
      "whale"
    ],
    "customer": {
      "first_name": "Niv",
      "last_name": "Shteingart",
      "lead_id": 641225
    }
  }
}
'
{
  "success": true,
  "_id": "64de3b15398a8e09c47a9f62",
  "title": "<string>",
  "displayName": "<string>",
  "personId": "<string>",
  "image": "<string>",
  "channelInfo": {
    "accountId": "972586640430",
    "id": "972521234567",
    "metadata": {}
  },
  "agent": {
    "uid": "<string>",
    "displayName": "<string>"
  },
  "departmentId": "<string>",
  "unreadCount": 123,
  "labels": [
    "urgent",
    "billing"
  ],
  "lastMessage": {
    "type": "<string>",
    "text": "<string>",
    "media": [
      {
        "fileId": "6900c1eac29d42708adac92f",
        "previewId": "<string>",
        "filename": "offer_october_2025.pdf",
        "contentType": "application/pdf",
        "caption": "<string>",
        "metadata": {
          "frequentlyForwarded": false
        },
        "scanned": true,
        "deleted": {
          "timestamp": 123
        },
        "url": "<string>"
      }
    ]
  },
  "last_message_timestamp": 123,
  "lastIncomingMessageTimestamp": 123,
  "created": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "pendingMessageTime": 123,
  "pendingUpdateTime": 123,
  "resolvedUpdateTime": 123,
  "replyAction": {
    "created": 123,
    "expirationTime": 259200,
    "setBotNode": "<string>",
    "bot": "<string>",
    "replyText": "<string>",
    "responsibleAgent": "<string>",
    "responsibleDepartment": "<string>",
    "replyToTemplateFile": {
      "url": "<string>",
      "name": "<string>"
    },
    "resolveTime": 123
  },
  "sendingBulkAgent": "<string>",
  "latestBulkSendId": "<string>",
  "botState": {
    "id": "<string>",
    "flowVersion": {
      "identifier": "onboarding-bot",
      "version": 203
    },
    "node": "<string>",
    "userState": {},
    "store": {},
    "latestAgentUid": "<string>",
    "latestAgentName": "<string>"
  },
  "previousBotSession": {
    "id": "<string>",
    "flowVersion": {
      "identifier": "onboarding-bot",
      "version": 203
    },
    "node": "<string>",
    "userState": {},
    "store": {},
    "latestAgentUid": "<string>",
    "latestAgentName": "<string>"
  },
  "crmData": {},
  "crmDeepLink": "<string>",
  "crmLastTicketId": "<string>",
  "lastMessageStoredInCRMTimestamp": 123,
  "externalBot": true,
  "unsubscribed": {
    "date": "2023-11-07T05:31:56Z",
    "bulkSendId": "<string>"
  },
  "blockedChat": {
    "blocked": true,
    "agent": "<string>"
  },
  "hasMessageError": true,
  "language": "<string>",
  "personChats": [
    {
      "accountId": "972586640430",
      "id": "972521234567",
      "metadata": {}
    }
  ],
  "channel": "<string>",
  "clientPhone": "<string>",
  "clientPhoneE164": "<string>",
  "entityPhone": "<string>",
  "lastText": "<string>",
  "unsubscribeTime": 123,
  "blockTemplates": true
}

הרשאות

Authorization
string
header
נדרש

API token generated in Texter: gear icon → Developers → API Tokens. When creating a token, assign it the scopes required by the endpoints you plan to call - each endpoint lists its required scopes.

פרמטרי נתיב

chatId
string
נדרש

The unique identifier of the chat. You can obtain this value by using the Search Chats endpoint with the contact's phone number

גוף

application/json
data
object

The CRM data to write to the chat

mergingMode
enum<string>

How data is merged with the chat's existing crmData. Defaults to merge

אפשרויות זמינות:
replace,
assign,
merge,
defaults,
defaultsDeep

תגובה

The updated chat object. Field-by-field reference: The Chat object

A conversation with a contact on a connected channel

success
boolean
_id
string

Unique identifier of the chat in Texter

דוגמה:

"64de3b15398a8e09c47a9f62"

title
string

Contact's name as set in their WhatsApp account settings

displayName
string

Custom name modified in Texter. Absent if the display name was never modified

personId
string

ID of the person that owns this chat - links chats of the same person across channels

image
string

File ID of the chat's avatar image, when available

channelInfo
object

Channel that an entity belongs to

agent
object

The assigned agent

departmentId
string | null

Department responsible for the chat

status
enum<integer>

Chat status: 0 = BOT (handled by bot), 1 = PENDING (waiting for an agent), 2 = ASSIGNED (shown as "Taken" in Texter), 3 = RESOLVED, 4 = BULK

אפשרויות זמינות:
0,
1,
2,
3,
4
unreadCount
number

Number of unread incoming messages

labels
string[]

List of label IDs applied to the chat

דוגמה:
["urgent", "billing"]
lastMessage
object

Preview of the last message in the chat. Note: not included in Search Chats results

last_message_timestamp
number

Timestamp (epoch milliseconds) of the last message sent or received

lastIncomingMessageTimestamp
number

Timestamp (epoch milliseconds) of the last incoming (contact) message

created
string<date-time>

When the chat was created

updatedAt
string<date-time>

Last time the chat was updated

pendingMessageTime
number | null

Timestamp (epoch seconds) of the last pending-reminder the bot sent while the chat waits for an agent. Reset to null on resolve

pendingUpdateTime
number

Timestamp (epoch seconds) of the last update into pending status

resolvedUpdateTime
number

Timestamp (epoch seconds) of the last time the chat was marked as RESOLVED

replyAction
object

Action that runs when the contact replies to a template message. Set by template defaults or by the Send Template Message replyAction parameter

sendingBulkAgent
string

ID of the agent who initiated the bulk template message

latestBulkSendId
string

ID of the latest bulk send performed in this chat. Its presence does not mean the chat is currently in BULK status - only that a bulk send happened at some point

botState
object

Data about the active or most recent bot session. May contain additional bot-specific keys beyond the ones listed

previousBotSession
object

Data about the second-to-last bot session

crmData
object

Custom CRM metadata associated with the chat; structure varies by integration (Powerlink, Monday, etc.)

Personalized link to the contact's record in the integrated business CRM

crmLastTicketId

Reference to the most recent CRM record linked to the chat. String or number depending on the CRM integration

lastMessageStoredInCRMTimestamp
number

Timestamp (epoch milliseconds) of the last message stored in CRM

externalBot
boolean

Whether an external bot (outside Texter) is currently active. Changing this value triggers an event - commonly used to enable or disable external bot integrations

unsubscribed
object

Present when the chat unsubscribed from template messages

blockedChat
object
hasMessageError
boolean

Whether the chat contains failed outgoing messages

language
string

The chat's preferred language. Reserved for future functionality

personChats
object[]

All chats of the same person (including this one), as channel references. Present in webhook event payloads; not included in REST search results

channel
string
מיושן

Deprecated - use channelInfo.name instead

clientPhone
string
מיושן

Deprecated - use channelInfo.id instead

clientPhoneE164
string
מיושן

Deprecated - use channelInfo.id instead

entityPhone
string
מיושן

Deprecated - use channelInfo.accountId instead

lastText
string
מיושן

Deprecated - use lastMessage.text instead

unsubscribeTime
number
מיושן

Deprecated (epoch seconds) - use unsubscribed.date instead

blockTemplates
boolean
מיושן

Deprecated - use the unsubscribed property instead