Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
claude-api-slack
Advanced tools
Slack Conversation Library for ClaudeAI.
import cloud from '@lafjs/cloud'
const token = 'xoxp' // slack user token
const bot = 'U05' // claude appid
const chatId = "chat-7890" // 房间名
let text = '讲个故事'
export async function main(ctx: FunctionContext) {
const { Authenticator } = await import('claude-api-slack')
// 相当于 ChatGPT 的新建一个回话的 回话 ID,为固定值
const conversationId = cloud.query.conversationId
// 通过缓存保存客户端,可以避免每次提问都是在新回话
let claudeClient = await cloud.shared.get('claudeClient')
if (!claudeClient) {
claudeClient = new Authenticator(token, bot)
await cloud.shared.set('claudeClient', claudeClient)
}
// 创建频道并返回房间 ID:channel,创建完房间 ID 是不会变的
const channel = await claudeClient.newChannel(chatId)
// 开始第一次提问
let result = await claudeClient.sendMessage({
text,
channel,
conversationId: 'ed3f4d9f-8d59-482e-8e1d-65d33ddcefb6',
onMessage: (originalMessage) => {
// 流式加载
// console.log(originalMessage)
}
})
console.log('==============1\n', result)
// 开始第二次提问
text = '接着讲,接下来进入修仙情节'
result = await claudeClient.sendMessage({
text, channel,
conversationId: result.conversationId,
onMessage: (originalMessage) => {
console.log(originalMessage)
}
})
// return { data: 'hi, laf' }
}
〉》点击【Create an app】
〉》主页看见 Your Apps 并弹出窗口【Create an app】 〉》点击【From scratch】
〉》填写 app 名称以及选择工作空间(例:name: Bot, workspace: chat) 〉》点击【Create App】
〉》点击左侧边栏上的【OAuth & Permissions】 〉》下拉至【Scopes】卡片,在【User Token Scopes】项下添加权限,如下:
channels:history, channels:read, channels:write, groups:history, groups:read, groups:write,
chat:write, im:history, im:write, mpim:history, mpim:write
〉》回到顶部【OAuth Tokens for Your Workspace】栏,点击【Install to Workspace】,然后确认授权即可
至此,获得拥有一定权限的 user-token
Credits Thank you to:
FAQs
slack Authentication Library for ClaudeAI.
The npm package claude-api-slack receives a total of 5 weekly downloads. As such, claude-api-slack popularity was classified as not popular.
We found that claude-api-slack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.