<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Flybase - Medium]]></title>
        <description><![CDATA[Real-time web development with the Flybase.io API - Medium]]></description>
        <link>https://medium.com/data-mcfly?source=rss----a7bc0f42ccd8---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Flybase - Medium</title>
            <link>https://medium.com/data-mcfly?source=rss----a7bc0f42ccd8---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:34:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/data-mcfly" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Manage Your Data With Indexes]]></title>
            <link>https://medium.com/data-mcfly/manage-your-data-with-indexes-b336e2b485ed?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/b336e2b485ed</guid>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Mon, 19 Dec 2016 22:41:43 GMT</pubDate>
            <atom:updated>2016-12-19T22:41:42.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qP28q-35AuHm9vzuKayhGw.png" /></figure><p>We’ve mentioned <a href="http://ift.tt/2gj3IAW">before</a> about our roll out of nextgen features, and we are starting to roll these out now.</p><p>We’ve rolled out the <a href="http://ift.tt/2fOelwb">queues</a>, and now this week we’ve launched our schema builder.</p><p>This is a very basic schema builder, after you’ve added a few records to a collection, you can set rules for each field, such as field types (number, string or mixed), index rules such as unique or required (or unique and required).</p><p>This gives you more control over your data, and also cuts down on doing things like searching to see if a record exists before adding it, now you just save it and that was it.</p><p>Some other rules will be coming shortly, followed by our new GraphQL API which is shaping up beautifully and is in testing with a few users now. Then we’ll be launching the rest of our nextgen features, but we are rolling these out one by one so that people can play with them as they roll out and not have a ton of new features hit them at once.</p><p>Originally Published on <a href="http://ift.tt/2glfJea">The Flybase Blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b336e2b485ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/manage-your-data-with-indexes-b336e2b485ed">Manage Your Data With Indexes</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to filter your content in real-time with the Sift Ninja API and Flybase]]></title>
            <link>https://medium.com/data-mcfly/how-to-filter-your-content-in-real-time-with-the-sift-ninja-api-and-flybase-204c59184ea3?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/204c59184ea3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Fri, 25 Nov 2016 21:24:34 GMT</pubDate>
            <atom:updated>2016-11-25T21:24:34.270Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have an app that involves letting users enter content of any kind, regardless if it’s chat, discussion boards, or a social site, you want to have the ability to filter content to make sure it is appropriate.</p><p><a href="http://ift.tt/2fKI3mf">Sift Ninja</a> provides a handy API that does just that, and combined with Flybase, you can offer real-time content checking before posting it anywhere.</p><h4>Getting Started</h4><p>To get started, you’ll need two things:</p><ol><li>A Sift Ninja account, <a href="http://ift.tt/2fKI3mf">sign up here</a> if you don’t already have one.</li><li>A Flybase account, <a href="http://ift.tt/2g2cabA">sign up here</a> if you don’t already have one.</li></ol><h4>Setting up Sift Ninja</h4><p>When you set up your Sift Ninja account, you’ll be asked to create a custom channel, name it whatever you want. This will then give you a unique URL as well as your API key.</p><h4>Setting up Flybase</h4><p>Inside your Flybase account, create an app called <em>siftninja</em>, you’ll want that and your API key.</p><h4>Setting up our Node app.</h4><p>Our node app is going to be really simple, from your terminal type:</p><pre>$ npm init<br>$ npm install --save finalhandler flybase siftninja serve-static</pre><p>This will install the node modules we need for our app.</p><h4>The backend</h4><p>Create a file called index.js, which will contain a Flybase listener to check content entered on our chat page:</p><pre>var finalhandler = require(&#39;finalhandler&#39;)<br>var http = require(&#39;http&#39;)<br>var serveStatic = require(&#39;serve-static&#39;)<br>var path = require(&#39;path&#39;);<br><br>var flybase = require(&#39;flybase&#39;);<br>var flybaseRef = flybase.init(&#39;siftninja&#39;, &quot;chat&quot;, &#39;&lt;YOUR-FLYBASE-API-KEY&gt;&#39;);<br><br>var apikey = &#39;&lt;YOUR-SIFT-NINJA-API-KEY&gt;&#39;;<br>var url = &#39;&lt;YOUR-SIFT-NINJA-URL&gt;&#39;;<br>var siftninja = require(&quot;siftninja&quot;)(url, apikey);<br><br>flybaseRef.on(&quot;check_content&quot;, function( req ) {<br>        var req = JSON.parse( req );<br>        var message = req.message;<br>        var sessionKey = req.session;<br>        siftninja( message ).then(function(result) {<br>                var result = result.body;<br>                result.message = message;<br>                if( result.response ){<br>                        var text = (&#39;&#39; + message).replace( /[&lt;&gt;]/g, &#39;&#39; );<br>                        flybaseRef.push({text:text});<br>                }else{<br>                        flybaseRef.trigger( &quot;results_&quot;+sessionKey, result );<br>                }<br>        });<br>});<br><br>var serve = serveStatic(&#39;public&#39;, {<br>        maxAge: &#39;1d&#39;,<br>        &#39;index&#39;: [&#39;index.html&#39;],<br>        fallthrough: true<br>});<br><br>// Create server<br>var server = http.createServer(function onRequest (req, res) {<br>        serve(req, res, finalhandler(req, res))<br>})<br><br>// Listen<br>var port = process.env.PORT || 3000;<br>server.listen( port, function() {<br>        console.log(&#39;Server started on port &#39; + port );<br>});</pre><p>This will create a custom event listener called check_content, which will check the message for any inappropriate text and return the results back to our frontend app.</p><p>If response was true, then the text was ok, and we save it to our Flybase app, and thus let it appear in the chat window.</p><p>If the response was false, then there was a problem with the text and we notify the user who entered it and do not save it. We’ll pass a unique session id for the user, which lets us respond to that user without notifying all other users.</p><h4>The Frontend</h4><p>Create a folder called public and inside that folder, create a file called index.html:</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>        &lt;title&gt;Flybase and Sift Ninja&lt;/title&gt;<br> &lt;link href=&quot;http://ift.tt/2apRjw3&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u&quot; crossorigin=&quot;anonymous&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>        &lt;br /&gt;<br>        &lt;div class=&quot;container well&quot;&gt;<br>                &lt;h2&gt;Enter Chat and press enter&lt;/h2&gt;<br>         &lt;div class=&quot;form-group&quot;&gt;<br>                        &lt;input type=&quot;text&quot; id=&quot;input&quot; class=&quot;form-control&quot; placeholder=&quot;Enter your message&quot;&gt;<br>                &lt;/div&gt;<br>         &lt;hr /&gt;<br>                &lt;h3&gt;Chat Output&lt;/h3&gt;<br>         &lt;ul class=&quot;list-group&quot; id=&quot;chatbox&quot;&gt;&lt;/ul&gt;<br> &lt;/div&gt;<br> &lt;script src=&quot;http://ift.tt/2fKJ9hY&quot;&gt;&lt;/script&gt;<br> &lt;script&gt;<br>                var flybase = new Flybase(&quot;&lt;YOUR-FLYBASE-API-KEY&gt;&quot;, &quot;siftninja&quot;, &quot;chat&quot;);<br><br>                if (sessionStorage.getItem(&quot;sessionKey&quot;)) {<br>                        var sessionKey = sessionStorage.getItem(&quot;sessionKey&quot;);<br>                }else{<br>                        var sessionKey = uniqueID();<br>                        sessionStorage.setItem(&quot;sessionKey&quot;, sessionKey);<br>                }<br><br>                function $(id) { return document.getElementById(id); }<br>                var box = $(&#39;chatbox&#39;), input = $(&#39;input&#39;), name = $(&#39;nameInput&#39;);<br><br>                input.addEventListener(&#39;keyup&#39;, function(e) {<br>                        if ((e.keyCode || e.charCode) === 13) {<br>                                flybase.trigger(&#39;check_content&#39;, {message:input.value,session:sessionKey});<br>                        }<br>                });<br><br>                flybase.on(&quot;results_&quot;+sessionKey, function(data){<br>                        if( !data.response ){<br>                                displayChatMessage( &#39;&amp;uarr; &lt;strong&gt;Sift ninja found something bad!&lt;/strong&gt;&#39; );<br>                        }<br>                });<br><br>                function displayChatMessage( str ){<br>                        box.innerHTML =  &quot;&lt;li class=&#39;list-group-item&#39;&gt;&quot; + str + &#39;&lt;/li&gt;&#39; + box.innerHTML;<br>                }<br><br>                flybase.once(&#39;value&#39;, function (data) {<br>                        if( data.count() ){<br>                                data.forEach( function(message){<br>                                        displayChatMessage(message.value().text );<br>                                });<br>                        }<br>                });<br><br>                flybase.on(&#39;added&#39;, function (message) {<br>                        displayChatMessage( message.value().text );<br>                });<br><br>                function uniqueID(){<br>                        function chr4(){<br>                                return Math.random().toString(16).slice(-4);<br>                        }<br>                        return chr4() + chr4() + &#39;-&#39; + chr4() + &#39;-&#39; + chr4() + &#39;-&#39; + chr4() + &#39;-&#39; + chr4() + chr4() + chr4();<br>                }<br>        &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>We’ve kept this app simple, when the user hits the enter key on their text it sends an event to our backend via Flybase and then listens for a reply.</p><p>We assign our chat users a unique session ID that follows them for the life of that browser session, this then lets us add a unique listening event called <em>results_&lt;SESSIONKEY&gt; </em>that we can use to pass any issues we’ve found directly back to that user.</p><h4>Finishing Up</h4><p>You can see the original <a href="http://ift.tt/2g29QBF">repo here</a>.</p><p>Feel free to expand on what this can do, as Sift Ninja is a handy tool to have in your arsenal and the guys behind it are solid in this area, and combining it with Flybase’s real-time events lets you check content entered in real-time before saving it to your database or forwarding it to other users.</p><p>Originally Published on <a href="http://ift.tt/2g2g7gM">The Flybase Blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=204c59184ea3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/how-to-filter-your-content-in-real-time-with-the-sift-ninja-api-and-flybase-204c59184ea3">How to filter your content in real-time with the Sift Ninja API and Flybase</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running self-hosted Sentry on Heroku]]></title>
            <link>https://medium.com/data-mcfly/running-self-hosted-sentry-on-heroku-ac2c019cf5d0?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/ac2c019cf5d0</guid>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Tue, 09 Aug 2016 17:36:51 GMT</pubDate>
            <atom:updated>2016-08-09T21:35:45.019Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Sentry is a real-time event logging and aggregation platform. At its core it specializes in monitoring errors and extracting all the information needed to do a proper post-mortem without any of the hassle of the standard user feedback loop.</em></p><p>The guys at <a href="https://getsentry.com/">Sentry</a> provide a great product for monitoring web apps and alerting people of any issues.</p><p>We use Sentry heavily here at Flybase, from monitoring our APIs, to monitoring our various sites. If any errors occur then we get notified right away so we can assign and fix them ASAP.</p><p>Sentry provides a hosted model and a self-hosted model. We use the self-hosted model and wanted to share how it’s set up on Heroku.</p><p>We have a <a href="https://github.com/flybaseio/sentry-on-heroku/blob/master/app.json">repo</a> set up which is a fork of the original <a href="https://github.com/fastmonkeys/sentry-on-heroku">Fast Monkey</a> repo. The main differences are the original repo required you to use a paid redis instance rather than a hobby instance and also we changed how the background worker is handled. Minor changes, but handy when wanting a quick start.</p><p>One thing to note, I do recommend switching this to a hobby instance later when you are ready to use this full time as it keeps your sentry instance up 24/7, but that is up to you and not necessary.</p><h3>Setting it up</h3><h4>Auto setup</h4><p>From the <a href="https://github.com/flybaseio/sentry-on-heroku">repo</a> you can actually get started quickly by pushing the purple Deploy to Heroku button, this will start the process of setting up your Sentry app.</p><p>Once set up, you need to create your first user:</p><pre>heroku run &quot;sentry --config=sentry.conf.py createuser&quot; --app YOURAPPNAME</pre><p>Finally you want to configure the worker:</p><pre>heroku ps:scale worker=0 beat=0 worker_plus_beat=1 --app YOURAPPNAME</pre><h4>Manual setup</h4><p>Follow the steps below to get Sentry up and running on Heroku:</p><p>1) Create a new Heroku application. Replace “APP_NAME” with your application’s name:</p><pre>heroku apps:create APP_NAME</pre><p>2) Add PostgresSQL to the application:</p><pre>heroku addons:create heroku-postgresql:hobby-dev</pre><p>3) Add Redis to the application:</p><pre>heroku addons:create heroku-redis:hobby-dev</pre><p>4) Set Django’s secret key for cryptographic signing and Sentry’s shared secret for global administration privileges:</p><pre>heroku config:set SECRET_KEY=$(python -c &quot;import base64, os; print(base64.b64encode(os.urandom(40)).decode())&quot;)</pre><p>5) Set the absolute URL to the Sentry root directory. The URL should not include a trailing slash. Replace the URL below with your application’s URL:</p><pre>heroku config:set SENTRY_URL_PREFIX=https://sentry-example.herokuapp.com</pre><p>6) Deploy Sentry to Heroku:</p><pre>git push heroku master</pre><p>7) Run Sentry’s database migrations:</p><pre>heroku run &quot;sentry --config=sentry.conf.py upgrade --noinput&quot;</pre><p>8) Create a user account for yourself:</p><pre>heroku run &quot;sentry --config=sentry.conf.py createuser&quot;</pre><p>9) Configure workers</p><pre>heroku ps:scale worker=0 beat=0 worker_plus_beat=1</pre><h4>Email notifications</h4><p>Follow the steps below, if you want to enable Sentry’s email notifications:</p><p>1) Add SendGrid add-on to your Heroku application:</p><pre>heroku addons:create sendgrid</pre><p>2) Set the reply-to email address for outgoing mail:</p><pre>heroku config:set SERVER_EMAIL=sentry@example.com</pre><h4>Working with Sentry</h4><p>When you login to Sentry, you can create projects, each project will get assigned a unique URL to use with your tracking.</p><p>Once setup, you can use Sentry for just about any type of client, for example to add Sentry to your front end Javascript apps, you would use the Raven client:</p><pre>&lt;script src=&quot;https://cdn.ravenjs.com/3.3.0/raven.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script&gt;<br>        Raven.config(&#39;https://YOUR-SENTRY-URL/&lt;project&gt;&#39;).install()<br>&lt;/script&gt;</pre><p>Then you can catch errors or send messages pretty easily:</p><p><strong>Reporting Errors:</strong></p><p>By default, Raven makes a best effort to capture any uncaught exception.</p><p>To report errors manually, wrap potentially problematic code with a try…catch block and call Raven.captureException:</p><pre>try {<br>    doSomething(a[0])<br>} catch(e) {<br>    Raven.captureException(e)<br>}</pre><p><strong>Capturing Messages:</strong></p><p>Sentry can be used to capture any message not just Exceptions:</p><pre>Raven.captureMessage(&#39;Broken!&#39;)</pre><p><strong>Tracking Users:</strong></p><p>Sentry can also be told to associate errors with user data, for example we can set it to associate errors with the logged in user:</p><pre>Raven.setUserContext({<br>    email: &#39;matt@example.com&#39;,<br>    id: &#39;123&#39;<br>})</pre><p>If at any point, the user is no longer authenticated, then you can call Raven.setUserContext() with no arguments to remove their data.</p><p><strong>tags</strong></p><p>You can assign tags to an event:</p><pre>Raven.setTagsContext({ version: &quot;1.0.4&quot; });</pre><p><strong>Getting Back an Event ID:</strong></p><p>An event id is a globally unique id for the event that was just sent. This event id can be used to find the exact event from within Sentry.</p><p>This is often used to display for the user and report an error to customer service.</p><p>Raven.lastEventId() will be undefined until an event is sent. After an event is sent, it will contain the string id.</p><pre>Raven.captureMessage(&#39;Broken!&#39;)<br>alert(Raven.lastEventId())</pre><p><strong>User Feedback:</strong></p><p>Often you might find yourself wanting to collect additional feedback from the user. Sentry supports this via an embeddable widget.</p><pre>try {<br>    handleRouteChange(...)<br>} catch (err) {<br>    Raven.captureException(err);<br>    Raven.showReportDialog();<br>}</pre><p><strong>Sentry and Angular:</strong></p><p>The Sentry Raven client also has a plugin for Angular that can integrate directly into your apps (it has integrations for nearly everything):</p><pre>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://cdn.ravenjs.com/3.3.0/angular/raven.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script&gt;<br>        Raven.config(&#39;https://YOUR-SENTRY-URL/&lt;project&gt;&#39;).install();<br>        var myApp = angular.module(&#39;myApp&#39;, [<br>  &#39;ngRaven&#39;,<br>  &#39;ngRoute&#39;,<br>  &#39;myAppControllers&#39;,<br>  &#39;myAppFilters&#39;<br>]);<br>&lt;/script&gt;</pre><p>You can find a lot of information on the actual <a href="https://docs.getsentry.com/on-premise/">Sentry Docs page</a>, I just wanted to show some of the basics to get started.</p><p>Sentry is a powerful tool for monitoring your apps, and once you add plugins such as Slack notifications, you can get notified right away in case of problems.</p><p>We chose to run Sentry on Heroku so it’s kept separate from our other servers and able to not be affected by any server issues.</p><p>Originally Published on <a href="http://blog.flybase.io/2016/07/28/sentry-heroku/">The Flybase Blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac2c019cf5d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/running-self-hosted-sentry-on-heroku-ac2c019cf5d0">Running self-hosted Sentry on Heroku</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The CSS-Tricks Complete Guide to Flexbox]]></title>
            <link>https://medium.com/data-mcfly/the-css-tricks-complete-guide-to-flexbox-23c3bf16d4cd?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/23c3bf16d4cd</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[the-flybase-blog]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Tue, 21 Jun 2016 15:58:38 GMT</pubDate>
            <atom:updated>2016-06-21T15:58:38.268Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">CSS-Tricks</a>:</p><blockquote>The Flexbox Layout (Flexible Box) module (currently a W3C Last Call Working Draft) aims at providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word “flex”).</blockquote><blockquote>The main idea behind the flex layout is to give the container the ability to alter its items’ width/height (and order) to best fill the available space (mostly to accommodate to all kind of display devices and screen sizes). A flex container expands items to fill available free space, or shrinks them to prevent overflow.</blockquote><blockquote>Most importantly, the flexbox layout is direction-agnostic as opposed to the regular layouts (block which is vertically-based and inline which is horizontally-based). While those work well for pages, they lack flexibility (no pun intended) to support large or complex applications (especially when it comes to orientation changing, resizing, stretching, shrinking, etc.).</blockquote><p>We’re in the middle of our next generation version of the Flybase dashboard and Flexbox is an interesting layout module that we’ve been working with. This guide has come in handy a few times.</p><p>You can read the rest of the guide here, and I highly recommend you do if you are interested in Flexbox at all.</p><p><em>Originally Published on </em><a href="http://blog.flybase.io/2016/06/18/flexbox/"><em>The Flybase Blog</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23c3bf16d4cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/the-css-tricks-complete-guide-to-flexbox-23c3bf16d4cd">The CSS-Tricks Complete Guide to Flexbox</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Salesforce Powered Call Center with Flybase and Twilio]]></title>
            <link>https://medium.com/data-mcfly/building-a-salesforce-powered-call-center-with-flybase-and-twilio-d4b42b0429ac?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/d4b42b0429ac</guid>
            <category><![CDATA[twilio]]></category>
            <category><![CDATA[call-center]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Tue, 23 Feb 2016 17:19:00 GMT</pubDate>
            <atom:updated>2016-02-23T17:19:05.584Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*WOaPFzQolov30vB7.jpg" /></figure><p><em>In the world of telephony, an automated call distribution (ACD) system, is a system that distributes incoming calls to a specific group of agents based on the customer’s selection, customer’s telephone number, selected incoming line to the system, or time of day the call was processed. We also call this a call center</em>.</p><p>A couple years ago, Twilio’s <a href="https://github.com/choppen5">Charles Oppenheimer</a> built a demo of a Salesforce embeddable <a href="https://github.com/choppen5/client-acd">ACD</a> using Twilio Client and Ruby.</p><p>Many thanks to Charles for sharing that demo. We have simply taken that demo and converted it to Node.js with a Flybase powered backend to handle the distribution of calls, rather than the original Ruby / Mongo system, the result is a cleaner call center that’s easy to modify and integrate into other CRMs.</p><h3>What we’ll be using:</h3><ul><li><a href="https://flybase.io/"><strong>Flybase.io</strong></a> as our backend, handling storing data, passing events and our call queues.</li><li><a href="https://www.twilio.com/webrtc"><strong>Twilio Client</strong></a> is WebRTC interface to Twilio. In our demo we are using the javascript library which gives us an API and connection to Twilio to receive the call within our Salesforce browser delivering the call via WebRTC. Twilio client also gives us the ability to control the call via our soft phone.</li><li><strong>Heroku</strong> will be used as our webhost, but you can host your call center anywhere you’d like.</li><li><strong>Salesforce Open CTI</strong> is an open API to allow third party CTI vendors to connect telephony channels into the Salesforce CRM interface. In our demo we use Open CTI to house our soft phone and drive the click to dial/text functionality. The demo requires no plugins or installed software thanks to the design of Open CTI. For more info see <a href="https://developer.salesforce.com/page/Open_CTI">the developer guide</a>.</li></ul><p><em>The actual salesforce integration is optional, and you can easily insert your softphone into another CRM. Part 2 of this tutorial will actually use flybase to build a simple CRM with the softphone included as a widget.</em></p><h3>Getting started</h3><p>You can find the full source code <a href="https://github.com/flybaseio/callcenter">here</a>.</p><p>First, let’s set up our node.js app.</p><p>Create package.json:</p><pre>{ <br>  &quot;name&quot;: &quot;callcenter&quot;, <br>   &quot;version&quot;: &quot;0.0.1&quot;, <br>   &quot;description&quot;: &quot;Client ACD powered by Flybase, Twilio and Node.js&quot;, <br>   &quot;main&quot;: &quot;app.js&quot;, <br>   &quot;repository&quot;: &quot;https://github.com/flybaseio/callcenter&quot;,<br>   keywords&quot;: [ <br>    &quot;twilio&quot;, &quot;data mcfly&quot;, &quot;flybase&quot;, &quot;twilio&quot;, &quot;sms&quot; <br>   ], <br>   &quot;author&quot;: &quot;Roger Stringer&quot;, <br>   &quot;license&quot;: &quot;MIT&quot;, <br>   &quot;dependencies&quot;: { <br>     &quot;body-parser&quot;: &quot;~1.4.2&quot;, <br>     &quot;ejs&quot;: &quot;~0.8.5&quot;, <br>     &quot;express&quot;: &quot;~3.4.8&quot;, <br>     &quot;flybase&quot;: &quot;1.7.2&quot;, <br>     &quot;less-middleware&quot;: <br>     &quot;~0.2.1-beta&quot;, <br>     &quot;method-override&quot;: &quot;~2.0.2&quot;, <br>     &quot;moment&quot;: &quot;~2.5.1&quot;, <br>     &quot;node-buzz&quot;: &quot;~1.1.0&quot;, <br>     &quot;twilio&quot;: &quot;~1.6.0&quot; <br>   }, <br>   &quot;engines&quot;: { <br>    &quot;node&quot;: &quot;0.12&quot; <br>   } <br>}</pre><p>This will tell our call center what modules we want to install for our node app.</p><p>Now, we want to create our app.js file to handle all our backend work:</p><pre>var express = require(&#39;express&#39;);<br>var bodyParser = require(&#39;body-parser&#39;);<br>var methodOverride = require(&#39;method-override&#39;);<br>var path = require(&#39;path&#39;);<br>var q = require(&#39;q&#39;);<br>var bluebird = require(&#39;bluebird&#39;);<br><br>var config = require( path.join(__dirname, &#39;app&#39;, &#39;config&#39;) );<br><br>var app = express();<br>app.set(&#39;views&#39;, path.join(__dirname, &#39;app&#39;, &#39;views&#39;));<br>app.engine(&#39;html&#39;, require(&#39;ejs&#39;).renderFile);<br>app.set(&#39;view engine&#39;, &#39;html&#39;);<br>app.use(bodyParser.json());<br>app.use(bodyParser.urlencoded({	extended: true	}));<br>app.use(express.static( path.join(__dirname, &#39;app&#39;, &#39;public&#39;)));<br> <br>var port = process.env.PORT || 5000; // set our port<br><br><br>var twilio = require(&#39;twilio&#39;);<br>var client = twilio(config.twilio.sid, config.twilio.token);<br><br>var flybase = require(&#39;flybase&#39;);<br>var callsRef = flybase.init(config.flybase.app_name, &quot;calls&quot;, config.flybase.api_key);<br>var agentsRef = flybase.init(config.flybase.app_name, &quot;agents&quot;, config.flybase.api_key);<br>var queueid = &#39;&#39;;<br>var good2go = false;<br><br>// backend routes =========================================================<br>client.queues.list(function(err, data) {<br>	var to_go = data.queues.length;<br>	data.queues.forEach(function(queue) {<br>		if( queue.friendlyName === config.twilio.queueName ){<br>			queueid = queue.sid;<br>			console.log( &quot;Queueid = #&quot; + queueid + &quot; for #&quot; +  config.twilio.queueName );<br>			good2go = true;<br>		}<br>		to_go--;<br>		if( to_go == 0 ){<br>			if( queueid === &#39;&#39; ){<br>				client.queues.create({<br>					friendlyName: config.twilio.queueName<br>				}, function(err, queue) {<br>					queueid = queue.sid;<br>				});	<br>			}<br>		}<br>	});<br>});<br><br>// listen for events via Flybase...<br><br>// if an agent gets disconnected then we log them off...<br>agentsRef.on(&#39;agent-removed&#39;, function (data) {<br>	var data = JSON.parse( data );<br>	console.log( data.username + &quot; has left the building&quot;);<br>	update_agent(data.username,{<br>		status: &#39;LoggedOut&#39;<br>	});	<br>});<br><br>// return number of agents with status set to Ready<br>agentsRef.on(&#39;get-ready-agents&#39;, function (data) {<br>	var adNag = function() {<br>		agentsRef.where({&quot;status&quot;: &#39;Ready&#39;}).on(&#39;value&#39;,function( rec ){<br>			console.log( rec.count() + &#39; agents are Ready&#39; );<br>			if( rec.count() ){<br>				agentsRef.trigger(&#39;agents-ready&#39;, rec.count() );<br>			}else{<br>				agentsRef.trigger(&#39;agents-ready&#39;, &quot;0&quot; );<br>			}<br>		});<br>	};<br>	setTimeout(adNag, 1500);<br>});<br><br>//	listen for outgoing calls<br>app.post(&#39;/dial&#39;, function (req, res) {<br>	var phonenumber = req.param(&#39;PhoneNumber&#39;);<br>	var dial_id = config.twilio.fromNumber;<br>	if( typeof req.param(&#39;CallerID&#39;) !== &#39;undefined&#39; ){<br>		var dial_id = req.param(&#39;CallerID&#39;);<br>	}<br>	var twiml = new twilio.TwimlResponse();<br>	twiml.dial(phonenumber, { <br>		callerId:dial_id<br>	});<br>	console.log(&quot;Response text for /dial post = #&quot;, twiml.toString());<br>	res.writeHead(200, {<br>		&#39;Content-Type&#39;:&#39;text/xml&#39;<br>	});<br>	res.end( twiml.toString() );<br>});<br><br><br>//	listen for incoming calls<br>app.post(&#39;/voice&#39;, function (req, res) {<br>	var queuename = config.twilio.queueName;<br>	var sid = req.param(&#39;CallSid&#39;);<br>	var callerid = req.param(&#39;Caller&#39;);<br><br>	var addtoq = 0;<br>	var dialqueue = &#39;&#39;;<br>	var client_name = &#39;&#39;;<br>	<br>	//	search for agent who has been set to `Ready` for the longest time and connect them to the caller...<br>	getlongestidle(true, function( bestclient ){<br>		if( bestclient ){<br>			console.log(&quot;Routing incoming voice call to best agent = #&quot;, bestclient);<br>			var client_name = bestclient;<br>		}else{<br>			console.log( &#39;no agent was found, adding caller to #&#39;, config.twilio.queueName );<br>			var dialqueue = queuename;<br>			addtoq = 1;<br>		}<br>	<br>		var twiml = new twilio.TwimlResponse();<br>		if( addtoq ){<br>			twiml.say(&quot;Please wait for the next available agent&quot;,{<br>				voice:&#39;woman&#39;<br>			}).enqueue(config.twilio.queueName);<br>		}else{<br>			twiml.dial({<br>				&#39;timeout&#39;:&#39;10&#39;,<br>				&#39;action&#39;:&#39;/handledialcallstatus&#39;,<br>				&#39;callerId&#39;:callerid<br>			}, function(node) {<br>				this.client( client_name );<br>			});<br>			update_call(sid, {<br>				&#39;sid&#39;: sid,<br>				&#39;agent&#39;: client_name,<br>				&#39;status&#39;: &#39;ringing&#39;<br>			});<br>		}<br>		console.log(&quot;Response text for /voice post = #&quot;, twiml.toString());<br>	<br>		res.writeHead(200, {<br>			&#39;Content-Type&#39;:&#39;text/xml&#39;<br>		});<br>		res.end( twiml.toString() );<br>	});<br>});<br><br>app.post(&#39;/handledialcallstatus&#39;, function (req, res) {<br>	var sid = req.param(&#39;CallSid&#39;);<br>	var twiml = new twilio.TwimlResponse();<br><br>	if( req.param(&#39;DialCallStatus&#39;) == &#39;no-answer&#39; ){<br>		callsRef.where({&quot;sid&quot;: sid}).on(&#39;value&#39;,function( rec ){<br>			if( rec.count() !== null ){<br>				var sidinfo = rec.first().value();<br>				if( sidinfo ){<br>					var agent = sidinfo.agent;<br>					update_agent(agent, {<br>						&#39;status&#39;: &#39;missed&#39;<br>					});<br>				}<br>				// Change agent status for agents that missed calls<br>			}<br>			//	redirect and try to get new agent...<br>			twiml.redirect(&#39;/voice&#39;);<br>		});<br>	}else{<br>		twiml.hangup();<br>	}<br>	console.log(&quot;Response text for /handledialcallstatus post = #&quot;, twiml.toString());<br>	res.writeHead(200, {<br>		&#39;Content-Type&#39;:&#39;text/xml&#39;<br>	});<br>	res.end( twiml.toString() );<br>});<br><br>// assign a twilio call token to the agent<br>app.get(&#39;/token&#39;, function(req, res) {<br>	var client_name = &quot;anonymous&quot;;<br>	if( typeof req.param(&quot;client&quot;) !== &quot;undefined&quot; ){<br>		client_name = req.param(&quot;client&quot;);<br>	}<br>	<br>	var capability = new twilio.Capability( config.twilio.sid, config.twilio.token );<br>	capability.allowClientIncoming( client_name );<br>	capability.allowClientOutgoing( config.twilio.appid );<br>    var token = capability.generate();<br><br>    res.end(token);	<br>});<br><br>// return flybase info to the softphone...<br>app.get(&#39;/getconfig&#39;, function(req, res) {<br>	res.json({<br>		app_name: config.flybase.app_name,<br>		api_key: config.flybase.api_key<br>	});<br>});<br><br>// return a phone number<br>app.get(&#39;/getcallerid&#39;, function(req, res) {<br>	var client_name = &quot;anonymous&quot;;<br>	if( typeof req.param(&quot;from&quot;) !== &quot;undefined&quot; ){<br>		client_name = req.param(&quot;from&quot;);<br>	}<br>	res.end( config.twilio.fromNumber );<br>});<br><br><br>app.post(&#39;/track&#39;, function(req, res) {<br>	<br>});<br><br>app.get(&#39;/&#39;, function(req, res) {<br>	var client_name = &quot;anonymous&quot;;<br>	if( typeof req.param(&quot;client&quot;) !== &quot;undefined&quot; ){<br>		client_name = req.param(&quot;client&quot;);<br>	}<br>	<br>	res.render(&#39;index&#39;, {<br>		client_name: client_name,<br>		anycallerid: &#39;none&#39;<br>	});<br>}); <br><br>var server = app.listen(port, function() {<br>	console.log(&#39;Listening on port %d&#39;, server.address().port);<br>});<br><br><br>// various functions =========================================================<br><br>//	find the caller who&#39;s been `Ready` the longest<br>function getlongestidle( callrouting, callback ){<br>	if( callrouting ){<br>		agentsRef.where({&quot;status&quot;: &quot;DeQueing&quot;}).orderBy( {&quot;readytime&quot;:-1} ).on(&#39;value&#39;).then(function( data ){<br>			var agent = data.first().value();<br>			callback( agent.client );<br>		},function(err){<br>			agentsRef.where({&quot;status&quot;: &quot;Ready&quot;}).orderBy( {&quot;readytime&quot;:-1} ).on(&#39;value&#39;).then(function( data ){<br>				var agent = data.first().value();<br>				callback( agent.client );<br>			},function(err){<br>				callback( false );<br>			});<br>		});<br>	}else{<br>		agentsRef.where({&quot;status&quot;: &quot;Ready&quot;}).orderBy( {&quot;readytime&quot;:-1} ).on(&#39;value&#39;).then(function( data ){<br>			var agent = data.first().value();<br>			callback( agent.client );<br>		},function(err){<br>			callback( false );<br>		});<br>	}<br>}<br><br><br>// check if user exists and if they do then we update, otherwise we insert...<br>function update_agent(client, data, cb){<br>	var d = new Date();<br>	var date = d.toLocaleString();<br>	var callback = cb || null;<br>	agentsRef.where({&quot;client&quot;: client}).once(&#39;value&#39;).then( function( rec ){<br>		var agent = rec.first().value();<br>		for( var i in data ){<br>			agent[i] = data[i];<br>		}<br>		agentsRef.push(agent, function(resp) {<br>			console.log( &quot;agent updated&quot; );<br>			if( callback !== null ){<br>				callback();<br>			}<br>		});<br>	},function(err){<br>		data.client = client;<br>		agentsRef.push(data, function(resp) {<br>			console.log( &quot;agent inserted&quot; );<br>			if( callback !== null ){<br>				callback();<br>			}<br>		});<br>	});<br>}<br><br>function update_call(sid, data){<br>	var d = new Date();<br>	var date = d.toLocaleString();<br>	callsRef.where({&quot;sid&quot;: sid}).on(&#39;value&#39;).then( function( rec ){<br>		var call = rec.first().value();<br>		for( var i in data ){<br>			call[i] = data[i];<br>		}<br>		callsRef.push(call, function(resp) {<br>			console.log( &quot;call updated&quot; );<br>		});				<br>	},function(err){<br>		data.sid = sid;<br>		callsRef.push(data, function(resp) {<br>			console.log( &quot;call inserted&quot; );<br>		});				<br>	});<br>}<br><br>// call queue handling =========================================================<br>var qsum = 0;<br>var checkQueue = function() {<br>	qsum += 1;<br>	var qsize = 0;<br>	var readyagents = 0;<br>	var qname = config.twilio.queueName;<br>	client.queues(queueid).get(function(err, queue) {<br>		qsize = queue.currentSize;<br>		console.log( &#39;There are #&#39; + qsize + &#39; callers in the queue (&#39; + queueid + &#39;)&#39; );<br>		if( qsize &gt; 0 ){<br>			agentsRef.where({&quot;status&quot;: &quot;Ready&quot;}).orderBy( {&quot;readytime&quot;:-1} ).on(&#39;value&#39;).then(function( agents ){<br>				var readyagents = agents.count();<br>				var bestclient = agents.first().value();<br>				console.log(&quot;Found best client - routing to #&quot; + bestclient.client + &quot; - setting agent to DeQueuing status so they aren&#39;t sent another call from the queue&quot;);<br>				update_agent(bestclient.client, {status: &quot;DeQueing&quot; }, function(){<br>					console.log(&#39;redirecting call now!&#39;);<br>					client.queues(queueid).members(&quot;Front&quot;).update({<br>						url: config.twilio.dqueueurl,<br>						method: &quot;POST&quot;<br>					}, function(err, member) {<br>//							console.log(member.position);<br>					});<br>				});<br>			},function(err){<br>				console.log(&quot;No Ready agents during queue poll #&quot; + qsum);<br>			});<br>			agentsRef.trigger(&#39;agents-ready&#39;, readyagents );<br>			agentsRef.trigger(&#39;in-queue&#39;, qsize );<br><br>			// restart the check checking<br>			setTimeout(checkQueue, 3000);		<br>		}else{<br>			// restart the check checking<br>			console.log(&quot;No callers found during queue poll #&quot; + qsum);<br>			setTimeout(checkQueue, 3000);		<br>		}<br>	});	<br>};<br>setTimeout(checkQueue, 1500);</pre><p>There’s a lot happening in this file. First, we require our various libraries and set up express, then we start our actual work.</p><p>You’ll notice we set up to Flybase references:</p><ul><li>callsRef connects to our calls table and handles storing and retrieving information for incoming calls.</li><li>agentsRef conncts to our agents table and handles storing and retrieving information for agents.</li></ul><p>The first backend task we handle is checking our twilio queues to retrieve the queueid or our call queue, or else create it if it doesn’t exist. We use this queue for storing incoming calls if there are no agents available in our call center, and they stay inside the queue until an agent is available.</p><p>Then we set up event listeners for two events:</p><ul><li>agent-removed: when an agent logs out, then we update their user record to set them to not ready</li><li>get-ready-agents: just returns the number of agents currently set to Ready.</li></ul><p>Then we have our actual URI end points:</p><ul><li>/dial is a POST request which is handled by Twilio to make outgoing calls between the agent’s web browser and a phone number.</li><li>/voice is a POST request which handle incoming calls from phone numbers. This works by finding the agent that has had their status set to Ready for the longest time and assigning them to the call. If not agent is Ready then we place the caller in a queue and check it later.</li><li>/handdialcallstatus is a POST request that is called when a call finishes. It checks to see if the call was answered, not answered and depending on the DialCallStatus returned from Twilio, either place the caller back into the queue and take the agent out of Ready status, or hang up the call as it assumes the call is done.</li><li>/token is a GET request called via an ajax call on the frontend to assign a Twilio Client Capability Token to the agent while they are logged in</li><li>/getconfig is a GET request called also via ajax call from the client which returns the call center’s Flybase settings for the softphone to use in the frontend.</li><li>/ is a GET request which displays the softphone, and assigns a name to the client based on the ?client query string.</li></ul><p>We have three backbone functions that are used by the call center to handle various purposes:</p><ul><li>getlongestidle is a function which checks for either an agent who’s status is set to Ready or DeQueing and returns that agent’s client name. In case of no agents being found, then we return false and it places the caller in their queue. DeQueing is a special status we’ll be setting at the end of our code as an agent becomes available.</li><li>update_agent will take the agent’s id and update their account in the Flybase database with new info, such as status updates when on a call, going offline, etc.</li><li>update_call is used in the same way as update_agent but for tracking calls.</li></ul><p>Finally, we have the queue handling, this is a function called checkQueue, which is called 1.5 seconds after the app loads and then every 3 seconds, and performs a simple task:</p><ol><li>It enters into a loop to return all callers in the call queue</li><li>If there are callers waiting to connect to agents, then it will look for the agent with their status set to Ready and who have been ready the longest by sorting by the readytime field.</li><li>If an agent is Ready, then we set that agent’s status to DeQueing and connect the caller at the Front of the queue to that agent by calling our dqueueurl.</li><li>If no agents are Ready, or no callers are in the queue, then we set a timeout to call the function again in 3 seconds and return to step 1 of the checkQueue loop.</li></ol><p>We next want to create a folder called app and then inside that folder create a file called config.js:</p><pre>module.exports = { <br>  twilio: {  <br>    sid: &quot;ACCOUNT-SID&quot;,  <br>    token: &quot;AUTH-TOKEN&quot;,  <br>    appid: &#39;APP-ID&#39;,<br>    fromNumber : &quot;TWILIO-NUMBER&quot;,<br>    welcome : &quot;Thank you for calling.&quot;,<br>    hangup : false,  queueName: &quot;cnacd&quot;,  <br>    dqueueurl:&quot;http://yourwebsite.com/voice&quot; <br>  },flybase: {<br>    api_key: &quot;YOUR-API-KEY&quot;,<br>    app_name: &quot;YOUR-FLYBASE-APP&quot;<br>  };</pre><p>Update this file to contain your Twilio information, and your Flybase information.</p><p>For the Twilio information, you’ll need to create an Twiml App inside your Twilio account, create the app and have it POST to your call center website at /dial.</p><p>Also, create a new phone number inside Twilio and have that phone number POST to your call center website at /voice.</p><p>There is a variable called queueName which is the name of the queue you want your call center to use, and also a variable called dqueueurl, this is the URL to your website with /voice appended to it. You will need this for the dequeuing task as Twilio requires an absolute URL.</p><h3>The softphone</h3><p>Inside the app folder, create two folders:</p><p>Now, inside public, create a file called index.html:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>	&lt;title&gt;Twilio Softphone&lt;/title&gt;<br>	&lt;script type=&quot;text/javascript&quot; src=&quot;https://static.twilio.com/libs/twiliojs/1.2/twilio.min.js&quot;&gt;&lt;/script&gt;  <br>	&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js&quot;&gt;&lt;/script&gt;<br>	&lt;script src=&quot;https://na15.salesforce.com/support/api/31.0/interaction.js&quot;&gt;&lt;/script&gt;<br>	&lt;script src=&quot;https://na15.salesforce.com/support/console/31.0/integration.js&quot;&gt;&lt;/script&gt;<br>	&lt;script src=&quot;https://cdn.flybase.io/flybase.js&quot;&gt;&lt;/script&gt;<br>	&lt;script type=&quot;text/javascript&quot; src=&quot;/js/softphone.js&quot;&gt;&lt;/script&gt;<br>	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/dialer.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>	&lt;div id=&quot;client_name&quot; hidden=&quot;true&quot;&gt;&lt;%= client_name %&gt;&lt;/div&gt;<br>	&lt;div id=&quot;softphone&quot; class=&quot;softphone&quot;&gt;<br>		&lt;div id=&quot;agent-status-controls&quot; class=&quot;clearfix&quot;&gt;<br>			&lt;button class=&quot;agent-status ready&quot;&gt;Ready&lt;/button&gt;<br>			&lt;button class=&quot;agent-status not-ready&quot;&gt;Not Ready&lt;/button&gt;<br>			&lt;div class=&quot;agent-status active&quot;&gt;Call In-Progress&lt;/div&gt;<br>		&lt;/div&gt;&lt;!-- /agent-status --&gt;<br>		<br>		&lt;div id=&quot;agent-status&quot;&gt;<br>			&lt;p&gt;&lt;/p&gt;<br>		&lt;/div&gt;&lt;!-- /agent-status --&gt;<br>		<br>		&lt;div class=&quot;divider&quot;&gt;&lt;/div&gt;<br>		<br>		&lt;div id=&quot;number-entry&quot;&gt;<br>			&lt;input placeholder=&quot;+1 (555) 555-5555&quot;&gt;&lt;/input&gt;<br>			&lt;div class=&quot;incoming-call-status&quot;&gt;Incoming Call&lt;/div&gt;<br>		&lt;/div&gt;&lt;!-- /number-entry --&gt;<br>		<br>		&lt;div id=&quot;dialer&quot;&gt;<br>			&lt;div id=&quot;dialer-container&quot;&gt;<br>				&lt;div class=&quot;numpad-container&quot;&gt;<br>					&lt;div class=&quot;number&quot; value=&quot;1&quot;&gt;1&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;2&quot;&gt;2&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;3&quot;&gt;3&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;4&quot;&gt;4&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;5&quot;&gt;5&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;6&quot;&gt;6&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;7&quot;&gt;7&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;8&quot;&gt;8&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;9&quot;&gt;9&lt;/div&gt;&lt;div class=&quot;number ast&quot; value=&quot;*&quot;&gt;&amp;lowast;&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;0&quot;&gt;0&lt;/div&gt;&lt;div class=&quot;number&quot; value=&quot;#&quot;&gt;#&lt;/div&gt;<br>				&lt;/div&gt;&lt;!-- /numpad-container --&gt;<br>			&lt;/div&gt;&lt;!-- /dialer-container --&gt;<br>		&lt;/div&gt;&lt;!-- /dialer --&gt;<br>		<br>		&lt;div id=&quot;action-button-container&quot;&gt;<br>			&lt;div id=&quot;action-buttons&quot;&gt;<br>				&lt;button class=&quot;call&quot;&gt;Call&lt;/button&gt;<br>				&lt;button class=&quot;answer&quot;&gt;Answer&lt;/button&gt;<br>				&lt;button class=&quot;hangup&quot;&gt;Hangup&lt;/button&gt;<br>				&lt;button class=&quot;mute&quot;&gt;Mute&lt;/button&gt;&lt;button class=&quot;hold&quot;&gt;Hold&lt;/button&gt;&lt;button class=&quot;unhold&quot;&gt;UnHold&lt;/button&gt;<br>			&lt;/div&gt;&lt;!-- /action-buttons --&gt;<br>		&lt;/div&gt;&lt;!---action-button-containe --&gt;<br>		<br>		&lt;div id=&quot;call-data&quot;&gt;<br>			&lt;h3&gt;Caller info&lt;/h3&gt;<br>			&lt;ul class=&quot;name&quot;&gt;&lt;strong&gt;Name: &lt;/strong&gt;&lt;span class=&quot;caller-name&quot;&gt;&lt;/span&gt;&lt;/ul&gt;<br>			&lt;ul class=&quot;phone_number&quot;&gt;&lt;strong&gt;Number: &lt;/strong&gt;&lt;span class=&quot;caller-number&quot;&gt;&lt;/span&gt;&lt;/ul&gt;<br>			&lt;ul class=&quot;queue&quot;&gt;&lt;strong&gt;Queue: &lt;/strong&gt;&lt;span class=&quot;caller-queue&quot;&gt;&lt;/span&gt;&lt;/ul&gt;<br>			&lt;ul class=&quot;message&quot;&gt;&lt;strong&gt;Message: &lt;/strong&gt;&lt;span class=&quot;caller-message&quot;&gt;&lt;/span&gt;&lt;/ul&gt;<br>		&lt;/div&gt;&lt;!-- /call-data --&gt;<br>		<br>		&lt;div id=&quot;callerid-entry&quot; style=&quot;display:&lt;%= anycallerid %&gt;&quot;&gt;<br>			&lt;input placeholder=&quot;Change your callerid&quot;&gt;&lt;/input&gt;<br>		&lt;/div&gt;&lt;!-- /number-entry --&gt;<br>		<br>		&lt;div id=&quot;team-status&quot;&gt;<br>			&lt;div class=&quot;agents-status&quot;&gt;&lt;div class=&quot;agents-num&quot;&gt;-&lt;/div&gt;Agents&lt;/div&gt;<br>			&lt;div class=&quot;queues-status&quot;&gt;&lt;div class=&quot;queues-num&quot;&gt;-&lt;/div&gt;In-Queue&lt;/div&gt;<br>		&lt;/div&gt;&lt;!-- /team-status --&gt;<br>		&lt;div class=&quot;powered-by&quot;&gt;<br>			&lt;img src=&quot;/images/poweredby.png&quot; /&gt;<br>		&lt;/div&gt;<br>	&lt;/div&gt;&lt;!-- /softphone --&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This is our index file, which handles the output of our softphone for agents to use to accept and make calls.</p><p>Inside the public folder, create a folder called css and include the following two files:</p><h4>dialer.css:</h4><pre>/* reset css */ article,aside,details,figcaption,figure,footer,header,hgroup,hr,menu,nav,section{display:block}a,hr{padding:0}abbr,address,article,aside,audio,b,blockquote,body,canvas,caption,cite,code,dd,del,details,dfn,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:0 0}ins,mark{background-color:#ff9;color:#000}body{line-height:1}nav ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:&#39;&#39;;content:none}a{margin:0;font-size:100%;vertical-align:baseline;background:0 0}ins{text-decoration:none}mark{font-style:italic;font-weight:700}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{height:1px;border:0;border-top:1px solid #ccc;margin:1em 0}input,select{vertical-align:middle} .clearfix:before, .clearfix:after { content: &quot; &quot;; display: table; } .clearfix:after { clear: both; } .clearfix { *zoom: 1; } *, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } body { font-family: &quot;Helvetica&quot;, Arial, sans-serif; background-color: white; } #softphone { width: 175px; margin: 10px auto 0px; } #agent-status-controls { margin: 10px 0 20px; position: relative; } .agent-status { border: none; padding: 6px 10px; background-image: linear-gradient(bottom, #ddd 20%, #eee 72%); background-image: -o-linear-gradient(bottom, #ddd 20%, #eee 72%); background-image: -moz-linear-gradient(bottom, #ddd 20%, #eee 72%); background-image: -webkit-linear-gradient(bottom, #ddd 20%, #eee 72%); background-image: -ms-linear-gradient(bottom, #ddd 20%, #eee 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #ddd), color-stop(0.72, #eee)); color: #333; text-shadow: 0px -1px 0px rgba(255, 255, 255, 0.3); box-shadow: inset 0px 0px 1px rgba(0, 0, 0, 0.4); cursor: pointer; text-align: center; } button.agent-status { display: inline-block; float: left; width: 50%; margin: 0; -webkit-appearance: none; -moz-appearance: none; appearance: none; } @-webkit-keyframes pulse { 0% {background-color: #EA6045;} 50% {background-color: #e54a23;} 100% {background-color: #EA6045;} } div.agent-status { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; font-size: 12px; line-height: 12px; background-image: none; background-color: #EA6045; -webkit-animation: pulse 1s infinite alternate; color: #fff; text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2); border-radius: 2px; } .agent-status:active, .agent-status:focus { outline: none; } .agent-status[disabled] { box-shadow: inset 0px 0px 15px rgba(0, 0, 0, 0.6); opacity: 0.8; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.4); } .agent-status.ready { border-radius: 2px 0 0 2px; } .agent-status.ready[disabled] { background-image: linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -o-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -moz-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -webkit-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -ms-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #7eac20), color-stop(0.72, #91c500)); color: #f5f5f5; } .agent-status.not-ready { border-radius: 0 2px 2px 0; } .agent-status.not-ready[disabled] { background-image: linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -o-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -moz-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -webkit-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -ms-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #e64118), color-stop(0.72, #e54a23)); color: #f5f5f5; } #dialer { border: solid 1px #ddd; border-width: 0 0 0 1px; -webkit-transition: opacity 1s; transition: opacity 1s; } input { border: solid 1px #ddd; border-bottom-color: #d5d5d5; border-radius: 2px 2px 0 0; font-size: 16px; width: 100%; padding: 14px 5px; display: block; text-align: center; margin: 0; position: relative; z-index: 100; -webkit-transition: border-color 1s; transition: border-color 1s; } #number-entry { position: relative; height: 48px; } .incoming input { border: solid 1px red; } .incoming #dialer { opacity: 0.25; } .softphone .incoming-call-status { position: absolute; display: none; top: 100%; left: 0; right: 0; background: red; color: #fff; font-size: 16px; padding: 6px 0; text-align: center; width: 100%; z-index: 200; border-radius: 0 0 2px 2px; opacity: 0; -webkit-transition: opacity 1s; transition: opacity 1s; } .incoming .incoming-call-status { display: block; opacity: 1; } .number { color: #555; font-weight: 300; cursor: pointer; display: inline-block; height: 38px; line-height: 38px; font-size: 21px; width: 33.333333333%; background-image: linear-gradient(bottom, #e9e9e9 20%, #e5e5e5 72%); background-image: -o-linear-gradient(bottom, #e9e9e9 20%, #e5e5e5 72%); background-image: -moz-linear-gradient(bottom, #e9e9e9 20%, #e5e5e5 72%); background-image: -webkit-linear-gradient(bottom, #e9e9e9 20%, #e5e5e5 72%); background-image: -ms-linear-gradient(bottom, #e9e9e9 20%, #e5e5e5 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #e9e9e9), color-stop(0.72, #e5e5e5)); text-shadow: 0px 1px 0px #f5f5f5; filter: dropshadow(color=#f5f5f5, offx=0, offy=1); text-align: center; box-shadow: inset 1px 0px 0px rgba(255, 255, 255, 0.4), inset -1px 0px 0px rgba(0, 0, 0, 0.1), inset 0px 1px 0px #f5f5f5, inset 0 -1px 0px #d6d6d6; } .number.ast { font-size: 33px; line-height: 32px; vertical-align: -1px; } .number:hover { background-image: linear-gradient(bottom, #f5f5f5 20%, #f0f0f0 72%); background-image: -o-linear-gradient(bottom, #f5f5f5 20%, #f0f0f0 72%); background-image: -moz-linear-gradient(bottom, #f5f5f5 20%, #f0f0f0 72%); background-image: -webkit-linear-gradient(bottom, #f5f5f5 20%, #f0f0f0 72%); background-image: -ms-linear-gradient(bottom, #f5f5f5 20%, #f0f0f0 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #f5f5f5), color-stop(0.72, #f0f0f0)); } .number:active { box-shadow: inset 1px 0px 0px rgba(255, 255, 255, 0.4), inset -1px 0px 0px rgba(0, 0, 0, 0.1), inset 0px 1px 0px #f5f5f5, inset 0 -1px 0px #d6d6d6, inset 0px 0px 5px 2px rgba(0, 0, 0, 0.15); } #action-buttons button { -webkit-appearance: none; -moz-appearance: none; appearance: none; display: inline-block; border: none; margin: 0; cursor: pointer; } #action-buttons .call { color: #f5f5f5; width: 100%; font-size: 18px; padding: 8px 0; text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.3); margin: 0; background-image: linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -o-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -moz-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -webkit-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -ms-linear-gradient(bottom, #7eac20 20%, #91c500 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #7eac20), color-stop(0.72, #91c500)); border-radius: 0 0 2px 2px; } #action-buttons .answer, #action-buttons .hangup { color: #f5f5f5; width: 100%; font-size: 18px; padding: 8px 0; text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.4); margin: 0; background-image: linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -o-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -moz-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -webkit-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -ms-linear-gradient(bottom, #e64118 20%, #e54a23 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #e64118), color-stop(0.72, #e54a23)); border-radius: 0 0 2px 2px; } #action-buttons .hold, #action-buttons .unhold, #action-buttons .mute { color: #444; width: 50%; font-size: 14px; padding: 12px 0; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.3); margin: 0; background-image: linear-gradient(bottom, #bbb 20%, #ccc 72%); background-image: -o-linear-gradient(bottom, #bbb 20%, #ccc 72%); background-image: -moz-linear-gradient(bottom, #bbb 20%, #ccc 72%); background-image: -webkit-linear-gradient(bottom, #bbb 20%, #ccc 72%); background-image: -ms-linear-gradient(bottom, #bbb 20%, #ccc 72%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, #bbb), color-stop(0.72, #ccc)); box-shadow: inset 1px 0px 0px rgba(255, 255, 255, 0.4), inset -1px 0px 0px rgba(0, 0, 0, 0.1); } .mute { border-radius: 0 0 0 2px; } .hold, .unhold { border-radius: 0 2px 0 0; } #team-status .agents-status, #team-status .queues-status { display: inline-block; width: 45%; margin: 0; font-size: 14px; text-align: center; padding: 12px 0 16px; border-bottom: solid 1px #e5e5e5; } #team-status [class*=&quot;num&quot;] { font-size: 32px; font-weight: bold; margin-bottom: 6px; } #call-data { display: none; } .powered-by { text-align: right; padding: 10px 0; } img { width: 100px; }</pre><p>Finally, we want to set up our softphone frontend code.</p><p>Create a folder inside public called js and add softphone.js:</p><pre>// Page loaded<br>$(function() {<br><br>	// ** Application container ** //<br>	window.SP = {}<br><br>	// Global state<br>	SP.state = {};<br>	SP.agentsRef = {};<br>	SP.callsRef = {};<br>	SP.agent = {};<br>	SP.state.callNumber = null;<br>	SP.state.calltype = &quot;&quot;;<br>	SP.username = $(&#39;#client_name&#39;).text();<br>	SP.currentCall = null;	//instance variable for tracking current connection<br>	SP.requestedHold = false; //set if agent requested hold button<br><br><br><br>	SP.functions = {};<br><br>	// Get a Twilio Client name and register with Twilio<br>	SP.functions.getTwilioClientName = function(sfdcResponse) {<br>		sforce.interaction.runApex(&#39;UserInfo&#39;, &#39;getUserName&#39;, &#39;&#39; , SP.functions.registerTwilioClient);<br>	}<br><br>	SP.functions.registerTwilioClient = function(response) {<br><br>		console.log(&quot;Registering with client name: &quot; + response.result);<br><br>		// Twilio does not accept special characters in Client names<br>		var useresult = response.result;<br>		useresult = useresult.replace(&quot;@&quot;, &quot;AT&quot;);<br>		useresult = useresult.replace(&quot;.&quot;, &quot;DOT&quot;);<br>		SP.username = useresult;<br>		console.log(&quot;useresult = &quot; + useresult);<br><br>		$.get(&quot;/getconfig&quot;, {&quot;client&quot;:SP.username}, function (data) {<br>			if( typeof data.api_key !== &#39;undefined&#39; ){<br>				// agents...<br>				SP.agentsRef = new Flybase( data.api_key, data.app_name, &#39;agents&#39;);<br>				SP.agentsRef.isReady( function(){<br>					SP.functions.startWebSocket();<br>				});<br>				// calls...<br>				SP.callsRef = new Flybase( data.api_key, data.app_name, &#39;calls&#39;);<br>			}else{<br>				console.log( &quot;umm yeah, something&#39;s broken. Please fix it&quot;);<br>			}<br>		});<br><br>		$.get(&quot;/token&quot;, {&quot;client&quot;:SP.username}, function (token) {<br>			Twilio.Device.setup(token, {debug: true});<br>		});<br><br>		$.get(&quot;/getcallerid&quot;, { &quot;from&quot;:SP.username}, function(data) {<br>			$(&quot;#callerid-entry &gt; input&quot;).val(data);<br>		});<br><br>	}<br><br><br>	SP.functions.startWebSocket = function() {<br>		// ** Agent Presence Stuff ** //<br>		console.log(&quot;.startWebSocket...&quot;);<br>		var d = new Date();<br>		var date = d.toLocaleString();<br><br>//		look up or add agent:<br>		SP.functions.update_agent(SP.username,{<br>			status: &#39;LoggingIn&#39;,<br>			readytime: date<br>		});	<br>		SP.agentsRef.on(&#39;agents-ready&#39;, function (data) {<br>			$(&quot;#team-status .agents-num&quot;).text( data ); <br>		});<br>		SP.agentsRef.on(&#39;in-queue&#39;, function (data) {<br>			$(&quot;#team-status .queues-num&quot;).text( data);<br>		});<br><br>		SP.agentsRef.onDisconnect( function(){<br>			// if agent gets disconnected for any reason, then we want to kick them offline...<br>			SP.agentsRef.trigger(&#39;agent-removed&#39;,{username: SP.username});<br>		});<br>	}<br><br>//	update or insert agent.. don&#39;t keep re-adding same agent..<br>	SP.functions.update_agent = function(client, data){<br>		var d = new Date();<br>		var date = d.toLocaleString();<br>		SP.agentsRef.where({&quot;client&quot;: client}).once(&#39;value&#39;).then(function( rec ){<br>			var agent = rec.first().value();<br>			for( var i in data ){<br>				agent[i] = data[i];<br>			}<br>			SP.agent = agent;<br>			SP.agentsRef.push(agent, function(resp) {<br>				console.log( &quot;agent updated&quot; );<br>			});				<br>		}, function(err){<br>			data.client = client;<br>			SP.agent = data;<br>			SP.agentsRef.push(data, function(resp) {<br>				console.log( &quot;agent inserted&quot; );<br>			});				<br>		});<br>	}<br><br>	// ** UI Widgets ** //<br><br>	// Hook up numpad to input field<br>	$(&quot;div.number&quot;).bind(&#39;click&#39;,function(){<br>		//$(&quot;#number-entry &gt; input&quot;).val($(&quot;#number-entry &gt; input&quot;).val()+$(this).attr(&#39;Value&#39;));<br>		//pass key without conn to a function<br>		SP.functions.handleKeyEntry($(this).attr(&#39;Value&#39;));	<br><br>	});<br><br>	SP.functions.handleKeyEntry = function (key) {	<br>		 if (SP.currentCall != null) {<br>			console.log(&quot;sending DTMF&quot; + key);<br>			SP.currentCall.sendDigits(key);<br>		 } else {<br>			 $(&quot;#number-entry &gt; input&quot;).val($(&quot;#number-entry &gt; input&quot;).val()+key);<br>		 }<br><br>	}<br><br>	//called when agent is not on a call<br>	SP.functions.setIdleState = function() {<br>		$(&quot;#action-buttons &gt; .call&quot;).show();<br>		$(&quot;#action-buttons &gt; .answer&quot;).hide();<br>		$(&quot;#action-buttons &gt; .mute&quot;).hide();<br>		$(&quot;#action-buttons &gt; .hold&quot;).hide();<br>		$(&quot;#action-buttons &gt; .unhold&quot;).hide();<br>		$(&quot;#action-buttons &gt; .hangup&quot;).hide();<br>		$(&#39;div.agent-status&#39;).hide();<br>		$(&quot;#number-entry &gt; input&quot;).val(&quot;&quot;);<br>	}<br><br>	SP.functions.setRingState = function () {<br>		$(&quot;#action-buttons &gt; .answer&quot;).show();<br>		$(&quot;#action-buttons &gt; .call&quot;).hide();<br>		$(&quot;#action-buttons &gt; .mute&quot;).hide();<br>		$(&quot;#action-buttons &gt; .hold&quot;).hide();<br>		$(&quot;#action-buttons &gt; .unhold&quot;).hide();<br>		$(&quot;#action-buttons &gt; .hangup&quot;).hide();<br>	}<br><br>	SP.functions.setOnCallState = function() {<br><br>		$(&quot;#action-buttons &gt; .answer&quot;).hide();<br>		$(&quot;#action-buttons &gt; .call&quot;).hide();<br>		$(&quot;#action-buttons &gt; .mute&quot;).show();<br><br>		//can not hold outbound calls, so disable this<br>		if (SP.calltype == &quot;Inbound&quot;) {<br>			$(&quot;#action-buttons &gt; .hold&quot;).show();<br>		}<br><br>		$(&quot;#action-buttons &gt; .hangup&quot;).show();<br>		$(&#39;div.agent-status&#39;).show();<br>	}<br><br>	// Hide caller info<br>	SP.functions.hideCallData = function() {<br>		$(&quot;#call-data&quot;).hide();<br>	}<br>	SP.functions.hideCallData();<br>	SP.functions.setIdleState();<br><br>	// Show caller info<br>	SP.functions.showCallData = function(callData) {<br>		$(&quot;#call-data &gt; ul&quot;).hide();<br>		$(&quot;.caller-name&quot;).text(callData.callerName);<br>		$(&quot;.caller-number&quot;).text(callData.callerNumber);<br>		$(&quot;.caller-queue&quot;).text(callData.callerQueue);<br>		$(&quot;.caller-message&quot;).text(callData.callerMessage);<br><br>		if (callData.callerName) {<br>			$(&quot;#call-data &gt; ul.name&quot;).show();<br>		}<br><br>		if (callData.callerNumber) {<br>			$(&quot;#call-data &gt; ul.phone_number&quot;).show();<br>		}<br><br>		if (callData.callerQueue) {<br>			$(&quot;#call-data &gt; ul.queue&quot;).show();<br>		}<br><br>		if (callData.callerMessage) {<br>			$(&quot;#call-data &gt; ul.message&quot;).show();<br>		}<br><br>		$(&quot;#call-data&quot;).slideDown(400);<br>	}<br><br>	// Attach answer button to an incoming connection object<br>	SP.functions.attachAnswerButton = function(conn) {<br>		$(&quot;#action-buttons &gt; button.answer&quot;).click(function() {<br>		conn.accept();<br>		}).removeClass(&#39;inactive&#39;).addClass(&quot;active&quot;);<br>	}<br><br>	SP.functions.detachAnswerButton = function() {<br>		$(&quot;#action-buttons &gt; button.answer&quot;).unbind().removeClass(&#39;active&#39;).addClass(&quot;inactive&quot;);<br>	}<br><br>	SP.functions.attachMuteButton = function(conn) {<br>		$(&quot;#action-buttons &gt; button.mute&quot;).click(function() {<br>		conn.mute();<br>		SP.functions.attachUnMute(conn);<br>		}).removeClass(&#39;inactive&#39;).addClass(&quot;active&quot;).text(&quot;Mute&quot;);<br>	}<br><br>	SP.functions.attachUnMute = function(conn) {<br>		$(&quot;#action-buttons &gt; button.mute&quot;).click(function() {<br>		conn.unmute();<br>		SP.functions.attachMuteButton(conn);<br>		}).removeClass(&#39;inactive&#39;).addClass(&quot;active&quot;).text(&quot;UnMute&quot;);<br>	}<br><br>	SP.functions.detachMuteButton = function() {<br>		$(&quot;#action-buttons &gt; button.mute&quot;).unbind().removeClass(&#39;active&#39;).addClass(&quot;inactive&quot;);<br>	}<br><br>	SP.functions.attachHoldButton = function(conn) {<br>		$(&quot;#action-buttons &gt; button.hold&quot;).click(function() {<br>		 console.dir(conn);<br>		 SP.requestedHold = true;<br>		 //can&#39;t hold outbound calls from Twilio client<br>		 $.post(&quot;/request_hold&quot;, { &quot;from&quot;:SP.username, &quot;callsid&quot;:conn.parameters.CallSid, &quot;calltype&quot;:SP.calltype }, function(data) {<br>			 //Todo: handle errors<br>			 //Todo: change status in future<br>			 SP.functions.attachUnHold(conn, data);<br><br>			});<br><br>		}).removeClass(&#39;inactive&#39;).addClass(&quot;active&quot;).text(&quot;Hold&quot;);<br>	}<br><br>	SP.functions.attachUnHold = function(conn, holdid) {<br>		$(&quot;#action-buttons &gt; button.unhold&quot;).click(function() {<br>		//do ajax request to hold for the conn.id<br>		 <br>		 $.post(&quot;/request_unhold&quot;, { &quot;from&quot;:SP.username, &quot;callsid&quot;:holdid }, function(data) {<br>			 //Todo: handle errors<br>			 //Todo: change status in future<br>			 //SP.functions.attachHoldButton(conn);<br>			});<br>		<br>		}).removeClass(&#39;inactive&#39;).addClass(&quot;active&quot;).text(&quot;UnHold&quot;).show();<br>	}<br><br>	SP.functions.detachHoldButtons = function() {<br>		$(&quot;#action-buttons &gt; button.unhold&quot;).unbind().removeClass(&#39;active&#39;).addClass(&quot;inactive&quot;);<br>		$(&quot;#action-buttons &gt; button.hold&quot;).unbind().removeClass(&#39;active&#39;).addClass(&quot;inactive&quot;);<br>	}<br><br><br><br><br>	SP.functions.updateAgentStatusText = function(statusCategory, statusText, inboundCall) {<br><br>		if (statusCategory == &quot;ready&quot;) {<br>			 $(&quot;#agent-status-controls &gt; button.ready&quot;).prop(&quot;disabled&quot;,true); <br>			 $(&quot;#agent-status-controls &gt; button.not-ready&quot;).prop(&quot;disabled&quot;,false); <br>			 $(&quot;#agent-status&quot;).removeClass();<br>			 $(&quot;#agent-status&quot;).addClass(&quot;ready&quot;);<br>			 $(&#39;#softphone&#39;).removeClass(&#39;incoming&#39;);<br><br>		}<br><br>		if (statusCategory == &quot;notReady&quot;) {<br>			 $(&quot;#agent-status-controls &gt; button.ready&quot;).prop(&quot;disabled&quot;,false); <br>			 $(&quot;#agent-status-controls &gt; button.not-ready&quot;).prop(&quot;disabled&quot;,true); <br>			 $(&quot;#agent-status&quot;).removeClass();<br>			 $(&quot;#agent-status&quot;).addClass(&quot;not-ready&quot;);<br>			 $(&#39;#softphone&#39;).removeClass(&#39;incoming&#39;);<br>		}<br><br>		if (statusCategory == &quot;onCall&quot;) {<br>			$(&quot;#agent-status-controls &gt; button.ready&quot;).prop(&quot;disabled&quot;,true); <br>			$(&quot;#agent-status-controls &gt; button.not-ready&quot;).prop(&quot;disabled&quot;,true); <br>			$(&quot;#agent-status&quot;).removeClass();<br>			$(&quot;#agent-status&quot;).addClass(&quot;on-call&quot;);<br>			$(&#39;#softphone&#39;).removeClass(&#39;incoming&#39;);<br>		}<br><br>		if (inboundCall ==	true) { <br>		//alert(&quot;call from &quot; + statusText);<br>		$(&#39;#softphone&#39;).addClass(&#39;incoming&#39;);<br>		$(&quot;#number-entry &gt; input&quot;).val(statusText);<br>		}<br><br>		//$(&quot;#agent-status &gt; p&quot;).text(statusText);<br>	}<br><br>	// Call button will make an outbound call (click to dial) to the number entered <br>	$(&quot;#action-buttons &gt; button.call&quot;).click( function( ) {<br>		params = {&quot;PhoneNumber&quot;: $(&quot;#number-entry &gt; input&quot;).val(), &quot;CallerId&quot;: $(&quot;#callerid-entry &gt; input&quot;).val()};<br>		Twilio.Device.connect(params);<br>	});<br><br>	// Hang up button will hang up any active calls<br>	$(&quot;#action-buttons &gt; button.hangup&quot;).click( function( ) {<br>		Twilio.Device.disconnectAll();<br>	});<br><br>	// Wire the ready / not ready buttons up to the server-side status change functions<br>	$(&quot;#agent-status-controls &gt; button.ready&quot;).click( function( ) {<br>		$(&quot;#agent-status-controls &gt; button.ready&quot;).prop(&quot;disabled&quot;,true); <br>		$(&quot;#agent-status-controls &gt; button.not-ready&quot;).prop(&quot;disabled&quot;,false); <br>		SP.functions.ready();<br>	});<br><br>	$(&quot;#agent-status-controls &gt; button.not-ready&quot;).click( function( ) {<br>		$(&quot;#agent-status-controls &gt; button.ready&quot;).prop(&quot;disabled&quot;,false); <br>		$(&quot;#agent-status-controls &gt; button.not-ready&quot;).prop(&quot;disabled&quot;,true); <br>		SP.functions.notReady();<br>	});<br><br>	$(&quot;#agent-status-controls &gt; button.userinfo&quot;).click( function( ) {<br><br><br>	});<br><br><br><br>	// ** Twilio Client Stuff ** //<br>	// first register outside of sfdc<br><br><br>	if ( window.self === window.top ) {	<br>		console.log(&quot;Not in an iframe, assume we are using default client&quot;);<br>		var defaultclient = {}<br>		defaultclient.result = SP.username;<br>		SP.functions.registerTwilioClient(defaultclient);<br>	} else{<br>		console.log(&quot;In an iframe, assume it is Salesforce&quot;);<br>		sforce.interaction.isInConsole(SP.functions.getTwilioClientName);	 <br>	}<br>	//this will only be called inside of salesforce<br><br>	Twilio.Device.ready(function (device) {<br>		sforce.interaction.cti.enableClickToDial();<br>		sforce.interaction.cti.onClickToDial(startCall); <br>		var adNag = function() {<br>			SP.functions.ready();<br>		};<br>		setTimeout(adNag, 1500);<br>	});<br><br>	Twilio.Device.offline(function (device) {<br>		//make a new status call.. something like.. disconnected instead of notReady ?<br>		sforce.interaction.cti.disableClickToDial(); <br>		SP.functions.notReady();<br>		SP.functions.hideCallData();<br>	});<br><br><br>	/* Report any errors on the screen */<br>	Twilio.Device.error(function (error) {<br>		SP.functions.updateAgentStatusText(&quot;ready&quot;, error.message);<br>		SP.functions.hideCallData();<br>	});<br><br>	/* Log a message when a call disconnects. */<br>	Twilio.Device.disconnect(function (conn) {<br>		console.log(&quot;disconnectiong...&quot;);<br>		SP.functions.updateAgentStatusText(&quot;ready&quot;, &quot;Call ended&quot;);<br><br>		<br>		<br>		SP.state.callNumber = null;<br>		<br>		// deactivate answer button<br>		SP.functions.detachAnswerButton();<br>		SP.functions.detachMuteButton();<br>		SP.functions.detachHoldButtons();<br>		SP.functions.setIdleState(); <br>		<br>		SP.currentCall = null;<br>		<br>		// return to waiting state<br>		SP.functions.hideCallData();<br>		SP.functions.ready();<br>		//sforce.interaction.getPageInfo(saveLog);<br>	});<br><br>	Twilio.Device.connect(function (conn) {<br><br>		console.dir(conn);<br>		var	status = &quot;&quot;;<br><br>		var callNum = null;<br>		if (conn.parameters.From) {<br>			callNum = conn.parameters.From;<br>			status = &quot;Call From: &quot; + callNum;<br>			SP.calltype = &quot;Inbound&quot;;<br>		} else {<br>			status = &quot;Outbound call&quot;;<br>			SP.calltype = &quot;Outbound&quot;;<br><br>		}<br><br>		console.dir(conn);<br><br><br>		SP.functions.updateAgentStatusText(&quot;onCall&quot;, status);<br>		SP.functions.setOnCallState();<br>		SP.functions.detachAnswerButton();<br><br>		SP.currentCall = conn;<br>		SP.functions.attachMuteButton(conn);<br>		SP.functions.attachHoldButton(conn, SP.calltype);<br><br>		//send status info<br>		SP.functions.update_agent(SP.username,{<br>			status: &#39;OnCall&#39;<br>		});	<br>	});<br><br>	/* Listen for incoming connections */<br>	Twilio.Device.incoming(function (conn) {<br><br><br>		// Update agent status <br>		sforce.interaction.setVisible(true);	//pop up CTI console<br>		SP.functions.updateAgentStatusText(&quot;ready&quot;, ( conn.parameters.From), true);<br>		// Enable answer button and attach to incoming call<br>		SP.functions.attachAnswerButton(conn);<br>		SP.functions.setRingState();<br><br>		if (SP.requestedHold == true) {<br>			//auto answer<br>			SP.requestedHold = false;<br>			$(&quot;#action-buttons &gt; button.answer&quot;).click();<br>		}<br>		var inboundnum = cleanInboundTwilioNumber(conn.parameters.From);<br>		var sid = conn.parameters.CallSid<br>		var result = &quot;&quot;;<br>		//sfdc screenpop fields are specific to new contact screenpop<br>		sforce.interaction.searchAndScreenPop(inboundnum, &#39;con10=&#39; + inboundnum + &#39;&amp;con12=&#39; + inboundnum + &#39;&amp;name_firstcon2=&#39; + name,&#39;inbound&#39;);<br><br>	});<br><br>	Twilio.Device.cancel(function(conn) {<br>		console.log(conn.parameters.From); // who canceled the call<br>		SP.functions.detachAnswerButton();<br>		SP.functions.detachHoldButtons();<br>		SP.functions.hideCallData();<br>		SP.functions.notReady();<br>		SP.functions.setIdleState();<br><br>		$(&quot;.number&quot;).unbind();<br>		SP.currentCall = null;<br>		//SP.functions.updateStatus();<br>	});<br><br><br>	$(&quot;#callerid-entry &gt; input&quot;).change( function() {<br>		$.post(&quot;/setcallerid&quot;, { &quot;from&quot;:SP.username, &quot;callerid&quot;: $(&quot;#callerid-entry &gt; input&quot;).val() });<br>	});<br><br><br><br>	// Set server-side status to ready / not-ready<br>	SP.functions.notReady = function() {<br>		SP.functions.update_agent(SP.username,{<br>			status: &#39;NotReady&#39;<br>		});	<br>		SP.agentsRef.trigger(&#39;get-ready-agents&#39;,{username: SP.username});<br>		SP.functions.updateStatus();<br>	}<br><br>	SP.functions.ready = function() {<br>		SP.functions.update_agent(SP.username,{<br>			status: &#39;Ready&#39;<br>		});	<br>		SP.agentsRef.trigger(&#39;get-ready-agents&#39;,{username: SP.username});<br>		SP.functions.updateStatus();<br>	}<br><br><br>	// Check the status on the server and update the agent status dialog accordingly<br>	SP.functions.updateStatus = function() {<br>		var data = SP.agent.status;<br>		if (data == &quot;NotReady&quot; || data == &quot;Missed&quot;) {<br>			SP.functions.updateAgentStatusText(&quot;notReady&quot;, &quot;Not Ready&quot;)<br>		}<br>		<br>		if (data == &quot;Ready&quot;) {<br>			SP.functions.updateAgentStatusText(&quot;ready&quot;, &quot;Ready&quot;)<br>		}<br>	}<br><br>	/******** GENERAL FUNCTIONS for SFDC	***********************/<br><br>	function cleanInboundTwilioNumber(number) {<br>		//twilio inabound calls are passed with +1 (number). SFDC only stores <br>		return number.replace(&#39;+1&#39;,&#39;&#39;); <br>	}<br><br>	function cleanFormatting(number) { <br>		//changes a SFDC formatted US number, which would be 415-555-1212		 <br>		return number.replace(&#39; &#39;,&#39;&#39;).replace(&#39;-&#39;,&#39;&#39;).replace(&#39;(&#39;,&#39;&#39;).replace(&#39;)&#39;,&#39;&#39;).replace(&#39;+&#39;,&#39;&#39;);<br>	}<br><br><br>	function startCall(response) { <br>			<br>		//called onClick2dial<br>		sforce.interaction.setVisible(true);	//pop up CTI console<br>		var result = JSON.parse(response.result);	<br>		var cleanednumber = cleanFormatting(result.number);<br><br><br>		//alert(&quot;cleanednumber = &quot; + cleanednumber);	<br>		params = {&quot;PhoneNumber&quot;: cleanednumber, &quot;CallerId&quot;: $(&quot;#callerid-entry &gt; input&quot;).val()};<br>		Twilio.Device.connect(params);<br><br>	} <br><br>	var saveLogcallback = function (response) {<br>		if (response.result) {<br>			console.log(&quot;saveLog result =&quot; + response.result);<br>		} else {<br>			console.log(&quot;saveLog error = &quot; + response.error);<br>		}<br>	};<br><br><br>	function saveLog(response) {<br>		console.log(&quot;saving log result, response:&quot;);<br>		var result = JSON.parse(response.result);<br><br>		console.log(response.result);<br>		<br>		var timeStamp = new Date().toString();<br>		timeStamp = timeStamp.substring(0, timeStamp.lastIndexOf(&#39;:&#39;) + 3);			 <br>		var currentDate = new Date();			 <br>		var currentDay = currentDate.getDate();<br>		var currentMonth = currentDate.getMonth()+1;<br>		var currentYear = currentDate.getFullYear();<br>		var dueDate = currentYear + &#39;-&#39; + currentMonth + &#39;-&#39; + currentDay;<br>		var saveParams = &#39;Subject=&#39; + SP.calltype +&#39; Call on &#39; + timeStamp;<br><br>		saveParams += &#39;&amp;Status=completed&#39;;					<br>		saveParams += &#39;&amp;CallType=&#39; + SP.calltype;	//should change this to reflect actual inbound or outbound<br>		saveParams += &#39;&amp;Activitydate=&#39; + dueDate;<br>		saveParams += &#39;&amp;Phone=&#39; + SP.state.callNumber;	//we need to get this from.. somewhere		<br>		saveParams += &#39;&amp;Description=&#39; + &quot;test description&quot;;	 <br><br>		console.log(&quot;About to parse	result..&quot;);<br>		<br>		var result = JSON.parse(response.result);<br>		var objectidsubstr = result.objectId.substr(0,3);<br>		// object id 00Q means a lead.. adding this to support logging on leads as well as contacts.<br>		if(objectidsubstr == &#39;003&#39; || objectidsubstr == &#39;00Q&#39;) {<br>			saveParams += &#39;&amp;whoId=&#39; + result.objectId;					<br>		} else {<br>			saveParams += &#39;&amp;whatId=&#39; + result.objectId;			<br>		}<br>		<br>		console.log(&quot;save params = &quot; + saveParams);<br>		sforce.interaction.saveLog(&#39;Task&#39;, saveParams, saveLogcallback);<br>	}<br>});</pre><p>This code is based on the original softphone.js code that Charles wrote, but I’ve added in Flybase queries directly to the frontend, and then set up event listeners.</p><p>Once we set up our softphone, we make three ajax calls to our backend:</p><ol><li>/getconfig to return our Flybase info and enable our agentsRef and callsRef variables. Once agentsRef returns isReady from Flybase, then we trigger a call to our startWebSocket function. isReady is a function that we can use with the Flybase client when we wait to until our connection has been established before performing other actions.</li><li>/token which we pass the agent’s name and return a twilio capability token to let the agent make and receive calls</li><li>/getcallerid to return the outgoing phone number for the call to use.</li></ol><p>We use the startWebSocket function (which was based on the original) to set up three event listeners and to update the agent’s status as LogginIn, and the time they came online.</p><p>Later in the Twilio client code, we set the agent to Ready once their Twilio client connection has been setup:</p><pre>Twilio.Device.ready(function (device) {<br>   sforce.interaction.cti.enableClickToDial();<br>   sforce.interaction.cti.onClickToDial(startCall);<br>   var adNag = function() { <br>     SP.functions.ready(); <br>   }; <br>   setTimeout(adNag, 1500); <br>});</pre><p>We are going to listen for agents-ready and in-queue events from our backend to tell the softphone to update the display to show the number of agents who are set to Ready and waiting for a call and then number of callers who are in the queue waiting for an agent.</p><p>Finally, we’re going to use the onDisconnect event to fire off an agent-removed trigger when the agent goes offline for some reason, such as closing the browser, logging off, etc.</p><p>You’ll also notice a clone of our update_agent function in this file. One of the nice things about using Flybase is we can handle our database updates from either the frontend or the backend so that lets us do a lot that we couldn’t before.</p><p>The rest of the softphone.js file is actually the same as it was before, it talks to talks to the Twilio Client on incoming and outgoing calls and it either gets the client name from the ?client query string or it gets it from Salesforce, if you are displaying your softphone inside Salesforce.</p><p>You may also notice we make use of our new <a href="http://blog.flybase.io/2016/02/02/promises-lookups/">Promises</a> functionality:</p><pre>SP.functions.update_agent = function(client, data){<br>	var d = new Date();<br>	var date = d.toLocaleString();<br>	SP.agentsRef.where({&quot;client&quot;: client}).once(&#39;value&#39;).then(function( rec ){<br>		var agent = rec.first().value();<br>			for( var i in data ){<br>				agent[i] = data[i];<br>			}<br>			SP.agent = agent;<br>			SP.agentsRef.push(agent, function(resp) {<br>				console.log( &quot;agent updated&quot; );<br>			});				<br>		}, function(err){<br>			data.client = client;<br>			SP.agent = data;<br>			SP.agentsRef.push(data, function(resp) {<br>				console.log( &quot;agent inserted&quot; );<br>			});				<br>		});<br>	}</pre><p>In update_agent, we use promises to either return an existing agent record so we can update or else we create a band new record.</p><h3>Deploying to Heroku (optional)</h3><p><em>This step is optional, and you can deploy anywhere you like.</em></p><p>You’ll want a Heroku account and also to have the <a href="https://toolbelt.heroku.com/">Heroku toolbelt</a> installed.</p><p>Create a file called Procfile and include:</p><p>Now, run the following:</p><ol><li>git init</li><li>heroku login to log into Heroku.</li><li>heroku create to create the application within Heroku.</li><li>git add — all . to add all of your new files to the repo.</li><li>git commit -am ‘first commit’ to store the files inside the repo.</li><li>git push heroku master to push your git repository to Heroku.</li><li>heroku open to open your browser at your new, custom URL.</li></ol><p>Call center is now working, you can add ?client=ANYNAMEYOUWANT to the end of the URL and it will set you up as the agent.</p><h3>Configuring Salesforce (optional)</h3><p><em>This step is optional, the call center works without sales force and in part 2, we’ll build a basic CRM that you can integrate this into as well.</em></p><p>This part is actually pretty simple. First, create a file called TwilioAdapter.xml:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br>&lt;callCenter&gt;<br>  &lt;section sortOrder=&quot;0&quot; name=&quot;reqGeneralInfo&quot; label=&quot;General Information&quot;&gt;<br>    &lt;item sortOrder=&quot;0&quot; name=&quot;reqInternalName&quot; label=&quot;InternalName&quot;&gt;DemoAdapter&lt;/item&gt;<br>    &lt;item sortOrder=&quot;1&quot; name=&quot;reqDisplayName&quot; label=&quot;Display Name&quot;&gt;Demo Call Center Adapter&lt;/item&gt;<br>    &lt;item sortOrder=&quot;2&quot; name=&quot;reqAdapterUrl&quot; label=&quot;CTI Adapter URL&quot;&gt;https://macbook.ngrok.com&lt;/item&gt;<br>    &lt;item sortOrder=&quot;3&quot; name=&quot;reqUseApi&quot; label=&quot;Use CTI API&quot;&gt;true&lt;/item&gt;<br>    &lt;item sortOrder=&quot;4&quot; name=&quot;reqSoftphoneHeight&quot; label=&quot;Softphone Height&quot;&gt;400&lt;/item&gt;<br>    &lt;item sortOrder=&quot;5&quot; name=&quot;reqSoftphoneWidth&quot; label=&quot;Softphone Width&quot;&gt;300&lt;/item&gt;<br>  &lt;/section&gt;<br>  &lt;section sortOrder=&quot;1&quot; name=&quot;reqDialingOptions&quot; label=&quot;Dialing Options&quot;&gt;<br>    &lt;item sortOrder=&quot;0&quot; name=&quot;reqOutsidePrefix&quot; label=&quot;Outside Prefix&quot;&gt;9&lt;/item&gt;<br>    &lt;item sortOrder=&quot;1&quot; name=&quot;reqLongDistPrefix&quot; label=&quot;Long Distance Prefix&quot;&gt;1&lt;/item&gt;<br>    &lt;item sortOrder=&quot;2&quot; name=&quot;reqInternationalPrefix&quot; label=&quot;International Prefix&quot;&gt;01&lt;/item&gt;<br>  &lt;/section&gt;<br>&lt;/callCenter&gt;</pre><p>Change the appropriate info to point to your website, then follow these steps:</p><ol><li>Go to Call Centers &gt; Create</li></ol><ul><li>Import a call center config included, TwilioAdapter.xml — after import, change the parameter CTI Adapter URL to the Heroku URL created in the first steps https:/&lt;insert yourherokuappurl</li><li>add yourself to the call center under “Manage Call Center users” &gt; Add more users &gt; (find)</li></ul><ol><li>You should now see a CTI adapter under the Contact tabs. However, you want to use the Service Cloud Console for all cti calls (which prevens browser refreshes that would hang up calls)</li><li>To create a service cloud console</li></ol><ul><li>Setup &gt; Create &gt; Apps &gt; New</li><li>Choose “Console” for type of app</li><li>give it a name, such as “Twilio ACD”</li><li>Accept default for logo</li><li>For tabs, add some tabs to your Service Cloud Console, such as Contacts, Cases</li><li>accept default for step5 “choose how records display”</li><li>Set visibility to all (for dev orgs)</li><li>You’ve now created an app! You will see you’r console in the App dropdown, for example “Twilio ACD”</li></ul><ol><li>Configuring screenpops</li></ol><ul><li>you can configure screenpop response, such as to pop the search screen, in Setup &gt; Call Centers &gt; (your call center) -&gt; Softphone Layout.</li></ul><p>These steps were borrowed from Charles’ original post as they haven’t changed.</p><h3>Finishing up</h3><p>Now you’ve got a working real-time call center ACD system that can be used stand alone (as a lone softphone), in a CRM such as Salesforce, or a CRM built entirely around it which we’ll do in the next post.</p><p>If you’re familiar at all with the original client-acd then not much has changed, other than being rewritten in node and using Flybase as the backend / signal system, and that was the plan with this post as I wanted to demonstrate how Flybase can be used within a call center and this one has always been a go to for various projects.</p><p>Just a reminder, you can find the full source code <a href="https://github.com/flybaseio/callcenter">here</a>.</p><p><em>Originally published at </em><a href="http://blog.flybase.io/2016/02/17/building-a-salesforce-powered-call-center-with-twilio-flybase/"><em>blog.flybase.io</em></a><em> on February 17, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4b42b0429ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/building-a-salesforce-powered-call-center-with-flybase-and-twilio-d4b42b0429ac">Building A Salesforce Powered Call Center with Flybase and Twilio</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a real-time stats Dashboard with Flybase]]></title>
            <link>https://medium.com/data-mcfly/build-a-real-time-stats-dashboard-with-flybase-7862ad59f40d?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/7862ad59f40d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Fri, 04 Dec 2015 07:22:25 GMT</pubDate>
            <atom:updated>2015-12-04T07:22:24.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5k98AemVpDllLXYg.png" /></figure><p>Flybase’s real-time events systems lets us push all kinds of data to the browser.</p><p>In this tutorial, I’m going to show you how to build a real-time analytics dashboard using Flybase and just a couple lines of javascript.</p><p>To keep things simple we’ll capture the page URL and a couple of browser capabilities using Modernizr (modernizr.com). That information will be sent to the server using a Flybase connection.</p><p>This is entirely client-side, and no data will be saved to your Flybase app. In another tutorial, we’ll expand our dashboard to store historical data.</p><p>You can see the full code <a href="https://github.com/flybaseio/flyalytics">here at the Github Repo</a>.</p><h3>Step 1</h3><p>To get started, you’ll need a <a href="https://app.flybase.io/signup">flybase.io</a> account, so go grab one if you don’t already have one.</p><h3>Step 2</h3><p>Open up flyalytics.js replace YOUR-FLYBASE-API-KEY with your actual Flybase API key.</p><pre>var flybase = new Flybase(&quot;YOUR-FLYBASE-API-KEY&quot;, &quot;flyalytics&quot;, &quot;stats&quot;); <br>var data = { <br>    url: window.location.href,<br>    webgl: Modernizr.webgl, <br>    touch: Modernizr.touch, <br>    video: Modernizr.video, <br>    websocket: Modernizr.websockets <br>}; <br>flybase.trigger( &#39;client-data&#39;, data );</pre><p>We’re using modernizr.js to get information on if they support webgl, touch, video and websockets, this helps keep our code minimal and tidy. It wouldn’t take much to add other info here as well, but this what we wanted for this dashboard.</p><p>One thing, we’re only triggering here, sending real-time events. It wouldn’t take much to push this data to store it in a Flybase app for historical purposes, but that’s what what we want today. :)</p><p>Now upload flyaltics.js to your website and add the following code anywhere you want to track it:</p><pre>&lt;script src=&quot;//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://cdn.flybase.io/flybase.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;flyalytics.js&quot;&gt;&lt;/script&gt;</pre><p>This will trigger page tracking on load. The idea was to keep this simple, but let it be able to be expanded on quickly.</p><h3>Step 3</h3><p>Now let’s build our dashboard. Open js/dashboard.js in the dashboard/ folder and modify it:</p><pre>$( function() { <br>   var visitors = $(&#39;#visitors&#39;).epoch( { <br>       type: &#39;time.area&#39;, <br>       axes: [&#39;left&#39;, &#39;bottom&#39;, &#39;right&#39;], <br>       data: [ { values: [ { time: Date.now()/1000, y: 0 } ] } ] <br>   } ); <br>   var pages = $( &#39;#pages&#39; ).epoch( { type: &#39;bar&#39; } ); <br>   var touch = $( &#39;#touch&#39; ).epoch( { type: &#39;time.gauge&#39; } ); <br>   var video = $( &#39;#video&#39; ).epoch( { type: &#39;time.gauge&#39; } ); <br>   var stats = { connections: 0, touch: 0, video: 0, pages: {} }; <br>   var dashboard = new Flybase(&quot;YOUR-FLYBASE-API-KEY&quot;, &quot;flyalytics&quot;, &quot;stats&quot;); <br>   dashboard.on(&#39;online&#39;, function (data) { <br>     stats.connections = data.value(); }); <br>     dashboard.on( &#39;client-data&#39;, function (data ){ <br>     // process the new data... <br>     stats.touch += ( data.touch ? 1 : 0 ); <br>     stats.video += ( data.video ? 1 : 0 ); <br>     var pageCount = stats.pages[ data.url ] || 0; <br>     stats.pages[ data.url ] = ++pageCount; <br>     // Convert to percentages <br>     touch.update( ( stats.touch / stats.connections ) || 0 );<br>     video.update( ( stats.video / stats.connections ) || 0 ); <br>     var pagesData = []; <br>     for( var url in stats.pages ) { <br>       pagesData.push( { <br>         x: url, <br>         y: stats.pages[ url ] <br>       } ); <br>     } <br>     pages.update( [ { values: pagesData } ] ); <br>     visitors.push( [ { <br>       time: Date.now()/1000, <br>       y: stats.connections <br>     } ] ); <br>   }); <br>});</pre><p>Replace YOUR-FLYBASE-API-KEY with your actual Flybase API key.</p><p>This does a few things.</p><ol><li>It uses the online event to get how many connections are active currently.</li><li>It takes the data that is passed from the <em>flyalytics.js</em> file called client-data to process current data and display it on the dashboard.</li></ol><p>We display the number of people online right now, as well as the pages in use. Beside that we are using gauges via the epoch library to show us how many visitors support touch screens (tablets, phones) and how many support video as an example.</p><p>This could be built to show more data but the idea is showing what we need now</p><p>You can see the full code <a href="https://github.com/flybaseio/flyalytics">here at the Github Repo</a>.</p><p><em>Originally published at </em><a href="http://blog.flybase.io/2015/12/03/flybase-stats-dashboard/"><em>blog.flybase.io</em></a><em> on December 3, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7862ad59f40d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/build-a-real-time-stats-dashboard-with-flybase-7862ad59f40d">Build a real-time stats Dashboard with Flybase</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Click to Call Call Center with Flybase, Twilio Client and Node.js]]></title>
            <link>https://medium.com/data-mcfly/creating-a-click-to-call-call-center-with-flybase-twilio-client-and-node-js-7c06a7534d6f?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/7c06a7534d6f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[twilio]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Wed, 26 Aug 2015 05:33:33 GMT</pubDate>
            <atom:updated>2015-08-26T05:33:33.424Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating a Click to Call Call Center with Flybase, Twilio Client and Node.js</p><p>Over on the Flybase blog, I just posted a nice tutorial for building a <a href="http://blog.flybase.io/2015/08/22/creating-a-click-to-call-service-with-twilio-client-flybase-and-node"><strong>Click to Call Call Center</strong></a>, this is an easy tutorial which demonstrates using Flybase, Twilio and our Custom events system to push real-time notifications.</p><p>In this case, the tutorial shows people how to set up a contextual call center, where visitors to a web page can click on an ad for more information and instantly get connected to a live operator all via browser phone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c06a7534d6f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/creating-a-click-to-call-call-center-with-flybase-twilio-client-and-node-js-7c06a7534d6f">Creating a Click to Call Call Center with Flybase, Twilio Client and Node.js</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rebranding]]></title>
            <link>https://medium.com/data-mcfly/rebranding-3a226bed2119?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a226bed2119</guid>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Tue, 18 Aug 2015 16:24:08 GMT</pubDate>
            <atom:updated>2015-08-18T16:24:07.892Z</atom:updated>
            <content:encoded><![CDATA[<p>A little over a month ago, Data McFly got rebranded, kind of.</p><p>The real-time backend database that was Data McFly’s main product, became <a href="https://flybase.io/"><strong>flybase.io</strong></a>, while Data McFly remained the parent company of Flybase.</p><p>This has brought about two questions:</p><p><strong>Why the rebrand?</strong></p><p>I posted about the full reasoning <a href="http://blog.flybase.io/2015/06/28/the-rebrand">here</a>, but I’ll give you a revised version:</p><p>When we first built the API that would become Data McFly, we called it DataGarde, but there’s already a similarly named company, so then the project became Mongoly, but that never felt right either, so finally after demoing our API to some developers, they gave us this comment:</p><blockquote>Your API makes our data fly</blockquote><p>From there, we grew into Data McFly, but since we don’t want to keep telling this story every single time, we’ve decided to have a name change. And the name itself took a lot of thought, before we settled on one that worked.</p><p>And from there, <a href="https://flybase.io/"><strong>Flybase</strong></a> was born.</p><p><strong>Why not completely rebrand?</strong></p><p>One, I still really like the name Data McFly, and a lot of work has been done on that name to build our business. Instead, Flybase is owned by Data McFly and Data McFly owns Flybase and a few other startups such as <a href="http://ubertok.com/"><strong>Ubertok</strong></a>, our video conferencing solution, <a href="http://recipeprof.com/"><strong>RecipeProf</strong></a>, our mobile app that lets you find a nutritional breakdown of your meals, and our soon to be launched <a href="http://textmylink.com/"><strong>TextMyLink</strong></a>, a new service that lets you place a widget on your website so visitors can enter their phone numbers and receive a text message with a link to download either a mobile app, ebook, audio recording or whatever else someone may put in that link.</p><p>Over all, I’m excited about where the rest of 2015 is taking Data McFly and Flybase and can’t wait to show everyone what’s in store.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a226bed2119" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/rebranding-3a226bed2119">Rebranding</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Startup Landing Pages with Flybase]]></title>
            <link>https://medium.com/data-mcfly/startup-landing-pages-with-flybase-78c7b978c74b?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/78c7b978c74b</guid>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Sat, 25 Jul 2015 05:22:45 GMT</pubDate>
            <atom:updated>2015-07-25T05:23:57.395Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately, <em>Landing Page</em> has become common and popular among startups and publishers. Every landing page has one important call-to-action, i.e. to sign up early adopters for their beta version.</p><p>To get up &amp; running as soon as possible, the simplest and fastest way to build a landing page is basically having it as a static site without any back end. The downside of this approach is, we need to figure out a way to store the emails that are signed up.</p><p>As you would expect, there are quite a few really good services you can use right of the bat.</p><ul><li><a href="http://launchrock.co/">Launch Rock</a></li><li><a href="http://unbounce.com/">Unbounce</a></li><li><a href="http://www.kickofflabs.com/">Kickofflabs</a></li><li><a href="http://my.betali.st/">My Beta List</a></li><li><a href="http://launcheffectapp.com/">Launch Effect (wordpress)</a></li><li><a href="http://www.prefinery.com/">Prefinery</a></li><li><a href="http://launch.deskgator.com/">LaunchGator</a></li><li><a href="http://quickmvp.com/">QuickMVP</a></li><li><a href="http://mailchimp.com/">mailchimp</a></li></ul><p>Some of the above services even provides HTML templates, A/B testing and much more. For a non-developer these sites would be the best fit.</p><p>If you know a bit of web development and want to build you own custom landing page, then one easy solution to use is to use <a href="http://flybase.io/">Flybase</a> to not only collect emails but even feedback.</p><p>In this brief post, I&#39;m going to show you how to use Flybase to build out that part of a landing page.</p><h4>Flybase Email Storage</h4><p>Once you have created a <a href="https://app.flybase.io/signup">flybase account</a> and logged in, create a flybase application.</p><p>You need to include the <strong>flybase javascript</strong> in your landing page. This provides the functionality to save your data (e.g. email) into your <strong>flybase application</strong>.</p><pre>&lt;script src=”https://cdn.flybase.io/flybase.js&quot;&gt;&lt;/script&gt;</pre><p><strong>Email Signup Form</strong></p><p>Here is a basic HTML template for an email sign up form.</p><pre>&lt;div class=&quot;signup&quot;&gt;<br>   &lt;h2 class=&quot;signup-title&quot;&gt;Sign up for beta&lt;/h2&gt;<br>   &lt;p id=&quot;signup-success&quot; class=&quot;text-success&quot;&gt;&lt;/p&gt;<br>   &lt;p id=&quot;signup-error&quot; class=&quot;text-danger&quot;&gt;&lt;/p&gt;<br>   &lt;form class=&quot;signup-form form-inline&quot; id=&quot;signup-form&quot; role=&quot;form&quot; onsubmit=&quot;return signup(this)&quot;&gt;<br>     &lt;input class=&quot;form-control&quot; name=&quot;email&quot; type=&quot;email&quot; placeholder=&quot;Your email. eg., joe@acme.com&quot; required&gt;<br>     &lt;button class=&quot;btn btn-success&quot; id=&quot;signup-button&quot; type=&quot;submit&quot; &gt;Join now&lt;/button&gt;<br>   &lt;/form&gt; <br>&lt;/div&gt;</pre><p><strong>Flybase script to save email addresses</strong></p><p>On the submission of the button, the below script is invoked to store the email address into your <strong>flybase application</strong>.</p><pre>&lt;script&gt;<br>var signupForm = document.getElementById(&#39;signup-form&#39;);<br>var signupSuccess = document.getElementById(&#39;signup-success&#39;);<br>var signupError = document.getElementById(&#39;signup-error&#39;);<br>var signupBtn = document.getElementById(&#39;signup-button&#39;);<br>var onSignupComplete = function(error) { <br>  signupBtn.disabled = false; <br>  if (error) { <br>    signupError.innerHTML = &#39;Sorry. Could not signup.&#39;; <br>  } else { <br>    signupSuccess.innerHTML = &#39;Thanks for signing up!&#39;; <br>    signupForm.style.display = &#39;none&#39;; <br>  } <br>}; <br>function signup(formObj) {<br>  var myFlybaseRef = new Flybase(&quot;YOUR-API-KEY&quot;, &quot;YOUR-APP&quot;, &quot;signups&quot;); <br>  myFlybaseRef.push({ <br>    email: formObj.email.value<br>  }, onSignupComplete); <br>  signupBtn.disabled = true; return false; <br>}<br>&lt;/script&gt;</pre><h4>Contact / feedback forms</h4><p>You can also store the feedback, suggestions and questions into your <strong>flybase application</strong>.</p><p>Here is a basic HTML template for a contact form:</p><pre>&lt;div class=&quot;contact&quot;&gt;<br>  &lt;h2 class=&quot;contact-title&quot;&gt;Send us a message&lt;/h2&gt;<br>  &lt;p id=&quot;contact-success&quot; class=&quot;text-success lead&quot;&gt;&lt;/p&gt;<br>  &lt;p id=&quot;contact-error&quot; class=&quot;text-danger lead&quot;&gt;&lt;/p&gt;<br>  &lt;form class=&quot;contact-form&quot; id=&quot;contact-form&quot; role=&quot;form&quot; onsubmit=&quot;return sendMessage(this)&quot;&gt;<br>    &lt;input class=&quot;form-control&quot; name=&quot;name&quot; type=&quot;text&quot; placeholder=&quot;Your name. eg., Joe&quot; required&gt;<br>    &lt;input class=&quot;form-control&quot; name=&quot;email&quot; type=&quot;email&quot; placeholder=&quot;Your email. eg., joe@acme.com&quot; required&gt;<br>    &lt;textarea class=&quot;form-control&quot; name=&quot;message&quot; placeholder=&quot;Your message for us&quot; rows=&quot;5&quot; required&gt;&lt;/textarea&gt;<br>    &lt;br /&gt;<br>    &lt;button class=&quot;btn btn-success pull-right&quot; id=&quot;send-button&quot; type=&quot;submit&quot; &gt;Send Message&lt;/button&gt;<br>  &lt;/form&gt;<br>&lt;/div&gt;</pre><p>On submission, the below script is invoked to save your email address along with the message into your <strong>flybase application</strong>.</p><pre>&lt;script&gt;<br>var contactFrom = document.getElementById(&#39;contact-form&#39;); <br>var contactSuccess = document.getElementById(&#39;contact-success&#39;); <br>var contactError = document.getElementById(&#39;contact-error&#39;); <br>var sendBtn = document.getElementById(&#39;send-button&#39;); <br>var onMessageComplete = function(error) { <br>   sendBtn.disabled = false; <br>   if (error) { <br>     contactError.innerHTML = &#39;Sorry. Could not send message.&#39;; <br>   } else { <br>     contactSuccess.innerHTML = &quot;Message has been sent.&quot;;<br>     contactFrom.style.display = &#39;none&#39;; <br>   } <br>}; <br>function sendMessage(formObj) { <br>  var myFlybaseRef = new Flybase(&quot;YOUR-API-KEY&quot;, &quot;YOUR-APP&quot;, &quot;messages&quot;); <br>  myFlybaseRef.push({ <br>    name: formObj.name.value, <br>    email: formObj.email.value, <br>    message: formObj.message.value <br>  }, onMessageComplete); <br>  sendBtn.disabled = true; <br>  return false; <br>}<br>&lt;/script&gt;</pre><p>And there it is, one of the simplest way to handle forms in your landing page. When we launched this project last fall, we actually used this same process to handle beta signups, so this is a tried and true simplistic method.</p><p>From here, You can embed this into any landing page to give yourself a method for collecting emails, then you could quickly use Node.js or PHP to loop through subscribers and send an email, or add them to your mailchimp account via their API,</p><p>You could even combine it with <a href="https://zapier.com/developer/invite/16474/c7e21a32efea8e57a70936b738918438/">Zapier.com</a> to send emails to Mailchimp or just straight to your inbox, depending on the type of form you’ve set up.</p><p>Simple, but flexible.</p><p><em>Originally published at </em><a href="http://blog.flybase.io/2015/07/23/landing-pages"><em>blog.flybase.io</em></a><em> on July 23, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78c7b978c74b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/startup-landing-pages-with-flybase-78c7b978c74b">Startup Landing Pages with Flybase</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing The Little Real-Time Web Development Book]]></title>
            <link>https://medium.com/data-mcfly/introducing-the-little-real-time-web-development-book-8be5c587ba5e?source=rss----a7bc0f42ccd8---4</link>
            <guid isPermaLink="false">https://medium.com/p/8be5c587ba5e</guid>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Roger Stringer]]></dc:creator>
            <pubDate>Wed, 04 Mar 2015 19:28:28 GMT</pubDate>
            <atom:updated>2015-03-05T18:01:31.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Szn3zWkkELfKTb9SUABS0g.jpeg" /></figure><p>We’ve been busy writing over here at Data McFly, not just blog posts and code, but the first Data McFly book as well.</p><p><a href="https://leanpub.com/real-time-web">The Little Real-time Web Development Book</a>, is a short book which will walk you through an introduction to Data McFly and it’s handy API, and then into building your first apps. We’ve divided the book into three sections:</p><p><strong>Getting started with Data McFly and real-time web development</strong></p><ol><li>We’ll cover how to get started with Data McFly</li><li>We’ll then build our first basic real-time web app</li><li>Finally, we’ll cover queries and custom events to learn how to control what data you display and when.</li></ol><p><strong>Building your Data McFly app without a server.</strong></p><ol><li>We’ll build a social news app in Angular.JS with Data McFly.</li><li>Learn how to add user login and registration</li><li>Learn how to accept comments, and votes and update the home page to show the changes</li><li>Deploying your app to the web, you’ll learn how to upload your Social news app to GitHub pages and host it for everyone to use.</li><li>We’ll also cover briefly how to use your Angular.JS web app as a mobile app thanks to tools like Ionic and PhoneGap.</li></ol><p><strong>Integrating your Data McFly app into a node.js app</strong></p><p>We’ll take the app we built in section 2, and integrate it into a node.js app to give us extra server-side power such as:</p><ol><li>RSS feeds, and RSS processing</li><li>Social login integration with Github, Google+, Facebook and Twitter</li><li>Auto-tweeting to Twitter when new links are added to your news site.</li></ol><p>When we’re done, you’ll have clear understanding of how real-time web development works, and be able to build whatever you need using Data McFly.</p><p>The book is a work in progress, but it’s available for pre-order now with a discount, normally we’re selling the book for $9.99, but as a pre-launch special, we are selling it for $6.99, this is a limited time so <a href="http://leanpub.com/real-time-web/c/g4a89WtGTX9o">Pre-order Now</a>, and get updates as we publish them to the book. We’re using <a href="http://leanpub.com/">Leanpub</a>, as our publishing platform, so any changes we make to the book, immediately get sent to you.</p><p>We’re planning to write a series of smaller books for developing with Data McFly, rather than larger books. Our next planned book is using Data McFly and the Ionic Framework to build cross-platform mobile apps that run everywhere, and from there, we’ll see what strikes us as being the next interesting topic to write about. ツ</p><p><em>Originally published at </em><a href="http://blog.datamcfly.com/2015/03/04/real-time-web"><em>blog.datamcfly.com</em></a><em> on March 4, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8be5c587ba5e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mcfly/introducing-the-little-real-time-web-development-book-8be5c587ba5e">Introducing The Little Real-Time Web Development Book</a> was originally published in <a href="https://medium.com/data-mcfly">Flybase</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>