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

765 'ChatRoom' & 'ChatMessage' contexts and 'SendChatMessage' Intent #794

Closed
Show file tree
Hide file tree
Changes from 3 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
7 changes: 5 additions & 2 deletions docs/context/ref/ChatInitSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,22 @@ const initSettings = {
}

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

// Return a reference to the room
const chatRoom = await res.getResult();
```

## See Also

Other Types

- [ChatRoom](ChatRoom)
- [ContactList](ContactList)

Intents

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

FINOS Financial Objects
Expand Down
51 changes: 51 additions & 0 deletions docs/context/ref/ChatMessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
id: ChatMessage
sidebar_label: ChatMessage
title: ChatMessage
hide_title: true
---
# `ChatMessage`

Message to send to a chat.
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved

## Type

`fdc3.chat.message`

## Schema

- https://fdc3.finos.org/schemas/next/chatMessage.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------|---------|----------|-------------------|
| `type` | string | Yes | `'fdc3.chat.message'` |
| `chatRoom` | ChatRoom | Yes | `{ type: 'fdc3.chat.room', providerName: 'Symphony', id:{ roomdId: 'j75xqXy25NBOdacUI3FNBH'} }` |
| `message` | [Message](https://fdc3.finos.org/schemas/next/message.schema.json) | Yes | `'A message to send'` |
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved

## Example

```js
const chatMessage = {
type: "fdc3.chat.message",
chatRoom: {
type: 'fdc3.chat.room',
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
},
message: "A message to send"
}
```

## See Also

Intents
- [StartChat](../../intents/ref/StartChat)
- [StartCall](../../intents/ref/StartCall)
- [SendChatMessage](../../intents/ref/SendChatMessage)

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

Reference to a chat room.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add detail on why we need one (to send further messages to the room? to log in a CRM maybe?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Additional text added.


## Type

`fdc3.chat.room`

## Schema

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

## Details

| Property | Type | Required | Example Value |
|-------------|---------|----------|-------------------|
| `type` | string | Yes | `'fdc3.chat.room'` |
| `providerName` | string | Yes | `'Symphony'` |
| `id` | object | Yes | `{ roomId: 'j75xqXy25NBOdacUI3FNBH', anyOtherKey: 'abcdef'}` |
| `uri` | string | No | `'http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA'` |
| `name` | string | No | `'My new room'` |

The `uri` is an universal url to access to the room. It could be opened from a browser, a mobile app, etc...
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The `uri` is an universal url to access to the room. It could be opened from a browser, a mobile app, etc...
The `uri` field should be populated with a URL to access the room, which may be used outside of the context of a Desktop Agent (for example in a browser, mobile application etc.).

Minor comment: is it expected to be a URL or URI? All URLs are URIs but not all URIs are URLs (although I don't know many people that are clear on the distinction). If its always expected to be retreivable in a browser (taking you to a web page where you can access teh item) rather than just acting as an identity, then its a URL (and should be named as such).

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we okay with the updated text @kriswest ?


## Example

```js
const intentResolution = await fdc3.raiseIntent("StartChat", context);

const chatRoom = intentResolution.getResult():

/* // The chatRoom will be like:
chatRoom = {
type: "fdc3.chat.room",
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
uri: "http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA",
name: 'My new room'
};
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd flip the order of the code and context example (to match convention on other pages). See https://fdc3.finos.org/docs/context/ref/Chart for an example

Suggested change
const intentResolution = await fdc3.raiseIntent("StartChat", context);
const chatRoom = intentResolution.getResult():
/* // The chatRoom will be like:
chatRoom = {
type: "fdc3.chat.room",
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
uri: "http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA",
name: 'My new room'
};
*/
const chatRoom = {
type: "fdc3.chat.room",
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
uri: "http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA",
name: 'My new room'
};
//Chat rooms are returned by the StartChat intent as a result
const intentResolution = await fdc3.raiseIntent("StartChat", context);
try {
const chatRoom = await intentResolution.getResult():
} catch (error) {
//chat room was not created...
}

```

## See Also

Other Types
- [ContactList](ContactList)
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved

Intents
- [StartChat](../../intents/ref/StartChat)
- [StartCall](../../intents/ref/StartCall)
- [SendChatMessage](../../intents/ref/SendChatMessage)
- [ViewProfile](../../intents/ref/ViewProfile)
- [ViewResearch](../../intents/ref/ViewResearch)
- [ViewInteractions](../../intents/ref/ViewInteractions)
- [ViewOrders](../../intents/ref/ViewOrders)

FINOS Financial Objects
- [Contact](https://fo.finos.org/docs/objects/contact)
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved
50 changes: 50 additions & 0 deletions docs/intents/ref/SendChatMessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
id: SendChatMessage
sidebar_label: SendChatMessage
title: SendChatMessage
hide_title: true
---
# `SendChatMessage`

Send a message to an existing chat room.

## Intent Name

`SendChatMessage`

## Display Name

`Send Chat Message`

## Possible Contexts

* [ChatMessage](../../context/ref/ChatMessage)

## Example

```js
// Start a chat
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved
const intentResolution = await fdc3.raiseIntent("StartChat", context);
const chatRoom = intentResolution.getResult();

//Some time later

let chatMessage: ChatMessage = {
type: "fdc3.chat.message",
chatRoom,
message: "Another message to send in the room"
}

await fdc3.raiseIntent("SendChatMessage", context, intentResolution.source);
```

## See Also

Context
- [ChatMessage](../../context/ref/ChatMessage)
- [ChatRoom](../../context/ref/ChatRoom)

Intents
* [StartChat](StartChat)
* [StartCall](StartCall)
* [StartEmail](StartEmail)
6 changes: 5 additions & 1 deletion docs/intents/ref/StartChat.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@ const initSettings = {
}

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

// Return a reference to the room
const chatRoom = await resolution.getResult();
```

## See Also

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

Intents
* [SendChatMessage](SendChatMessage)
* [StartCall](StartCall)
* [StartEmail](StartEmail)
3 changes: 3 additions & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"intents/ref/StartCall",
"intents/ref/StartChat",
"intents/ref/StartEmail",
"intents/ref/SendChatMessage",
"intents/ref/ViewAnalysis",
"intents/ref/ViewChart",
"intents/ref/ViewHoldings",
Expand All @@ -64,6 +65,8 @@
"context/ref/Context",
"context/ref/Chart",
"context/ref/ChatInitSettings",
"context/ref/ChatMessage",
"context/ref/ChatRoom",
"context/ref/Contact",
"context/ref/ContactList",
"context/ref/Country",
Expand Down
13 changes: 13 additions & 0 deletions website/static/schemas/next/chatMessage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatMessage.schema.json",
"type": "object",
"title": "ChatMessage",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.message" },
"chatRoom": { "$ref": "chatRoom.schema.json#" },
"message": { "$ref": "message.schema.json#" }
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved
},
"required": ["type", "chatRoom", "message"]
}
15 changes: 15 additions & 0 deletions website/static/schemas/next/chatRoom.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatRoom.schema.json",
"type": "object",
"title": "ChatRoom",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.room" },
"providerName": { "type": "string" },
"id": { "type": "object" },
"uri": { "type": "string" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for this row, should this be updated to url?

"name": { "type": "string" }
},
"required": ["type", "providerName", "id"]
}