XMessage is a custom data structure designed for facilitating communication between services within the BharatSahAIyak ecosystem. It serves as a comprehensive format for encapsulating various types of messages exchanged between different components or modules.
XMessage consists of several components, each serving a specific purpose:
Field Name | Description | Type |
---|
messageType | Represents the type of message being sent. | MessageType |
messageId | Uniquely identifies each message and may contain additional identifiers for referencing related messages or channels. | MessageId |
to | Contains details about the sender and recipient(s) of the message. | SenderReceiverInfo |
from | Contains details about the sender of the message. | SenderReceiverInfo |
channelURI | Specifies the channel through which the message is being sent. | string |
providerURI | Specifies the provider through which the message is being sent. | string |
timestamp | Indicates the time at which the message was sent. | Unix Timestamp |
messageState | Reflects the current state of the message. | MessageState |
payload | Carries the actual content of the message. | XMessagePayload |
tags | Optional array of tags associated with the message. | Array of strings |
Type | Description |
---|
TEXT | Represents a text message. |
IMAGE | Represents an image message. |
VIDEO | Represents a video message. |
AUDIO | Represents an audio message. |
LOCATION | Represents a location message. |
DOCUMENT | Represents a document message. |
REGISTRATION | Represents a registration message. |
FEEDBACK_NEGATIVE | Represents a negative feedback message. |
FEEDBACK_POSITIVE | Represents a positive feedback message. |
FEEDBACK_NEUTRAL | Represents a neutral feedback message. |
HSM | Represents a Highly Structured Message. |
Field | Description | Type |
---|
Id | Unique identifier for the message. | string (UUID) |
channelMessageId | Identifier specific to the communication channel. | string |
replyId | Identifier for referencing a reply message. | string (UUID) |
Field | Description | Type |
---|
userID | Identifier of the user. | string |
groups | List of groups the user belongs to. | Array<string> |
campaignID | Identifier of the campaign. | string |
formID | Identifier of the form. | string |
bot | Status of the bot (if applicable). | boolean |
broadcast | Status of broadcast (if applicable). | boolean |
deviceType | Type of device used. | string |
deviceID | Identifier of the device. | string |
encryptedDeviceID | Encrypted identifier of the device (if present). | string |
meta | Additional metadata related to sender/receiver. | Map<string, string> |
Field | Description | Type |
---|
Channel | Communication channel. | String |
Provider | Service provider involved in message delivery. | String |
State | Description |
---|
NOT_SENT | Message failed to be sent. |
FAILED_TO_DELIVER | Message failed to be delivered. |
DELIVERED | Message has been successfully delivered. |
READ | Message has been read by the recipient. |
REPLIED | A reply has been sent for this message. |
ENQUEUED | Message is enqueued for sending. |
SENT | Message has been successfully sent. |
OPTED_IN | Recipient has opted in to receive messages. |
OPTED_OUT | Recipient has opted out from receiving messages. |
Field | Description | Type |
---|
text | Text content of the message. | string |
media | Media content of the message (e.g., image, video). | MessageMedia |
location | Location parameters if applicable. | LocationParams |
contactCard | Contact card information. | ContactCard |
buttonChoices | Array of button choices for interactive messages. | Array<ButtonChoice> |
stylingTag | Styling tag for message formatting. | StylingTag |
flow | Flow identifier for message handling. | string |
questionIndex | Index of the question within a flow. | number |
mediaCaption | Caption for media content. | string |
metaData | Additional metadata associated with the message. | Record<string, any> |
subject | Subject of the message. | string |