Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

574 StartChat: ChatInitSettings and ChatRoomRef #620

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions docs/context/ref/ChatInitSettings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
id: ChatInitSettings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest calling this ChatSettings? It seems like these settings would be relevant even after the chat had been created, and could be the basis for further, ongoing intents. e.g. EmailTranscript, CreateAppointment, RecordInCRM, etc. which could be handled by context listeners.

sidebar_label: ChatInitSettings
title: ChatInitSettings
hide_title: true
---

# `ChatInitSettings`

A collection of settings to start a new chat conversation

## Type

`fdc3.chat.initSettings`

## Schema

https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json

## Details

| Property | Type | Required | Example Value |
| ------------------------------ | --------- | -------- | -------------------------------------------------------------------- |
| `type` | string | Yes | `'fdc3.chat.initSettings'` |
| `chatName` | string | No | `'Instrumet XYZ'` |
| `members` | Contact[] | No | `[contact1, contact2]` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could use ContactList instead of Contact[].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I though of this option, but I realised that ContactList adds extra verbosity (type, sub-structure, etc.) this is why I preferred the Contact[] option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bertrand-s we're due to have a conversation at some point about the list types and whether there should be an easier / generic way to create them so they don't have to be explicit type (has been raised in meetings a few times). I'd prefer [] to List to be added to the base type name (but that's another conversation).

The APIs need a context type currently and can't take an array of them. Although this is embedded inside another type, I think it might be confusing / awkward in some situations for us to have a mixed convention on this (e.g. if the members were pulled out to send on to a CRM in another intent and then had to be converted into a ContactList).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - I will update the PR with Contact and ContactList then

| `initMessage` | string | No | `'Hello!'` |
| `options.groupRecipients` | boolean | No | `true`: if false a separate chat will be created for each member |
| `options.public` | boolean | No | `true`: the room will be visible to everyone in the chat application |
| `options.allowHistoryBrowsing` | boolean | No | `true`: members will be allowed to browser past messages |
| `options.allowMessageCopy` | boolean | No | `true`: members will be allowed to copy/paste messages |
| `options.allowAddUser` | boolean | No | `true`: members will be allowed to add other members to the chat |

If _members_ or _chatName_ are not provided, the application executing this
intent is expectd to provide a mean to enter such information.
bertrand-s marked this conversation as resolved.
Show resolved Hide resolved

## Example

```js
const initSettings = {
type: 'fdc3.chat.initSettings',
chatName: 'Issue #123',
members: [{
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
},{
type: 'fdc3.contact',
name: 'John Doe',
id: {
email: 'john@mail.com'
},
}],
options: {
groupRecipients: true, // one chat with both contacts
public: false, // private chat room
allowHistoryBrowsing: true,
allowMessageCopy: true,
allowAddUser: false, // Jane and John won't be able to add other users to the chat
}
initMessage: "Hello both!"
}

const res = fdc3.raiseIntent('StartChat', initSettings);
const roomRefs = await res.getResult();
```

## See Also

Other Types

- [ContactList](ContactList)
- [ChatRoomRef](ChatRoomRef)

Intents

- [StartChat](../../intents/ref/StartChat)
- [StartCall](../../intents/ref/StartCall)
- [ViewContact](../../intents/ref/ViewContact)

FINOS Financial Objects

