Javascript 使用Slack';s节点SDK

Javascript 使用Slack';s节点SDK,javascript,node.js,slack,slack-api,Javascript,Node.js,Slack,Slack Api,我正在尝试通过上载文件,但遇到问题。目前,我通过以下代码获得了成功: const res = await client.files.upload({ channel: 'CHANNEL', file: Buffer.from('hello'), filename: 'test.txt', filetype: 'text/plain', }); 响应类似于: { ok: true, file: { id: 'FIDTM4IDM', created: 15688

我正在尝试通过上载文件,但遇到问题。目前,我通过以下代码获得了成功:

const res = await client.files.upload({
  channel: 'CHANNEL',
  file: Buffer.from('hello'),
  filename: 'test.txt',
  filetype: 'text/plain',
});
响应类似于:

{ ok: true,
  file:
   { id: 'FIDTM4IDM',
     created: 1568847491,
     timestamp: 1568847491,
     name: 'test.txt',
     title: 'test',
     mimetype: 'text/plain',
     filetype: 'text',
     pretty_type: 'Plain Text',
     ...
     ...
  }
}
但是,当我检查时,频道中没有显示任何内容。我知道配置正确,因为我可以使用相同的配置将消息发布到频道


属性拼写错误。它被称为
频道
而不是
频道
。因此,API将忽略您的通道属性,文件将上载到Slack,但不会在通道中共享


另外,请确保仅使用通道ID。频道名称不受支持。

Ah nice catch,使用
Channel
而不是
channels
的方法出现在@slack/web api npm自述文件和through me off上,但我现在看到,在方法本身上它使用复数。非常感谢。