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

fix: Fix client.push issue and update README for Slack client verification #1182

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ timeline_cache.json
*.sqlite

characters/
characters/eli.character.json
SumeetChougule marked this conversation as resolved.
Show resolved Hide resolved

packages/core/src/providers/cache
packages/core/src/providers/cache/*
Expand Down
9 changes: 6 additions & 3 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,20 @@ export async function initializeClients(
elizaLogger.log("client keys", Object.keys(clients));

// TODO: Add Slack client to the list
// Initialize clients as an object


if (clientTypes.includes("slack")) {
const slackClient = await SlackClientInterface.start(runtime);
if (slackClient) clients.push(slackClient);
if (slackClient) clients.slack = slackClient; // Use object property instead of push
}

if (character.plugins?.length > 0) {
for (const plugin of character.plugins) {
// if plugin has clients, add those..
if (plugin.clients) {
for (const client of plugin.clients) {
clients.push(await client.start(runtime));
const startedClient = await client.start(runtime);
clients[client.name] = startedClient; // Assuming client has a name property
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion characters/trump.character.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trump",
"clients": [],
"clients": ["slack"],
odilitime marked this conversation as resolved.
Show resolved Hide resolved
"modelProvider": "openai",
"settings": {
"secrets": {},
Expand Down
10 changes: 10 additions & 0 deletions ngrok.log
SumeetChougule marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
t=2024-12-17T11:36:34-0500 lvl=info msg="no configuration paths supplied"
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"
t=2024-12-17T11:36:34-0500 lvl=info msg="open config file" path="/Users/sumeetchougule/Library/Application Support/ngrok/ngrok.yml" err=nil
t=2024-12-17T11:36:34-0500 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040 allow_hosts=[]
t=2024-12-17T11:36:35-0500 lvl=info msg="client session established" obj=tunnels.session
t=2024-12-17T11:36:35-0500 lvl=info msg="tunnel session started" obj=tunnels.session
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
t=2024-12-17T11:36:35-0500 lvl=info msg=start pg=/grpc/agent.Web/State id=ac17e2e0c47a1c5f
t=2024-12-17T11:37:11-0500 lvl=info msg="received stop request" obj=app stopReq="{err:<nil> restart:false}"
t=2024-12-17T11:37:11-0500 lvl=info msg="session closing" obj=tunnels.session err=nil
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
},
"dependencies": {
"@0glabs/0g-ts-sdk": "0.2.1",
"@ai16z/adapter-postgres": "0.1.6-alpha.4",
odilitime marked this conversation as resolved.
Show resolved Hide resolved
"@coinbase/coinbase-sdk": "0.10.0",
"@deepgram/sdk": "^3.9.0",
"@vitest/eslint-plugin": "1.0.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/client-slack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ settings:
7. On the "Basic Information" page, scroll down to "App Credentials"
8. Copy all the credentials - you'll need them in Step 3

### Step 2.5: Verify Event Subscription
Before proceeding to install the app, make sure to verify the event subscription:

1. In your Slack App settings, go to "Event Subscriptions."
2. Enter the request URL (your ngrok HTTPS URL followed by /slack/events).
3. Slack will send a verification request to this URL.
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.
5. Once verified, you will see a confirmation in your Slack app settings.

### Step 3: Configure Environment Variables
1. Create or edit `.env` file in your project root:
```bash
Expand Down
2 changes: 1 addition & 1 deletion packages/client-slack/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ export async function validateSlackConfig(runtime: IAgentRuntime): Promise<Slack
}
throw error;
}
}
}
Loading
Loading