Thumbnail

Advanced Twitter Recognition

by Twitter

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

Requires ARC v10 (Updated 10/31/2022) Source Code

How to add the Advanced Twitter Recognition robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Communication category tab.
  5. Press the Advanced Twitter Recognition icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Advanced Twitter Recognition robot skill.

How to use the Advanced Twitter Recognition robot skill

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 -> Social Media -> 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:

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

or

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


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

#1  

Hi

Not working with getlastmention - it work only with getlasttweet

User-inserted image

User-inserted image

User-inserted image

PRO
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.

PRO
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