slackapi / slackapi/node-slack-sdk
web-api: Blocks in client.conversations.history are different to blocks that use in message posting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.4k
- Forks
- 688
- Avg merge
- 15h 31m
- Merged PRs (30d)
- 27
Description
Description
If I want to copy message from one channel to another, or if I want to edit something in message, when I use TS and bolt js, I can't do it.
For example:
const result = await client.conversations.history({
channel: FROM_CHANNEL,
latest: TARGET_TS,
inclusive: true,
limit: 1,
});
if (result.messages !== undefined) {
const message = result.messages[0];
if (message) {
await client.chat.postMessage({
channel: TO_CHANNEL,
text: message.text,
blocks: message.blocks,
});
await client.chat.update({
channel: FROM_CHANNEL,
ts: TARGET_TS,
blocks: [{type: 'divider'}, ...message.blocks],
});
}
In both cases, I've got error with blocks field. ConversationsHistoryResponse Block have many differences to normal Block type. For example field type declared to be string|undefined in first, and string in second.
Are those types correspond to reality?
If so, maybe we can create some converter, that will check blocks from conversations.history and fix them, so they will be OK to use as KnownBlocks?
What type of issue is this? (place an x in one of the [ ])
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x in each of the [ ])
- [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x ] I've read and agree to the Code of Conduct.
- [x ] I've searched for any related issues and avoided creating a duplicate issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names client.conversations.history, chat.postMessage, and chat.update as the entry points. Read their TypeScript block types first and confirm whether returned blocks are valid inputs; done requires a decided, tested resolution for the incompatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100