Slack API Invalid block for image from Slack

Viewed 1347

I use Python slackclient's module for handling interactive message.

I create and post a message successfully with an "accessory" image:

{
  "type": "section",
  ...
  "accessory": {
    "type": "image",
    "image_url": "https://avatars0.githubusercontent.com/u/44036562",
    "alt_text": "GitHub Worflow"
  }
}

After the user interaction Slack send me back my message that I handle to edit the same one with some alteration.

My edit is to remove the last element of my message to change it to something else.

I then post my message to Slack API and received an error:

{
  'response_metadata': {
    'messages': [
       '[ERROR] invalid additional property: fallback [json-pointer:/blocks/1/accessory]', 
       '[ERROR] invalid additional property: image_width [json-pointer:/blocks/1/accessory]', 
       '[ERROR] invalid additional property: image_height [json-pointer:/blocks/1/accessory]', 
       '[ERROR] invalid additional property: image_bytes [json-pointer:/blocks/1/accessory]'
    ]
  }
}

Apparently Slack add fields fallback, image_width, image_height and image_bytes to the image type element but don't allow us to send it back as it.

My solution is to parse all my message to detect images type and remove these keys.

It work but it's not really optimal, these keys should be whether allowed or not sent from Slack.

The error is a response from Slack API not a slackclient validation.

Did someone know where I can report this?

0 Answers
Related