- [Contact](https://fo.finos.org/docs/objects/contact)
60 changes: 60 additions & 0 deletions docs/context/ref/ChatRoomRef.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
id: ChatRoomRef
sidebar_label: ChatRoomRef
title: ChatRoomRef
hide_title: true
---
# `ChatRoomRef`

A room reference returned when a chat is created.

## Type

`fdc3.chat.roomRef`

## Schema

https://fdc3.finos.org/schemas/next/chatRoomRef.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------|--------------|----------|------------------------------------------------|
| `type` | string | Yes | `'fdc3.chat.roomRef'` |
| `app` | AppMetadata | Yes | AppMetadata corresponding to the application that generated the id |
| `name` | string | No | `'Room #123'` |
| `id` | string | No | `'JRwnsrwfWE23' - id for chat application xxx` |

## Example

```js
const roomRefExample = {
type: "fdc3.chat.roomRef",
name: "FX",
app: {/*...*/}, // AppMetadata object
id: "ypCMgBms4mzpf77jLcP8M3///oYxkqpEdA=="
}

// Retrieving a ChatRoomRef from StartChat
const newChat = await fdc3.raiseIntent('StartChat', {
type: 'fdc3.chat.initSettings',
chatName: 'Issue #123',
members: [{
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
}],
initMessage: "Hello Jane"
});
const roomRefs = await newChat.getResult();
```

## See Also

Other Types
- [ChatInitSettings](ChatInitSettings)

Intents
- [StartChat](../../intents/ref/StartChat)
35 changes: 35 additions & 0 deletions docs/context/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ The identifier "foo" is proprietary, an application that can use it is free to d
The following are standard FDC3 context types.
__Note:__ The specification for these types are shared with the [FINOS Financial Objects](https://fo.finos.org) definitions, JSON schemas are hosted with FDC3.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for @greyseer256: this sentence is no longer correct once we merge in new types - and that group has changed focus/no longer maintains those definitions. Hence, its probably time to drop this


- __fdc3.chat.initSettings__
- Initialization parameters to start a new chat
- [Financial Objects Specification](https://fo.finos.org/docs/objects/chatInitSettings)
- [schema](/schemas/next/chatInitSettings.schema.json)
- __fdc3.chat.roomRef__
- Room reference object to specify a specific chat room
- [schema](/schemas/next/chatRoomRef.schema.json)
- __fdc3.contact__
- A person contact that can be engaged with through email, calling, messaging, CMS, etc.
- [Financial Objects Specification](https://fo.finos.org/docs/objects/contact)
Expand Down Expand Up @@ -120,6 +127,34 @@ __Note:__ The below examples show how the base context data interface can be use

### Examples

#### ChatInitSettings
```json
{
"type": "fdc3.chat.initSettings",
"chatName": "Issue #123",
"members": [{
"type": "fdc3.contact",
"name": "Jane Doe",
"id": {
"email": "jane@mail.com"
}
},{
"type": "fdc3.contact",
"name": "John Doe",
"id": {
"email": "john@mail.com"
},
}],
"options": {
"groupRecipients": true,
"public": false,
"allowHistoryBrowsing": true,
"allowMessageCopy": true,
"allowAddUser": false,
}
"initMessage": "Hello both!"
}
```
#### Contact
```json
{
Expand Down
38 changes: 37 additions & 1 deletion docs/intents/ref/StartChat.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hide_title: true
---
# `StartChat`

Initiate a chat with a contact or list of contacts.
Initiate a chat with a contact, a list of contacts or detailed initialization settings.

## Intent Name

Expand All @@ -20,7 +20,11 @@ Initiate a chat with a contact or list of contacts.

* [Contact](../../context/ref/Contact)
* [ContactList](../../context/ref/ContactList)
* [ChatInitSettings](../../context/ref/ChatInitSettings)

## Result Context

* Array of [ChatRoomRef](../../context/ref/ChatRoomRef)
## Example

```js
Expand All @@ -33,13 +37,45 @@ const contact = {
}

fdc3.raiseIntent('StartChat', contact)

// chat with initialization settigns
bertrand-s marked this conversation as resolved.
Show resolved Hide resolved
const initSettings = {
type: 'fdc3.chat.initSettings',
chatName: 'Issue #123',
members: [{
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
},{
type: 'fdc3.contact',
name: 'John Doe',
id: {
email: 'john@mail.com'
},
}],
options: {
groupRecipients: true, // one chat with both contacts
public: false, // private chat room
allowHistoryBrowsing: true,
allowMessageCopy: true,
allowAddUser: false, // Jane and John won't be able to add other users to the chat
}
initMessage: "Hello both!"
}

const resolution = fdc3.raiseIntent('StartChat', initSettings);
const chatRoomRefs = await resolution.getResult();
```

## See Also

Context
- [Contact](../../context/ref/Contact)
- [ContactList](../../context/ref/ContactList)
- [ChatInitSettings](../../context/ref/ChatInitSettings)
- [ChatRoomRef](../../context/ref/ChatRoomRef)

Intents
- [StartCall](StartCall)
5 changes: 3 additions & 2 deletions docs/intents/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ However, there is a need for applications to ensure that their intents avoid col
* Expected context: Contact
* Expected behavior: initiate call with contact(s)
### StartChat
* Expected context: Contact
* Expected behavior: initiate chat with contact(s)
* Expected context: Contact or ContactList or ChatInitSettings
* Expected behavior: initiate chat with contact(s) or initialization settings
* Result context: ChatRoomRef
### ViewChart
* Expected context: Instrument
* Expected behavior: display a chart for the context
Expand Down
2 changes: 2 additions & 0 deletions src/context/schemas.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"ChatInitSettings": ["https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json"],
"ChatRoomRef": ["https://fdc3.finos.org/schemas/next/chatRoomRef.schema.json"],
"Context": ["https://fdc3.finos.org/schemas/next/context.schema.json"],
"Contact": ["https://fdc3.finos.org/schemas/next/contact.schema.json"],
"ContactList": ["https://fdc3.finos.org/schemas/next/contactList.schema.json"],
Expand Down
30 changes: 30 additions & 0 deletions src/context/schemas/chatInitSettings.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json",
"type": "object",
"title": "ChatInitSettings",
"properties": {
"type": {
"const": "fdc3.chat.initSettings"
},
"chatName": {
"type": "string"
},
"members": {
"$ref": "contact.schema.json#"
},
"initMessage": {
"type": "string"
},
"options": {
"groupRecipients": "boolean",
"public": "boolean",
"allowHistoryBrowsing": "boolean",
"allowMessageCopy": "boolean",
"allowAddUser": "boolean"
}
},
"required": [
"type"
]
}
33 changes: 33 additions & 0 deletions src/context/schemas/chatRoomRef.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatRoomRef.schema.json",
"type": "object",
"title": "ChatRoomRef",
"properties": {
"type": {
"const": "fdc3.chat.roomRef"
},
"app": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"appId": {
"type": "string"
}
}
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"type",
"app",
"id"
]
}
8 changes: 5 additions & 3 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@
"label": "Reference",
"ids": [
"context/ref/Context",
"context/ref/ChatInitSettings",
"context/ref/ChatRoomRef",
"context/ref/Contact",
"context/ref/ContactList",
"context/ref/Country",
"context/ref/Instrument",
"context/ref/InstrumentList",
"context/ref/Nothing",
"context/ref/Organization",
"context/ref/Country",
"context/ref/Position",
"context/ref/Portfolio",
"context/ref/Nothing"
"context/ref/Position"
]
}
],
Expand Down