All Projects → brminnick → TextMood

brminnick / TextMood

Licence: MIT license
A Xamarin + IoT + Azure sample that detects the sentiment of incoming text messages, performs sentiment analysis on the text, and changes the color of a Philips Hue lightbulb

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to TextMood

xamarin-chat-signalr
Xamarin Forms Modern Chat Using SignalR ASP.NET
Stars: ✭ 12 (-76.92%)
Mutual labels:  xamarin-forms, signalr, xamarin-ios, xamarin-android, asp-net
Azure For Developers Workshop
The Azure cloud is huge and the vast service catalog may appear daunting at first, but it doesn’t have to be!
Stars: ✭ 38 (-26.92%)
Mutual labels:  xamarin-forms, azure-functions, xamarin-ios, xamarin-android, cognitive-services
HackerNews
A .NET MAUI app for displaying the top posts on Hacker News that demonstrates text sentiment analysis gathered using artificial intelligence
Stars: ✭ 184 (+253.85%)
Mutual labels:  sentiment-analysis, xamarin-forms, xamarin-ios, xamarin-android, cognitive-services
hue-lights
Gnome Shell extension for Philips Hue compatible lights controlled by the Philips Hue Bridge and for controlling Philips Hue HDMI sync box.
Stars: ✭ 157 (+201.92%)
Mutual labels:  philips-hue-lights, philips-hue, philips, philips-hue-bridge
Cognitive-Face-Xamarin
A client library that makes it easy to work with the Microsoft Cognitive Services Face API on Xamarin.iOS, Xamarin.Android, and Xamarin.Forms and/or Portable Class Libraries.
Stars: ✭ 18 (-65.38%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android, cognitive-services
XamarinAzureChallenge
Create an iOS/Android app using Xamarin.Forms and connect it to a serverless Azure Function
Stars: ✭ 59 (+13.46%)
Mutual labels:  xamarin-forms, azure-functions, xamarin-ios, xamarin-android
hueplusplus
A simple C++ library to control Philips Hue lights on Linux, MacOS, Windows, Espressif ESP32 SDK and Arduino. Full documentation at
Stars: ✭ 48 (-7.69%)
Mutual labels:  philips-hue-lights, philips-hue, philips, philips-hue-bridge
Connectivityplugin
Connectivity Plugin for Xamarin and Windows
Stars: ✭ 253 (+386.54%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Arcgis Toolkit Dotnet
Toolkit for ArcGIS Runtime SDK for .NET
Stars: ✭ 125 (+140.38%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xamarin Demos
This repository contains the Syncfusion Xamarin UI control’s samples and the guide to use them.
Stars: ✭ 218 (+319.23%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xamarin.forms.videoplayer
A Xamarin Forms control to render the native video player on every platform.
Stars: ✭ 140 (+169.23%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xaml Code Experiences
A collection of the experiences I have collected during days of Xamarin and Wpf, while following the MVVM design pattern.
Stars: ✭ 114 (+119.23%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Ffimageloading
Image loading, caching & transforming library for Xamarin and Windows
Stars: ✭ 1,288 (+2376.92%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xamuidemo
Xamarin Forms Login Page UI Kit
Stars: ✭ 82 (+57.69%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Faceoff
An iOS, Android and UWP app created in Xamarin.Forms that uses Microsoft's Cognitive Emotion API Services to compare facial expressions
Stars: ✭ 79 (+51.92%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xamarin Docs
Xamarin Documentation - public content repo
Stars: ✭ 136 (+161.54%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Xamarin Playground
Random cool stuff I play around using Xamarin.. :3 Some of these cool projects I feature them on my blog, with step by step explanation. :) Don't forget to check it out. Go to: theconfuzedsourcecode.wordpress.com
Stars: ✭ 183 (+251.92%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Plugin.audiorecorder
Audio Recorder plugin for Xamarin and Windows
Stars: ✭ 140 (+169.23%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
Microsoft.maui.graphics
Stars: ✭ 160 (+207.69%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android
FilePicker
FilePicker for Xamarin.Forms
Stars: ✭ 14 (-73.08%)
Mutual labels:  xamarin-forms, xamarin-ios, xamarin-android

Mobile Backend

TextMood

An IoT + Azure sample that detects the sentiment of incoming text messages, performs sentiment analysis on the text, and changes the color of a Philips Hue lightbulb to correspond with the average sentiment.

Architecture

Text Mood Architecture

Demo

  1. The phone on the left sends a text message to the Twilio phone number.
  2. Twilio forwards the text message to an Azure Function
  3. This first Azure Function determines the sentiment of the message then sends an emoji response back to the phone on the left
  4. The second Azure Function saves the message to an Azure SQL Database
  5. The third Azure Function invokes SignalR
  6. SignalR sends a real-time update to the phone on the right, containing the new message
  7. The phone on the right displays the new message, then updates its background color to match the average sentiment of the received messages
  8. The phone on the right then simultaneously changes the light color of the Philips Hue light to match the average sentiment

Text Mood Demo

Cognitive Services Setup

POST Request

{
  "documents": [
    {
      "language": "en",
      "id": "251c99d7-1f89-426a-a3ad-c6fa1b34f020",
      "text": "I hope you find time to actually get your reports done today."
    }
  ]
}

Response

{
"sentiment": {
  "documents": [
    {
      "id": "251c99d7-1f89-426a-a3ad-c6fa1b34f020",
      "score": 0.776355504989624
    }
  ]
}

1. Create a Sentiment Analysis API Key

To use the Sentiment Analysis API, we'll need to first create an API Key using the Azure Portal.

  1. Navigate to the Azure Portal

  2. On the Azure Portal, select + Create a Resource

  3. In the New window, select AI + Machine Learning

  4. In the Featured frame, select Text Analytics

  5. In the Create window, make the following selections

    • Name: TextMood
    • Subscription: [Select your Azure subscription]
    • Location: [Select the location closest to you]
    • Pricing Tier: F0 (5K Transactions per 30 days)
      • This is a free tier
    • Resource Group: TextMood
  6. In the Create window, select Create

  7. On the Azure Portal, select the bell-shaped notification icon

  8. Stand by while the Notifications window says Deployment in progress...

  9. Once the deployment has finished, on the Notifications window, select Go to resource

  10. In the TextMood Resource page, select Keys and locate KEY 1

    • We will use this API Key when we create our Azure Function
  11. In the TextMood Resource page, select Overview and locate the Endpoint

    • We will use this Url when we create our Azure Function

2. Create an Azure Function

Azure Functions are a serverless offering in Azure. In these steps, we will use Azure Functions to create a POST API.

  1. Clone or download this repo

    • To clone the repo using git, open a cmd prompt and enter the following command:
      • git clone https://github.com/brminnick/TextMood.git
    • To download the repo use the following steps:
      • Click Clone or Download
      • Click Download Zip
  2. After downloading/cloning the repo, locate TextMood.sln

  3. Launch TextMood.sln in Visual Studio

  4. In CognitiveServicesConstants.cs, for TextSentimentAPIKey, replace Your API Key with the Key from the TextAnalytics Cognitive Service resource created earlier

  5. In CognitiveServicesConstants.cs, for BaseUrl, replace Your Cognitive Services Base Url with the Base Url from the TextAnalytics Cognitive Service resource created earlier

  6. In the Visual Studio Solution Explorer, right-click the TextMood project

  7. In the right-click menu, select Publish

Right Click Publish

  1. In the Publish window, select Function App
  2. In the Publish window, select Create New
  3. In the Public window, select Publish

Publish Window

  1. In the Create App Service window, enter an App Name

    • Note: The app name needs to be unique because it will be used for the Function's url
    • I recommend using TextMood[LastName]
      • In this example, I am using TextMoodMinnick
  2. In the Create App Service window, select your subscription

  3. In the Create App Service window, next to Resource Group select New...

Create App Service

  1. In the New resource group name window, enter TextMood
  2. In the New resource group name, select OK

Create App Service Group

  1. In the Create App Service window, next to Hosting Plan, select New...

New Hosting Plan

  1. In the Configure Hosting Plan window, enter a name for App Service Plan

    • I recommend using TextMood[LastName]Plan
      • In this example, I am using TextMoodMinnickPlan
  2. In the Configure Hosting Plan window, select a Location

    • I recommend selecting the location closest to you
  3. In the Configure Hosting Plan window, for the Size, select Consumption

  4. In the Configure Hosting Plan window, select OK

Configure Hosting Plan

  1. In the Create App Service window, next to Storage Account, select New...

New Storage Account

  1. In the Storage Account window, enter an Account Name
    • I recommend using textmood[LastName]
      • In this example, I am using textmoodminnick
  2. In the Storage Account window, for the Account Type, select Standard - Locally Redundant
  3. In the Storage Account window, select OK

New Storage Account

  1. In the Create App Service window, select Create

Create App Service

  1. Stand by while the Azure Function is created

Deploying App Service

  1. In the Visual Studio Solution Explorer, right-click the TextMood project
  2. In the right-click menu, select Publish

Right Click Publish

  1. In the Publish window, select Publish

Azure Functions Publish

4. Copy Azure Functions Url

  1. Navigate to the Azure Portal
  2. On the Azure Portal, select Resource Groups
  3. In the Resource Group window, select TextMood

Resource Group TextMood

  1. In the TextMood Resource Group window, select Overview
  2. In the TextMood Overview window, select the Azure Function resource, TextMood[LastName]

Open Functions

  1. In the Azure Functions window, select AnalyzeTextSentiment
  2. In the AnalyzeSentiment window, select Get Function Url
    • We will use this Url when we create our Twilio phone number

Get Function Url

Twilio Setup

1. Create Twilio Phone Number

  1. Log into your Twilio account and navigate to the Manage Numbers page.

  2. Click the + sign to buy a new number

    • Note you may skip this step if you have an existing Twilio Phone Number

Buy a new number

  1. On the Buy a Number page, select a Country

    • For this example, I am using United States
  2. On the Buy a Number page, tap the Number drop down and change it to Location

  3. On the Buy a Number page, enter a location name

    • For this example, I am using San Francisco
  4. On the Buy a Number page, check SMS

  5. On the Buy a Number page, click Search

Buy a new number page

  1. On the search results page, locate the number you'd like to purchase and select Buy

Buy Number

  1. In the confirmation window, select Buy This Number

Buy This Number

  1. In the purchase confirmation window, select Setup Number

Setup Number

  1. In the Messaging section, next to A Message Comes In, select Webhook
  2. In the Messaging section, next to A Message Comes In, enter the Azure Function Url that we created in the previous section
  3. In the Messaging section, next to A Message Comes In, select HTTP POST
  4. In the Manage Numbers window, select Save

Messaging

2. Send a Text

  1. Open a text messaging app and send a text message to your Twilio phone number

Happy Text

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].