Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Whinnery kwhinnery

  • Twilio
  • Saint Paul / Minneapolis
View GitHub Profile
View index.js
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const app = express();
app.use(bodyParser.urlencoded({ extended: false });
app.post('/sms', (req, res) => {
const twiml = new MessagingResponse();
View package.json
{
"name": "Kevin's Mod",
"version": "0.1.x",
"dependencies": {
"twilio": "4.x"
},
"engines": {
"twilioquest": "3.1.x"
},
"twilioquest": {
View app.js
app.post('/message', function(req, res, next) {
// Use the REST client to send a text message
client.messages.create({
to: req.body.to,
from: TWILIO_PHONE_NUMBER,
body: 'Good luck on your Twilio quest!'
}).then(function(message) {
// When we get a response from Twilio, respond to the HTTP POST request
res.send('Message is inbound!');
}).catch(function(error) {
View queries.js
const pool = require('./config');
require('dotenv').config()
const getUsers = (request, response) => {
pool.connect().then(client => {
client.query('SELECT * FROM users ORDER BY id ASC', (error, results) => {
if (error) {
throw error
}
response.status(200).json(results.rows)
View index.js
const express = require('express')
const app = express()
app.post('/sms', (request, response) => {
let twiml = `
<Response>
<Message>hey there, thanks for checking out my demo!</Message>
</Response>
`;
View airtable_update.js
/* global module, exports, require, process, console */
'use strict'
const Airtable = require('airtable')
// Configure Airtable database
const base = new Airtable({
apiKey: process.env.AIRTABLE_API_KEY}
).base(process.env.AIRTABLE_DATABASE)
View app.rb
require 'sinatra'
require 'twilio-ruby'
sid = ''
tkn = ''
app_sid = ''
capability = Twilio::Util::Capability.new sid, tkn
capability.allow_client_outgoing(app_sid)
View example.jade
html
head
title Socket.io Example
body
h1(class="something") Socket.io Example
input#msg(type="text")
button send message
#messages
@kwhinnery
kwhinnery / readme.md
Last active Sep 16, 2016
Proposal for SDK packaging
View readme.md

Proposal for JavaScript SDK packaging

Right now, the Twilio client-side SDKs feel like they are designed and shipped by dozens of people. By making some changes to the Twilio SDK CDN and our module sructure, we could address some of these issues.

Include the latest everything from CDN

For onboarding and getting started, we could include a "kitchen sink" artefact that bundles up the latest version of every Twilio client-side SDK.

<script src="//media.twiliocdn.com/js/twilio.min.js"></script>
View Example.java
// Install the Java helper library from twilio.com/docs/java/install
import org.joda.time.LocalDate;
import com.twilio.rest.Twilio;
import com.twilio.rest.resource.api.v2010.account.call.FeedbackSummary;
public class Example {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";
You can’t perform that action at this time.