---
# System prepended metadata

title: New DB collections

---



# New DB collections

## subscribeSessionEvents

>sessionsEventsSubscribtion

### Description:
### Schema:
#### V1
```
{
    sessionId,
    conditionId,
    conditionData,
    moduleObjectId,
}
```
#### V2
Name: subscriptionTypes
> session, entity updates, module attach
```
{
    
}
```
Name: sessionsSubscriptions
```
{
    subscriptionId: 5,
    moduleObjectId: '45',
    sessionId: 34,
    workedOn: 0,
    conditionData: Object
    
}   
```
#### Now we will use this
Name: sessionInactivitySubscriptions 
```
{
 inactivitySubscriptionId,
 sessionId,
 moduleObjectId,
 timeout,
 workedOn,
}
```
| method | describe | URL
| ------ | ------- | ----
| POST | API create subscription | /modules/:moduleObjectId/sessions/:sessionId/inactivity-timeout-subscription
| DELETE | API delete subscription by Id | /modules/:moduleObjectId/sessions/:sessionId/inactivity-timeout-subscription/:inactivitySubscriptionId
| DELETE | API delete subscription by sessionId | /modules/:moduleObjectId/sessions/:sessionId/inactivity-timeout-subscription
URL: /modules/:moduleObjectId/sessions/:sessionId/inactivity-timeout-subscription
### Example:
```
```
-----
## no discussion below here
-----
## templateTypes
### Description:
### Schema:
```
{
	messageTemplateTypeId,
	name,
}
```
### Example:
```
{
	messageTemplateTypeId: 0,
	name: 'Message from bot'
},
{
	messageTemplateTypeId: 1,
	name: 'Emails templates'
}
```
## templates
### Description:
### Schema
```
{
   	templateId,
	templateTypeId,
	applicationId,
    conditionIds,
    ...specialFields,
}
```
### Example:
```
{
	templateId: 0,
	templateTypeId: 0, 
	text: "You are unactive",
	applicationId: 0,
},
{
	templateId: 3,
	templateTypeId: 0, 
	text: "You are unactive - 1",
	applicationId: 0,
},
{
	templateId: 2,
	templateTypeId: 0, 
	text: "You are unactive - 2",
	applicationId: 0,
},
{
	templateId: 1,
	templateTypeId: 1,
	applicationId: 1, 	
	conditionIds: [1,0],
	...emailStuff,
	
}
```
### Limitations:
* applicationId field not use in v1.4.8
* conditionIds field not use in v1.4.8

## conditionTypes (not in 1.4.8)
### Description:
### Schema
```
{
    conditionTypeId,
	name,
	requiredFields 
}
```
### Example
```
{
	conditionTypeId: 0,
	name: 'No activity in session on both side',
	requiredFields: [
		{ type: 'number', fieldName: 'time' }
	]
},
{
	conditionTypeId: 1,
	name: 'Buisness hours'
},
{
	conditionTypeId: 3,
	name: 'Invoice'
}
```
## systemConfigs
### Description:
Add new field rules
### Example
```
{
	rules: [
		{ conditionTypeId: 0, templateId: 0, conditionData: { time: 56 } },
		{ conditionTypeId: 3, templateId: 1 }
	]
}
```
## organizations
### Description:
Add new field rules
### Example
```
{
	organizationId: 5,
	rules: [
		{ conditionTypeId: 0, templateId: 0, conditionData: { time: 56 } }
	]
}
```
## projects
### Description:
Add new field rules
### Example
```
{
	organizationId: 4,
	projectId: 1,
	rules: [
		{ conditionTypeId: 0, templateId: 0, conditionData: { time: 56 } }
	]
}
```
## bots
### Description:
Add new field rules
### Example
```
{
	botId: 1,
	rules: [
		{ conditionTypeId: 0, templateId: 0, conditionData: { time: 36 } }
	]
}
```