This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for completing this activity and exporting data to next | |
// activity use $export(error, data) | |
// More help can be found here: http://bmp.io/4uih3ej | |
// sample text provided by user | |
var text = $params.text; | |
// regex to match and extract pattern user want | |
var data = text.match(/^(\/sms)\s+([+\d]+)(.+)/); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Cisco Spark Logging Library for Tropo | |
// | |
// Factory for the Spark Logging Library, with 2 parameters | |
// - the name of the application will prefix all your logs, | |
// - the Spark Incoming integration (to which logs will be posted) | |
// To create an Incoming Integration | |
// - click integrations in the right pane of a Spark Room (Example : I create a dedicated "Tropo Logs" room) | |
// - select incoming integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// QUICK START GUIDE | |
// | |
// 1. Clone this gists and make it private | |
// 2. Create an incoming integratin in a Spark Room from the Spark Web client : http://web.ciscospark.com | |
// 3. Replace YOUR_INTEGRATION_SUFFIX by the integration id, example: Y2lzY29zcGFyazovL3VzL1dFQkhPT0svZjE4ZTI0MDctYzg3MS00ZTdmLTgzYzEtM2EyOGI1N2ZZZZZ | |
// 4. Replace APP by your Tropo application name, example: TropoBootstrap | |
// 5. Create your Tropo application pointing to your raw gist URL, by appending /raw/YOUR_GIST_NAME.js to the gist URL | |
// | |
// Cisco Spark Logging Library for Tropo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This tip shows how to retreive a Spark Room Id with the Cisco Spark API | |
# It leverages curl, jq and base64 commands | |
# Let’s retreive Room Details for "spark4devs" | |
> SPARK_TOKEN="pick your spark token from https://developer.ciscospark.com" | |
> curl -X GET -H "Authorization: Bearer $SPARK_TOKEN" "https://api.ciscospark.com/v1/rooms?max=1000" | jq '.items[] | select(.title | contains("spark4dev"))' | |
{ | |
"id": "Y2lzY29zcGFyazovL3VzL1JPT00vZDJmZGUwOTAtOWQwYy0xMWU1LWFlZWQtMjE3NmZkY2Q4YTU4", | |
"title": "#spark4dev - Public Support for Cisco Spark API", | |
"type": "group", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DO NOT DELETE : this gist is referenced by a live article | |
// | |
// Cisco Spark Logging Library for Tropo | |
// | |
// Factory for the Spark Logging Library, with 2 parameters | |
// - the name of the application will prefix all your logs, | |
// - the Spark Incoming integration (to which logs will be posted) | |
// To create an Incoming Integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DO NOT DELETE : this gist is referenced by a live article | |
// | |
// Cisco Spark Logging Library for Tropo | |
// | |
// Factory for the Spark Logging Library, with 2 parameters | |
// - the name of the application will prefix all your logs, | |
// - the Spark Incoming integration (to which logs will be posted) | |
// To create an Incoming Integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DO NOT DELETE : this gist is referenced by https://www.tropo.com/2016/06/gists-can-help-tropo-scripting-development/ | |
// and https://www.tropo.com/2016/06/devops-follow-tropo-spark/ | |
// returns true or false | |
function isEmail(email) { | |
// extract from http://stackoverflow.com/questions/46155/validate-email-address-in-javascript | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(email); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instructions : | |
// > npm install ciscospark | |
// > CISCOSPARK_ACCESS_TOKEN=XXXXXXXXXX node ciscospark-node-sdk-sample.js | |
// ALL GOOD: message & room created ! | |
var ciscospark = require('ciscospark'); | |
if (!process.env.CISCOSPARK_ACCESS_TOKEN) { | |
console.error("Please set env variable CISCOSPARK_ACCESS_TOKEN, exiting"); | |
process.exit(1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Spark Logging Library | |
// | |
// Factory for the Spark Logging Library, with 2 parameters | |
// - the name of the application will prefix all your logs, | |
// - the Spark Incoming integration (to which logs will be posted) | |
// To create an Incoming Integration | |
// - click integrations in the right pane of a Spark Room (Example : I create a dedicated "Tropo Logs" room) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# note: jq is a lightweight and flexible command-line JSON processor, https://stedolan.github.io/jq/manual/ | |
> SPARK_TOKEN="xxxxxxxxxxxxxxxxxxxxxx" | |
# Number of rooms by default | |
> curl -X GET -H "Authorization: Bearer $SPARK_TOKEN" "https://api.ciscospark.com/v1/rooms" | jq ".items | length" | |
100 |