question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sending attachments / images?

See original GitHub issue

the demo examples here just send a text response, vis:

+       response = text.split('').reverse().join('');
+       channel.send(response);
+       console.log('@%s responded with "%s"', slack.self.name, response);

can this node package be used to send other types of messages, or attachments?

I’ve tried sending JSON like:

 if (reply) {
        // channel.send(reply.string);
        msgpack = {
          type: "message",
          text: reply.string,
          icon_url: "http://laorquesta.mx/wp-content/uploads/2014/12/bikers-300x225.jpg",
          attachment: {
            "color": "#36a64f",
            "title": "drifter bot",
            "title_link": "http://superscriptjs.com/starter/quickstart"
          }
        }
        // channel.send(JSON.stringify(msgpack))
        channel.send(msgpack)

but just get an error back:

{ code: 2, msg: 'message text is missing' }

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
bobalazekcommented, May 22, 2015

I found out, what the problem was / is. You NEED to JSON encode the ‘attachments’ argument, so the ‘attachments’ is actually a string and not an object. Then it should work. At least for me that worked.

0reactions
ghostcommented, Feb 14, 2016

The >= 2.0.0 release will now check this for you, so should be a little easier to use, you can see where it’s doing that here

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Send an Attachment or Photo Through E-mail
This page contains information on how to attach a photo, picture, document, PDF, and other files in popular programs and services.
Read more >
Add pictures or attach files in Outlook.com
You can attach photos and documents from your computer or OneDrive to email messages and calendar events. Attachments always appear at the top...
Read more >
How To Send A Photo As An Email Attachment On Windows ...
Fill out the email form as you normally would then click 'insert' found at the top of the window to add an image...
Read more >
Send attachments with your Gmail message - Android
Add attachments, like files or photos, to your emails. To send large files over the size limit, like videos, use Google Drive. Android...
Read more >
Send a photo or attachment with a message - Twist
While writing a message, tap the photo icon. You now have three options: Choose one or several of the photos available in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found