Sublime Forum

[Solved] Part of URL is taken automatically as command. In https://hooks... "//" is automatically taking as command

#1

when I type the below code in sublime text
var slack = new Slack(https://hooks.slack.com/services/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,options);

text after https:// is automatically taken as command. I dont want sublime text to take text after https:// as command

since it is a part of URL

0 Likes

#2

what’s the syntax?

0 Likes

#3

var Slack = require(‘node-slack’);
var slack = new Slack(https:hooks.slack.com/services/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,options);
//var slack = new Slack(hook_url,{proxy: http_proxy});

//Trying to send message to slack from Node.js app
//I have used following package https://github.com/xoxco/node-slack

slack.send({
text: ‘Meassage from node.js app to slack!’,
channel: ‘#attendance’,
username: ‘Bot’
});

var fs = require(“fs”);
//reading the file
fs.readFile(‘Attendance01-04-2016.dat’,‘utf8’,function (err,data){
if (err) {
return console.error(err);
}
//spliting each line
var lines = data.split("\n");
//storeing in array and printing the file
for (i=0;i<=lines.length;)
{
console.log(lines[i]);
i=i+1;
}
});

0 Likes

#4

I am not familiar with nodejs.
But should not a string literal URL be quoted in that language? (javascript basically?)

2 Likes

#5

Hi couldn’t understand the words “string literal URL”

I was trying to send messages from a Node.js app to Slack Channel.

I have to use Slack’s incoming-webhooks Url to set up the connection.

But when i type the URL sublime text is showing // as comment. How to represent http://… in sublime text

0 Likes

#6

you need to change your

to var slack = new Slack('https://hooks.slack.com/services/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',options);

so that it is valid JS

2 Likes

#7

Thank you very much kingkeith & jfcherng

0 Likes