Skip to content

Commit 45ec8ff

Browse files
Fix client.push issue and update README for Slack client verification
1 parent 81d0273 commit 45ec8ff

File tree

8 files changed

+22203
-16938
lines changed

8 files changed

+22203
-16938
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ timeline_cache.json
3939
*.sqlite
4040

4141
characters/
42+
characters/eli.character.json
4243

4344
packages/core/src/providers/cache
4445
packages/core/src/providers/cache/*

agent/src/index.ts

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

393393
// TODO: Add Slack client to the list
394+
// Initialize clients as an object
395+
396+
394397
if (clientTypes.includes("slack")) {
395398
const slackClient = await SlackClientInterface.start(runtime);
396-
if (slackClient) clients.push(slackClient);
399+
if (slackClient) clients.slack = slackClient; // Use object property instead of push
397400
}
398401

399402
if (character.plugins?.length > 0) {
400403
for (const plugin of character.plugins) {
401-
// if plugin has clients, add those..
402404
if (plugin.clients) {
403405
for (const client of plugin.clients) {
404-
clients.push(await client.start(runtime));
406+
const startedClient = await client.start(runtime);
407+
clients[client.name] = startedClient; // Assuming client has a name property
405408
}
406409
}
407410
}

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": {},

ngrok.log

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
t=2024-12-17T11:36:34-0500 lvl=info msg="no configuration paths supplied"
2+
t=2024-12-17T11:36:34-0500 lvl=info msg="using configuration at default config path" path="/Users/sumeetchougule/Library/Application Support/ngrok/ngrok.yml"
3+
t=2024-12-17T11:36:34-0500 lvl=info msg="open config file" path="/Users/sumeetchougule/Library/Application Support/ngrok/ngrok.yml" err=nil
4+
t=2024-12-17T11:36:34-0500 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040 allow_hosts=[]
5+
t=2024-12-17T11:36:35-0500 lvl=info msg="client session established" obj=tunnels.session
6+
t=2024-12-17T11:36:35-0500 lvl=info msg="tunnel session started" obj=tunnels.session
7+
t=2024-12-17T11:36:35-0500 lvl=info msg="started tunnel" obj=tunnels name=command_line addr=http://localhost:3000 url=https://3982-2601-188-c301-7910-e984-6479-ce16-f2ea.ngrok-free.app
8+
t=2024-12-17T11:36:35-0500 lvl=info msg=start pg=/grpc/agent.Web/State id=ac17e2e0c47a1c5f
9+
t=2024-12-17T11:37:11-0500 lvl=info msg="received stop request" obj=app stopReq="{err:<nil> restart:false}"
10+
t=2024-12-17T11:37:11-0500 lvl=info msg="session closing" obj=tunnels.session err=nil

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
},
5454
"dependencies": {
5555
"@0glabs/0g-ts-sdk": "0.2.1",
56+
"@ai16z/adapter-postgres": "0.1.6-alpha.4",
5657
"@coinbase/coinbase-sdk": "0.10.0",
5758
"@deepgram/sdk": "^3.9.0",
5859
"@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)