MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / indexSlackMessage

Method indexSlackMessage

server/src/db/addie-db.ts:416–447  ·  view source on GitHub ↗

* Store a Slack message for local search * Uses upsert to avoid duplicates based on channel_id + ts

(input: SlackMessageInput)

Source from the content-addressed store, hash-verified

414 * Uses upsert to avoid duplicates based on channel_id + ts
415 */
416 async indexSlackMessage(input: SlackMessageInput): Promise<void> {
417 // Create a title from the first 100 chars of the message
418 const title = input.text.substring(0, 100) + (input.text.length > 100 ? '...' : '');
419
420 await query(
421 `INSERT INTO addie_knowledge (
422 title, category, content, source_url, source_type,
423 slack_channel_id, slack_channel_name, slack_user_id, slack_username, slack_ts, slack_permalink,
424 created_by
425 ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
426 ON CONFLICT (slack_channel_id, slack_ts) WHERE source_type = 'slack'
427 DO UPDATE SET
428 content = EXCLUDED.content,
429 title = EXCLUDED.title,
430 slack_username = EXCLUDED.slack_username,
431 updated_at = NOW()`,
432 [
433 title,
434 'slack',
435 input.text,
436 input.permalink,
437 'slack',
438 input.channel_id,
439 input.channel_name,
440 input.user_id,
441 input.username,
442 input.ts,
443 input.permalink,
444 'system',
445 ]
446 );
447 }
448
449 /**
450 * Search Slack messages stored locally using PostgreSQL full-text search

Callers 3

indexChannelMessageFunction · 0.80
indexMessageFunction · 0.80
indexMessageForSearchFunction · 0.80

Calls 1

queryFunction · 0.85

Tested by

no test coverage detected