marchfederico / node-sparkclient Goto Github PK
View Code? Open in Web Editor NEWA simple implementation of the Cisco Spark APIs
License: MIT License
A simple implementation of the Cisco Spark APIs
License: MIT License
I am unable to find how to send a html message using
client.createMessage(trigger.data.roomId, 'Hi, I am the Hello World bot!', { "html":true }, function(err, message) {
if (err) {
console.log("WARNING: could not post message to room: " + command.message.roomId);
return;
}
});
in this case hello becomes bold but world does not become red.
Goal: Send an attachment via a relative path
I have successfully attached a file to a create message request using the documented mechanism (http://site/file). I'm looking to do this with a relate file path (or even absolute within the site structure). Attempting to do so always results in an error (Unable to retrieve content.). Placing code to read the file just prior to sending the message successfully returns the contents of the file. I've tried with both "file" and "files" in an attempt to get this to work. I've also tried true relative and absolute paths using the file system structure.
Thoughts?
var readmePath = path.join(__dirname, 'README.md');
fs.readFile(readmePath, function(err, data) {
if (err)
console.log(err);
console.log(data);
});
console.log(readmePath);
var messageParams = {};
messageParams.file = readmePath;
messageParams.markdown = true;
spark.createMessage(command.message.roomId, "Here is the document you requested.", messageParams, function(err, message) {
if (err) {
console.log("WARNING: could not post attachment to room: " + command.message.roomId);
console.log(err);
return;
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.