What would you do if you could connect any service in the world with any other service, and harness artificial intelligence to drive their interaction?
Stamplay can monitor and interact with hundreds of third-party services, providing an intuitive interface for and building complex workflows (with loops, conditionals, and fault-tolerance) without ever writing a line of code — unless you want to. Algorithmia provides over 4,000 (and growing) microservices ranging from simple computational utilities to advanced deep-learning tools. In combination, these allow you automate business and personal processes with the power of AI.
Let’s explore one simple example for you to build on: this step-by-step tutorial will show you how to monitor Intercom chats, detect unhappy customer interactions, and escalate them to your Slack channel for immediate followup.
Step 1: Create a Stamplay Account and Add a New Project
Head over to Stamplay.com and start a free trial (and/or use coupon code “Algorithmia17” to get 50% off your first month)!
There are several blueprints available to start from, but today we’ll create an entirely new project from scratch, so click the big “plus” and pick a name for your Project.
Step 2: Begin a New Flow and Select a Trigger
Within a Project, Stamplay allows you to create many Flows. Each Flow is a progression from some Trigger, through one or many steps, to some eventual action. We’ll start creating our new Flow by clicking “Get Started”.
Next, we pick a Trigger which will kick off our Flow. Under “CRM & Support”, we click “Intercom”. Then, we pick “New Message from a User” as the specific action we’ll be triggering on.
Click “Continue”, and you’ll be prompted to connect your Intercom account. After doing so, “Continue” again and you’ll be prompted to send a message to Intercom before you can save the Action. This is because Stamplay will read the actual content of the incoming Intercom message and use it to fill in the template you’ll edit in the next step, so simply open up another browser window, go to the website on which you’ve installed Intercom, and send a new message (I use a new private browser window for this, to guarantee that I look like a new user to Intercom). Once you’ve done so, you can save your Action.
Step 3: Query Algorithmia for Sentiment Analysis
In order to determine if the Intercom message is positive (happy/satisfied) or negative (angry/frustrated), we’ll need to do a bit of natural language processing. Stamplay doesn’t handle this internally, but Algorithmia provides a ton of machine-learning services. Hovering over the “plus” icon to the right of our Intercom step, we see a button to add another Action. After clicking this, we pick the category “Artificial Intelligence” and select “Algorithmia”.
Next, we’re presented with several different services that Algorithmia can perform. There isn’t room to list all 4000, so only a handful are shown — but should you ever wish to use one which is not on the list, selecting the last option (“Call an algorithm”) will allow you access to any Algorithmia algorithm by name.
For now, we’ll simply select “Sentiment Analysis”, then hit “Continue”. The Account step will then ask for your Algorithmia API Key; you can get this from the credentials tab of your Algorithmia account page. Paste the key (starting with “sim…”) into Stamplay, and continue.
Now we must pick which information to send to Sentiment Analysis. Next to the Document field, clicking the circular playlist icon allows us to pick a field from the Intercom output. Click down the tree of fields, finding body.data.item.conversation_message.body:
We can ignore the “Language” field (the algorithm will auto-detect it), and click “Save”.
Bonus: if you want to see the sentiment detection in action, click the “Test” tab under the Algorithmia action, enter some text, and run the test. You’ll get back a response containing a “sentiment” value somewhere between 1 (very positive) and -1 (very negative), depending on how happy or angry your message was.
Step 4: Escalate the Angry Users to Slack
Now that we can get the sentiment of any incoming message, we want to do something with the most negative ones. Clicking the “plus” circle next to Sentiment Analysis, we get a menu which we could use to add another Action… but this time, we’ll add a conditional first. Hit “Condition”, and an “IF” block will appear. Now click in the text entry box labelled “select from data pill”, and pick “sentiment” from the Algorithmia drop-down. Next, pick “(Number) Less than” as the comparator in the middle box, and type -0.2 in the last box:
By saving this, we’ve created a test: items added under this is “IF” conditional will only be run if the sentiment score from Algorithmia is below -0.2 (somewhat negative). If you want to change how sensitive your workflow is to more or less negative statements, simply enter a different number.
Lastly, we’ll forward those negative statements on to Slack, so our team will notice them immediately. Clicking the circled “plus” to the right of the “IF” block, we click the “IF TRUE” button, then add another Action… this time picking Slack from the “Bots & Messaging” category. We check “Post Message” in the Action, then connect and authorize Slack.
With Slack connected, we can now pick a channel to broadcast into, and set the message we want shown. Since we’d like to see the message itself in Slack and also get a link to the message inside Intercom, we’ll click the playlist icon to the right of the “Message” field and pick conversation.body.data.item.conversation_message.body, but then click again to append conversation.body.data.item.links.conversation_web as well. Lastly, we can delete the contents of the “Message Attachments” field (this is just sample code), and click “Save” (optionally also using the “Test” tab to post a test message to Slack).
Step 5: Activate and Test your Flow
Now that we have everything in place, we’re ready to turn on our Workflow and try it out! At the top of the flow, click the red slider to turn it green indicating that your Workflow is enabled:
With that done, we can head to the website where our Intercom is running and send a new Message (a new private browser window will guarantee that Intercom sees it as a brand new conversation). If the message is angry-sounding enough, then within a few seconds we should see a notification in Slack containing both the message and a link to respond!
Step 6: Build your Own Awesome Thing!
Where will you go from here? Stamplay provides a wide variety of connectors, so you can pick-and-choose the services you want to hook up. You can add conditional logic and loops right from the UI, but there’s also the option to add NodeJS codeblocks to inject more complex logic into your workflows. And, since you can access any of Algorithmia’s huge catalog of machine-learning services from right inside any workflow, the possibilities are endless.
Let us know what cool tools you decide to build, and enjoy the extra time you’ve freed up by automating away your most repetitive tasks!