Skip to content

Commit 78dd9f1

Browse files
authored
Merge pull request elizaOS#1182 from SumeetChougule/main
fix: Fix client.push issue and update README for Slack client verification
2 parents a21b124 + 2c432a3 commit 78dd9f1

File tree

6 files changed

+2858
-18135
lines changed

6 files changed

+2858
-18135
lines changed

agent/src/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,20 @@ export async function initializeClients(
400400
elizaLogger.log("client keys", Object.keys(clients));
401401

402402
// TODO: Add Slack client to the list
403+
// Initialize clients as an object
404+
405+
403406
if (clientTypes.includes("slack")) {
404407
const slackClient = await SlackClientInterface.start(runtime);
405-
if (slackClient) clients.push(slackClient);
408+
if (slackClient) clients.slack = slackClient; // Use object property instead of push
406409
}
407410

408411
if (character.plugins?.length > 0) {
409412
for (const plugin of character.plugins) {
410-
// if plugin has clients, add those..
411413
if (plugin.clients) {
412414
for (const client of plugin.clients) {
413-
clients.push(await client.start(runtime));
415+
const startedClient = await client.start(runtime);
416+
clients[client.name] = startedClient; // Assuming client has a name property
414417
}
415418
}
416419
}

characters/trump.character.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trump",
3-
"clients": [],
3+
"clients": ["slack"],
44
"modelProvider": "openai",
55
"settings": {
66
"secrets": {},

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
},
5353
"dependencies": {
5454
"@0glabs/0g-ts-sdk": "0.2.1",
55+
"@ai16z/adapter-postgres": "0.1.6-alpha.4",
5556
"@coinbase/coinbase-sdk": "0.10.0",
5657
"@deepgram/sdk": "^3.9.0",
5758
"@vitest/eslint-plugin": "1.0.1",

packages/client-slack/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ settings:
7878
7. On the "Basic Information" page, scroll down to "App Credentials"
7979
8. Copy all the credentials - you'll need them in Step 3
8080
81+
### Step 2.5: Verify Event Subscription
82+
Before proceeding to install the app, make sure to verify the event subscription:
83+
84+
1. In your Slack App settings, go to "Event Subscriptions."
85+
2. Enter the request URL (your ngrok HTTPS URL followed by /slack/events).
86+
3. Slack will send a verification request to this URL.
87+
4. Ensure your server is running and configured to respond to the url_verification event by echoing back the challenge token provided in the request.
88+
5. Once verified, you will see a confirmation in your Slack app settings.
89+
8190
### Step 3: Configure Environment Variables
8291
1. Create or edit `.env` file in your project root:
8392
```bash

packages/client-slack/src/environment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ export async function validateSlackConfig(runtime: IAgentRuntime): Promise<Slack
4141
}
4242
throw error;
4343
}
44-
}
44+
}

0 commit comments

Comments
 (0)