clonn / slack-node-sdk

slack.com, slack, node sdk
MIT License
167 stars 32 forks source link

Slack Node isn't working for me #47

Closed AcehilmAbegrr closed 6 years ago

AcehilmAbegrr commented 6 years ago

These are steps I took to get it up and running to no avail:

  1. Created a Slack account
  2. Used the example code for testing:
    
    var Slack = require('slack-node');

webhookUri = "__uri___";

slack = new Slack(); slack.setWebhook(webhookUri);

slack.webhook({ channel: "#general", username: "webhookbot", text: "This is posted to #general and comes from a bot named webhookbot." }, function(err, response) { console.log(response); });

3. Used the URL "https://mykoo.slack.com" as the value for webhook uri
4. ran node file.js

I get a response back (200) in the terminal:

{ status: 'fail', statusCode: 200, headers: { 'content-type': 'text/html; charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', date: 'Wed, 11 Jul 2018 13:42:05 GMT', server: 'Apache', expires: 'Mon, 26 Jul 1997 05:00:00 GMT', vary: 'Accept-Encoding', pragma: 'no-cache', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'x-robots-tag': 'noindex,nofollow', 'x-slack-backend': 'h', 'referrer-policy': 'no-referrer', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-xss-protection': '0', 'set-cookie': [ 'b=bth534vl8ug4cs8wwwwgg84w4; expires=Tue, 11-Jul-2028 13:42:05 GMT; Max-Age=315619200; path=/; domain=.slack.com' ], 'x-frame-options': 'SAMEORIGIN', 'x-via': 'haproxy-www-ym1d', 'x-cache': 'Miss from cloudfront', via: '1.1 5d2f8f11fd4049dfdd659b9554b801de.cloudfront.net (CloudFront)', 'x-amz-cf-id': 'hODpdQtsfDyx2B1A3rVDjNt5rJ4jnxdUsKjTE1dYlAjpLMLgtdMGDQ==' }, response: '\n\n\n<!DOCTYPE html>\n\n\n\n\n\t\n\t\n\n \n\n\t\n\t\t\n\n\n\t\t\n\t\t\n\t\n\n\n\n\t\n\n\t\t\t\n\t\n\t\t\n\t\n\n\t\t\n\n\t\n\n\t\n\n\t\n\t\t\n\n\t\n\n\n\n\n\n\t\n\t Slack\n \n \n \n\n\t\n\t\t\n\t\t\t\t\t\t\t\t\t\n\t\n\t\t\n\t\t\t\t\t\n\t\n\t\t\t\t\t\t\n\t\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\n \n\n\t\t\t\n \n\n\t\t\n\n\t\n\n\t\n\t\t\t\n \n \n\n\t\n \n\n\t\n \n \n \n \n \n\n\t\n\n\t\n\t\n\t\t\n\t\n\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\n\n\n\n\t\t \t\t\t\n\t\n \t\n\t\n\t\n\n\t\n\t\t\t\t\t\n\n\t\n\n\n\n\t

\n\n\n\n\n\n\t\n\t
\n\n\t\t
\n\n
\n\t\n\t\n\n
\n\n\t\n
\n\t

\n\tSign in to mykoo\n\t

\n\n\t

mykoo.slack.com

\n\n\t\n\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\t\t\t\n\n\t\t\tEnter your email address and password.

\n\t\t\t\n\n\t\t\t

\n\t\t\t\t\n\t\t\t

\n\n\t\t\t

\n\t\t\t\t\n\t\t\t

\n\n\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t

\n\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\n\t\t\t
\n\t\t\t\tForgot password?\n\t\t\t\t\t\t\t\t\t· Forgot which email you used?\n\t\t\t\t\t\t\t
\n\n\t\t\n\t\t\n\n\n\t
\n\n\t

\n\t\t\t

\n
\n\t\n
\n\t\t\t

\n\t\t\tDon\'t have an account on this workspace yet?\n\t\t\tContact the workspace administrator for an invitation\n\t\t

\n\t\n\t\n\t\t\t

\n\t\t\tTrying to create a workspace?\t\t\t\n\t\n\tCreate a new workspace\n\t\t\t

\n\t
\n\n\t\t\t\t\t\n\t
\n\t
\n
\n\n\n\t\n\n\n\n\n\n\n\n\n\n\t\n\n\n\n\n\n\n\t\t\n\t\n\n\n\t\n\n\n\n\t\n\n\t\t\t\t\t\n\n\n\n\n\t\n\n\n\t\n\n\n\n\n\t\t\t\t\t\n\t\n\t\n\n\t\n\n\n\n\n\n\n\n\t\t\t\n\n\n\n\n\n\n\n\n' }



But when I check my channel #general nothing gets posted. What can I do to resolve this?
AcehilmAbegrr commented 6 years ago

Dumb issue. uri is obtained by making a slack app through their website and then following the steps. Might be good if this step was mentioned in the documentation.