Skip to content

Instantly share code, notes, and snippets.

/*
* Expected JSON response
* {
* "to": "+11112223333" ,
* "quote" : "Lorem Ipsum",
* "author" : "Someone famous"
* }
*/
module.exports = function(context, cb) {
module.exports = function(context, cb) {
var Stamplay = require('stamplay');
var stamplay = new Stamplay('APP_ID', 'APP_SECRET');
stamplay.Object('subscription').get({page:1, per_page:100, status:true}, function(err, res) {
var result = JSON.parse(res);
result.data.forEach(function(subscription) {
console.log("sending sms to " + subscription.number);
var stamplay = {
name : "Stamplay",
description: "The best thing ever",
address : "814 Mission st, San Francisco",
_geolocation : {
type: "Point",
coordinates: [-122.404952, 37.784445]
}
};
@Giuliano84
Giuliano84 / stamplay_openweatherapi_sms.js
Last active March 2, 2016 04:04
A codeblock that looks up for weather forecast to OpenWeather API and sends back as text to be sent via SMS using Twilio
module.exports = function(context, cb) {
// request - fetch data from openweather API
var request = require("request");
// moment - easily transform timestamps into formatted dates
var moment = require('moment');
// http://home.openweathermap.org
var APPID = "__YOUR_OPENWEATHER_API_KEY__";
// type is used to find if the user wants the current weather or upcoming forecast.
@Giuliano84
Giuliano84 / stamplay_user_update.json
Created February 18, 2016 19:28
User JSON representation for a Stamplay task
{
"name": {
"fullName": "{{person.body.body.person.name.fullName}}",
"givenName": "{{person.body.body.person.name.givenName}}",
"familyName": "{{person.body.body.person.name.familyName}}"
},
"employment": {
"domain": "{{person.body.body.person.employment.domain}}",
"name": "{{person.body.body.person.employment.name}}",
"title": "{{person.body.body.person.employment.title}}",
@Giuliano84
Giuliano84 / slack_attachment.json
Created February 18, 2016 18:52
Slack attachment configuration for a Stamplay task
[
{
"fallback": "New Signup!.",
"color": "#414b82",
"title": "{{person.body.body.person.name.fullName}}",
"fields": [
{
"title": "Bio",
"value": "{{person.body.body.person.bio}}",
"short": false
/**
* Replace $.ajax on your subdomain with a copy taken
* from your base domain. All jQuery AJAX actions go
* through $.ajax (i.e. $.get, $.post), so it's all good.
*/
(function() {
var iframe,
onload,
queue = [],