How to use the twilio.AccessToken.IpMessagingGrant function in twilio

To help you get started, we’ve selected a few twilio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TwilioDevEd / api-snippets / ip-messaging / users / token-generation-server / token-generation-server.2.x.js View on Github external
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
github TwilioDevEd / api-snippets / rest / access-tokens / ip-messaging-example / ip-messaging-example.2.x.js View on Github external
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({
github sagnew / Twilio-IP-Messaging-Plays-Pokemon / index.js View on Github external
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'));
github dialogflow / dialogflow-nodejs-client / samples / twilio / ip-messaging / src / twiliobot.js View on Github external
* 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) {