bolt-python: Error in chat_postMessage method
I tried the following code:
block = [{"type": "section","text": {"type": "mrkdwn","text": "Erro na consulta " + str(datetime.now())}}]
client_bot.chat_postMessage(channel=channel_id, blocks = block)
And i got the answer:
Failed to run listener function (error: The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
The server responded with: {'ok': False, 'error': 'invalid_blocks', 'errors': ['invalid_url [json-pointer:/blocks/0/slack_file.url]'], 'response_metadata': {'messages': ['[ERROR] invalid_url [json-pointer:/blocks/0/slack_file.url]']}})
This same code ran successfully about four hours earlier, but now it has this error.
Can anyone help me?
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 21 (11 by maintainers)
Glad you got it fixed!
FYI, we actually will be rolling back the new
slack_file
property / feature of image blocks today due to various issues it caused for customers (including the problem you experienced earlier). So please continue using theimage_url
property as I see you are doing in your last screenshot for the time being.I will close this issue now but if you have further issues here, feel free to re-open or file a new issue.
@filmaj i solved!! 😃
I just use the same token at the following parts:
Starting bot at the beggining of code:
Upload file (image) in slack cloud.
And for send file, i used the method below:
Sure! I appreciate contribute into this task!
But i dont fix error yet. Now, i tried like this:
And the block used was:
I got the same error:
Note that infos[0] = “https://indiecapitalworkspace.slack.com/files/U01HSA5NLH4/F06F1SJ08SC/rentabilidades.png”
Sure!
The block is below:
Where:
infos[0] = "https://files.slack.com/files-pri/T01J6BY2VEU-F06ERESRXUZ/rentabilidades.png?pub_secret=aa3396340f"