Giter Site home page Giter Site logo

Comments (2)

dblock avatar dblock commented on August 17, 2024

The RealTime client doesn't support attachments, from https://api.slack.com/rtm:

screenshot 2015-11-05 06 58 14

However the web client should allow you to do that. I tried and it didn't work, then I found slackapi/node-slack-sdk#12. You need to to_json the attachments property.

Now the canonical example works:

.chat_postMessage(
  channel: ...,
  text: 'Hello World',
  as_user: true,
  attachments: [
        {
            fallback: "New ticket from Andrea Lee - Ticket #1943: Can't rest my password - https://groove.hq/path/to/ticket/1943",
            pretext: "New ticket from Andrea Lee",
            title: "Ticket #1943: Can't reset my password",
            title_link: "https://groove.hq/path/to/ticket/1943",
            text: "Help! I tried to reset my password but nothing happened!",
            color: "#7CD197"
        }
    ].to_json

I think slack-ruby-client should do this for you, I opened https://github.com/dblock/slack-ruby-client/issues/20.

from slack-ruby-bot.

gconklin avatar gconklin commented on August 17, 2024

Yep! That worked, thanks for digging that up. I've been using your framework for a few months now and it has saved me a bunch of time. Thanks!

from slack-ruby-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.