PUT api/Village/{village}/Conversation

Send a message in a specified conversation or to a specified user or to the village's default conversation. Specify ConversationId OR TargetUserId OR neither of them. If ConversationId is specified, TargetUserId is ignored.

Request Information

URI Parameters

NameDescriptionTypeAdditional information
village

string

None.

Body Parameters

SendMessageModel
NameDescriptionTypeAdditional information
ConversationId

ConversationId, if provided, specifies a conversation to which the message should be sent. If neither ConversationID nor TargetUserID are specified, the message will be sent to the village's default conversation.

globally unique identifier

None.

TargetUserId

If ConversationId is null, then TargetUserId, if provided, specifies a user to which the message should be sent;the server will automatically locate an existing conversation or create a new one. If neither ConversationID nor TargetUserID are specified, the message will be sent to the village's default conversation.

globally unique identifier

None.

Message

The text of the message

string

Required

Request Formats

application/json, text/json

Sample:
{
  "ConversationId": "c69772fb-99ca-4225-bd85-a46ac1f18313",
  "TargetUserId": "c0c1462f-8074-4572-9fc1-1c74505dccbe",
  "Message": "sample string 1"
}

application/xml, text/xml

Sample:
<SendMessageModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CaringVillage.Shared.Implementation.Models">
  <ConversationId>c69772fb-99ca-4225-bd85-a46ac1f18313</ConversationId>
  <Message>sample string 1</Message>
  <TargetUserId>c0c1462f-8074-4572-9fc1-1c74505dccbe</TargetUserId>
</SendMessageModel>

multipart/form-data

Sample:

Failed to generate the sample for media type 'multipart/form-data'. Cannot use formatter 'MultipartMediaTypeFormatter' to write type 'SendMessageModel'.

Response Information

Resource Description

ConversationMessageModel
NameDescriptionTypeAdditional information
MessageId

The unique ID of the message

globally unique identifier

None.

ConversationId

The unique ID of the conversation

globally unique identifier

None.

IsAction

If true, this is an "Action" message (something happened, vs. something was said)

boolean

None.

Message

The text of the message

string

None.

Sent

Date/Time the message was sent (as perceived by the server)

date

None.

SentBy

The name of the user who sent the message

string

None.

SentById

The ID of the user who sent the message

globally unique identifier

None.

Sequence

The messages sequence number

integer

None.

Response Formats

application/json, text/json

Sample:
{
  "MessageId": "e9f8d2ef-f0d2-437b-bcd9-757ee752b276",
  "ConversationId": "0bd1c927-ff92-47a9-a185-76ccc334e167",
  "IsAction": true,
  "Message": "sample string 4",
  "Sent": "2025-06-03T04:55:24.741+00:00",
  "SentBy": "sample string 6",
  "SentById": "a4da9a41-4bd1-4e78-951b-1a9f71971d6c",
  "Sequence": 8
}

application/xml, text/xml

Sample:
<ConversationMessageModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CaringVillage.Shared.Implementation.Models">
  <ConversationId>0bd1c927-ff92-47a9-a185-76ccc334e167</ConversationId>
  <IsAction>true</IsAction>
  <Message>sample string 4</Message>
  <MessageId>e9f8d2ef-f0d2-437b-bcd9-757ee752b276</MessageId>
  <Sent>2025-06-03T04:55:24.7419349+00:00</Sent>
  <SentBy>sample string 6</SentBy>
  <SentById>a4da9a41-4bd1-4e78-951b-1a9f71971d6c</SentById>
  <Sequence>8</Sequence>
</ConversationMessageModel>