Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require('dotenv').load();
var http = require('http');
var path = require('path');
var AccessToken = require('twilio').AccessToken;
var IpMessagingGrant = AccessToken.IpMessagingGrant;
var express = require('express');
// Create Express webapp
var app = express();
app.use(express.static(path.join(__dirname, 'public')));
/*
Generate an Access Token for a chat application user - it generates a random
username for the client requesting a token, and takes a device ID as a query
parameter.
*/
app.get('/token', function(request, response) {
var appName = 'TwilioChatDemo';
var identity = "John Doe";
var deviceId = request.query.device;
// Create a unique ID for the client on their current device
var AccessToken = require('twilio').AccessToken;
var IpMessagingGrant = AccessToken.IpMessagingGrant;
// Used when generating any kind of tokens
var twilioAccountSid = 'ACxxxxxxxxxx';
var twilioApiKey = 'SKxxxxxxxxxx';
var twilioApiSecret = 'xxxxxxxxxxxx';
// Used specifically for creating IP Messaging tokens
var serviceSid = 'ISxxxxxxxxxxxxx';
var appName = 'HipFlowSlackDockRC';
var identity = 'user@example.com';
var deviceId = 'someiosdeviceid';
var endpointId = appName + ':' + identity + ':' + deviceId;
// Create a "grant" which enables a client to use IPM as a given user,
// on a given device
var ipmGrant = new IpMessagingGrant({
var browserify = require('browserify-middleware');
var mustache = require('mustache-express');
var express = require('express');
var app = express();
var AccessToken = require('twilio').AccessToken;
var IpMessagingGrant = AccessToken.IpMessagingGrant;
var port = process.env.WEPLAY_PORT || 3000;
var redis = require('./redis')();
process.title = 'weplay-web';
app.listen(port);
console.log('listening on *:' + port);
app.engine('mustache', mustache());
app.set('views', __dirname + '/views');
app.use('/main.js', browserify('./client/app.js'));
app.use(express.static(__dirname + '/public'));
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const apiai = require('apiai');
const uuid = require('node-uuid');
const request = require('request');
const TwilioIPMessaging = require('twilio-ip-messaging');
const TwilioCommon = require('twilio-common');
var AccessToken = require('twilio').AccessToken;
var IpMessagingGrant = AccessToken.IpMessagingGrant;
module.exports = class TwilioBot {
get apiaiService() {
return this._apiaiService;
}
set apiaiService(value) {
this._apiaiService = value;
}
get botConfig() {
return this._botConfig;
}
set botConfig(value) {