Thumbnail

Advanced Twitter Recognition

Retrieve twitter tweets and process them to have your robot do cool stuff via twitter posts.

+ How To Add This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the Misc category tab.
  7. Press the Advanced Twitter Recognition icon to add the control to your project.

Manual

Retrieve twitter tweets and process them to have your robot do cool stuff via twitter posts. This skill accepts two ControlCommand() for retrieving either the latest mention or latest tweet.

Mention: A latest mention is when another twitter account sends a message via @UserName to your account. This allows anyone who sends a tweet tagging your @username will be retrieved.

Tweet: A tweet is only tweets from your account. This means only tweets from your account will be retrieved.

Main Window


User-inserted image


1. Text Field
Displays the Twitter messages according to the ControlCommand() script you execute.

2. Twitter Variables 
3 different variables for your Twitter message. There's a string variable for the whole twitter message ($TwitterMessage), a string for the author of the message, which may be yours if querying Tweets otherwise it will be another author if it is a mention ($TwitterScreenName) and an number to check if there is a new message to process ($TwitterSuccess).

Settings


User-inserted image


*Note: The settings are found in a unique location: Options -> Twitter.

1. Get Verification Code Button
Opens up twitter.com for you to sign into your twitter account. Once signed in you can connect your twitter account to ARC. Twitter will give you a verification code to enter in the verification code field.

2. Verify Button
Enter the verification code from twitter.

3. Result Field 
Displays the status of the twitter account configuration (Successful/Unsuccessful/Not configured).

How to Use Advanced Twitter Recognition


1) Add the Advanced Twitter Recognition skill to your ARC project (Project -> Add Skill -> Misc -> Advanced Twitter Recognition).

2) If you'd like to view the Twitter variables in real-time add the Variable watcher skill (Project -> Add Skill -> Scripting -> Variable Watcher).

3) Give ARC Twitter access by using the top menu and selecting Options -> Twitter and entering in the required settings. This allows ARC to communicate with Twitter's API.

4) Run a Code sample to interact with your Twitter account.

Code Samples


This Blockly example queries the latest tweet that you have created from your account and speaks out of the PC speaker.
User-inserted image


This Blockly example queries the latest mention that someone tagged your username. This also includes if you tagged yourself.
User-inserted image


A more advanced Blockly code snippet will continually check the account every 5 seconds for movement commands. The commands supported in this code are forward, left, or right.
User-inserted image


If you simply would like to run a script to display the latest tweet or mention you can use:

Code:

controlCommand("Advanced Twitter Recognition", "GetLatestTweet")
or

Code:

controlCommand("Advanced Twitter Recognition", "GetLatestMention")

Requirements


ARC 2019.06.25.00 or later

Resources


The source code for this skill is available here: github.com/synthiam/Behavior_Control_Advanced_Twitter_Recognition

#1  
Hi

Not working with getlastmention - it work only with getlasttweet

User-inserted image


User-inserted image

User-inserted image
Synthiam
#2  
The screenshots do not display a mention. This is from the manual:

User-inserted image
#3  
Sorry DJ Sures , i was thinking it was direct message retrieval.

All is working fine with @Username Mention in the tweet

I will try another solution to be able to retrieve direct messages.
Synthiam
#4  
Direct message? Hmmm I can take a look and see if it can be added. 

To clarify, do you mean direct message as in private? Not sure if I can access that with the api but I’ll check
#5  
Yes I mean direct messages in private
but I am not sure that your API Twitterizer support that
I use Tweetinvi API which support private messages.
I can if yu want rewrite your code with Tweetinvi , and send you back.

But you need first to modify your twitter authorization process for the application in order to allow access to private messages (twitter developper account parameters)

Let me know and I can work on it.
#6  
I just made some tests with your source code adapted with Tweetinvi API , it's working( i just test private messages with my twitter credentials ...)

Just twitter rate limits for the free plan - 15 request every 15 minutes for private messages and 180 requests every 15 minutes for tweets and mentions.
I was using before the stream feature in Synbot plugin but it has been deprecated.

I will have a look to Account activity and webhooks feature - no rate limits only limited to 1 webhook per application and 10 account subscribers ( account to survey), but it seems complex and limits are not really suited to an ARC integration (10 simultaneous twitter robot accounts in the free plan ...)

in any case , it will be fine if you allow private messages in your twitter authorization process.

linked is code used for my tests.
Test twitter JLB.zip