Skip to content

Instantly share code, notes, and snippets.

View nokenwa's full-sized avatar

Nathaniel Okenwa nokenwa

View GitHub Profile
@nokenwa
nokenwa / incoming.twiml.xml
Created September 14, 2020 14:13
Twiliomatic: Build an app that says hello world
<Response>
<Say>
Hello world
</Say>
</Response>
@nokenwa
nokenwa / incoming.twiml.xml
Created September 14, 2020 14:11
Twiliomatic: Build an app that says hello world
<Response>
<Say>
Hello world
</Say>
</Response>
{
"description": "Mother's Day",
"states": [
{
"name": "Trigger",
"type": "InitialState",
"properties": {
"offset": {
"x": -60,
"y": -590
const cloudinary = require('cloudinary').v2;
exports.handler = function(context, event, callback){
const pictureWidth = 1200;
const pictureHeight = 1600;
const ratio = pictureWidth / pictureHeight;
const message = `${event.message} - ${event.Name}`;
const cloudinary = require('cloudinary').v2;
const { promisify } = require('util');
const uploadImage = promisify(cloudinary.uploader.upload); //YOU NEED TO SETUP AN ENVIRONMENT VARIABLE WITH 'CLOUDINARY_URL'
exports.handler = function(context, event, callback){
const pictureWidth = parseFloat(1200);
const pictureHeight = parseFloat(1600);
const ratio = pictureWidth / pictureHeight;
@nokenwa
nokenwa / index.js
Last active January 15, 2020 16:06
Receive Restaurants based on Location Data in a Whatsapp Message (Twilio Function)
const axios = require("axios");
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.MessagingResponse();
if (!event.Latitude || !event.Longitude) {
twiml.message("If you would like some food, please send me your location.");
callback(null, twiml);
} else {
const location = {
lat: event.Latitude,
@nokenwa
nokenwa / sendVoicmail.js
Created June 20, 2019 14:55
Grab Voicemail and send link to audio as a text to personal phone number
exports.handler = function(context, event, callback) {
const client = context.getTwilioClient();
const voicemail = event.RecordingUrl;
//Get Caller ID
client.calls(event.CallSid).fetch()
.then(call =>{
const messageBody = 'You have a new voicemail from ' + call.From + ': ' + voicemail +'.mp3';
@nokenwa
nokenwa / receiveCall.js
Created June 20, 2019 14:42
A Twilio Function that checks your calendar and either forwards your calls to your mobile number or records a voicemail
exports.handler = function(context, event, callback) {
const moment = require('moment');
const { google } = require('googleapis');
const cal = google.calendar({
version: 'v3',
auth: context.GoogleAPIKEY
});