Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response or reply with block message? #210

Open
1kko opened this issue Feb 25, 2020 · 1 comment · May be fixed by #229
Open

response or reply with block message? #210

1kko opened this issue Feb 25, 2020 · 1 comment · May be fixed by #229

Comments

@1kko
Copy link

1kko commented Feb 25, 2020

I discovered from slack api that can be using rich messaging called "block".
https://api.slack.com/messaging/composing/layouts

I tried to send using send_webapi(), but it fails.
Is there a way to send it?

msg={
  "channel": "C1H9RESGL",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Danny Torrence left the following review for your property:"
      }
    },
    {
      "type": "section",
      "block_id": "section567",
      "text": {
        "type": "mrkdwn",
        "text": "<https://google.com|Overlook Hotel> \n :star: \n Doors had too many axe holes, guest in room 237 was far too rowdy, whole place felt stuck in the 1920s."
      },
      "accessory": {
        "type": "image",
        "image_url": "https://is5-ssl.mzstatic.com/image/thumb/Purple3/v4/d3/72/5c/d3725c8f-c642-5d69-1904-aa36e4297885/source/256x256bb.jpg",
        "alt_text": "Haunted hotel image"
      }
    },
    {
      "type": "section",
      "block_id": "section789",
      "fields": [
        {
          "type": "mrkdwn",
          "text": "*Average Rating*\n1.0"
        }
      ]
    }
  ]
}

message.send_webapi('',json.dumps(msg)) # fails with slacker.Error: no_text
message.send_webapi('test',json.dumps(msg)) # I only get 'test' text in reply.

@darwing1210
Copy link

@lins05 i would like to work on this as Slacker now supports blocks os/slacker#161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants