> For the complete documentation index, see [llms.txt](https://wiki.4thtech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.4thtech.io/developers/sdk/ethereum/chat/ongroupconversationcreated.md).

# onGroupConversationCreated

{% hint style="info" %}
Reference for SDK 0.5.x (production-ready, stable). See [Status](https://wiki.4thtech.io/developers/sdk/status.md).
{% endhint %}

Sets up a listener for when a new group conversation is created.

### Usage

```ts
const creatorAddress = '0x...';

// Listen to all group conversations created by the specified sender
chat.onGroupConversationCreated(
  creatorAddress,
  (sender, conversationHash, conversationName, members) => {
    console.log(sender);
    console.log(conversationHash);
    console.log(conversationName);
    console.log(members);
  },
);

// Listen to all group conversations created by any sender
chat.onGroupConversationCreated(null, (sender, conversationHash, conversationName, members) => {
  console.log(sender);
  console.log(conversationHash);
  console.log(conversationName);
  console.log(members);
});
```

#### Stop watching

```ts
// Listen to all group conversations created by any sender
const stopWatching = chat.onGroupConversationCreated(
  null,
  (sender, conversationHash, conversationName, members) => {
    console.log(sender);
    console.log(conversationHash);
    console.log(conversationName);
    console.log(members);
  },
);

// ... Later, to stop watching for the events
stopWatching();
```

### Returns

`UnwatchFn`

A function that can be invoked to stop watching for new event logs.

### Parameters

#### sender

* **Type** `Address | null`

The group creator's address. If set to null, it listens for group conversations created by any sender.

#### callback

* **Type** `(sender: Address, conversationHash: ConversationHash, conversationName: string, members: Address[]) => void`

A callback function that will be executed when a new group conversation is detected. This callback is passed four arguments:

* `sender`: The creator's address.
* `conversationHash`: The hash of the created conversation.
* `conversationName`: The name of the group conversation.
* `members`: Array containing the addresses of the members of the created group conversation.
