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
# To add a comment to this gist via Postman : | |
POST https://api.github.com/gists/054ac70210d3c5e246db/comments | |
> Content-Type: application/json | |
> Authorization: token 8432627eacef6b3da4c1e2530986c66ZZZZZZZ | |
{ | |
"body": "My comment from the API Workshop by Cisco DevNet" | |
} | |
# Get the whole Postman collection : |
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
import urllib2 | |
log( "v20160417 - 0602" ) | |
answer() | |
say( "Welcome to the python Yahoo weather reader" ) | |
log( "outgoing call: before" ) | |
urlRead = urllib2.urlopen( "http://requestb.in/zd4mlazd" + "?input=hello" ) |
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
import urllib | |
import urllib2 | |
version = "v20160417 - 0702" | |
log( version ) | |
answer() | |
say( "Welcome to the python v" + version ) |
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
import json | |
import urllib2 | |
version = "v20160417 - 0720" | |
log( version ) | |
webhook = "http://requestb.in/zd4mlazd" | |
answer() |
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
// Is it an incoming call ? | |
if (currentCall) { | |
log("TROPO_EU_TESTERS, incoming call"); | |
log("TROPO_EU_TESTERS, callId: " + currentCall.id); | |
log("TROPO_EU_TESTERS, sessionId: " + currentCall.sessionId); | |
if (currentCall.channel == "VOICE") { | |
log("TROPO_EU_TESTERS, incoming call, network:VOICE"); | |
say("Thanks for joining Tropo Europe Testers service."); | |
wait(1000); |
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
call(phonenumber, { network: "SMS" }); | |
say (msg); | |
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 function writes the log parameter to a Spark Room | |
// Invoke this function from the Tropo token-url with the "sparkIntegration" parameter set to the incoming Webhook ID you'll have prepared | |
function log2spark(newLogEntry) { | |
log("TROPO-LOGS-TO-SPARK: checking integration is well defined"); | |
if (!sparkIntegration) { | |
log("TROPO-LOGS-TO-SPARK: integration not defined, cannot send request to spark"); | |
throw { message: ("no incoming integration identifier") }; | |
} | |
log("TROPO-LOGS-TO-SPARK: integration defined, continuing"); |
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
// Example of a POST request sent from the Tropo scripting platform | |
// Note that this example comes from : https://support.tropo.com/hc/en-us/articles/206241213-REST-POST-and-GET-in-each-Scripting-language | |
// | |
// Quick setup : | |
// - go to http://requestb.in and create a new POST bin | |
// - create a tropo scripting application with this gist source | |
// https://gist.github.com/ObjectIsAdvantag/9ced65903766cfba7ba1760df2fb394a/raw/tropo-post-request.js | |
// - invoke the tropo application via its text or voice token URL | |
// do not forget to add a requestBinId query parameter | |
// ex : https://api.tropo.com/1.0/sessions?action=create&token=XXXXXXXXXXXXXXXX&requestBinId=1k6xjg51 |
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 |
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) |