# Message structure

Messages are sent as a JSON string.  The fields in the JSON object vary depending on the type of message, but they always include:

* [messageGroupId](https://queue-docs.rightsline.com/message-structure/entity-messages/message-group)
* [action](https://queue-docs.rightsline.com/message-structure/entity-messages/action)
* audit information (createdBy, createdDate, lastUpdatedBy, lastUpdatedDate, etc.)

### Entity Messages

Entity messages, no matter the char type or action, will contain an entity field with details of the entity that the action was performed on. For instance:

```
"entity": {
    "entityId": 3830,
    "charTypeId": 1,
    "template": {
        "templateId": 1,
        "templateName": "Feature"
    },
    "status": {
        "statusId": 1,
        "statusName": "Development"
    }
}
```

#### Component Entity Messages

Component entity messages are entity messages that are performed specifically on component records. The component char types can be identified in [this table](https://queue-docs.rightsline.com/message-structure/entity-messages/message-group). A component char type is a record that cannot exist on it's own. It must exist as a child of another record. Therefore, there is an additional field on component entity messages called `rootEntity`.  The root entity is the parent of the component record, and contains the parents char type ID and record ID:

```
"rootEntity": {
    "entityId": 3830,
    "charTypeId": 1
}
```

### Relationship Messages

Relationship messages will have fields for both the `parentEntity` and `childEntity` such as:

```
"parentEntity": {
    "entityId": 3830,
    "charTypeId": 1,
    "template": {
        "templateId": 1,
        "templateName": "Feature"
    },
    "status": {
        "statusId": 1,
        "statusName": "Development"
    }
},
"childEntity": {
    "entityId": 2978,
    "charTypeId": 3,
    "template": {
        "templateId": 1,
        "templateName": "Rights In"
    },
    "status": {
        "statusId": 1,
        "statusName": "Active"
    }
}
```

Examples of each of the messages can be found [here](https://queue-docs.rightsline.com/message-structure/entity-messages/examples).
