From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Twitter Toolkit for LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Started with the LabVIEW Twitter Toolkit

Step A: Install the Twitter Toolkit

See the Instructions available in the Installing the Twitter Toolkit VI Package tutorial.

Step B: Create your Twitter Developer Account and Application

Overview:

In order to use the Twitter API from an application you need Client/Consumer Credentials and Access Credentials. Each set of Credentials consists of a token and a secret (similar to a username and password). Client Credentials are created at the Twitter Developer site and are are used by your application when talking to the Twitter API. Keep the Client Credentials safe in your application because they are used to represent you to Twitter; if someone figures out your Client Credentials they can pretend to represent your application.

Access Credentials represent the users Credentials in relation to the application. When you use the Twitter Open VI with your Client Credentials, the user will be taken to twitter.com to login and approve your application for their account. If the user approves your application then the Twitter Open VI will return a valid handle to use the Twitter API functions. Twitter Open VI also returns the Access Credentials so that you can save them and use them the next time the user runs your application. By saving the Access Tokens you prevent the user from having to login to Twitter ever time they run your application (see the examples in Step C: Running a Twitter Example in LabVIEW for more details).

Instructions:

  1. Create a Twitter account by going to http://www.twitter.com or login using your existing account

  2. Using your twitter account, login to http://dev.twitter.com/apps

  3. Once logged in, select Create a new application
    1.Capture.PNG

  4. On the Create an Application screen enter the details for your Twitter LabVIEW Application and press Create you Twitter application. NOTE: You MUST enter a value in the Callback URL field and it can be any valid URL EXCEPT a blank Callback URL. For example, a valid value for any application using the Twitter Toolkit for LabVIEW would be the following (as seen in the screenshot below): http://www.example.com

    2.Capture.PNG

  5. After pressing Create your Twitter application you will be taken to the configuration screen for your application. Select the Settings tab, change the Access mode to Read and Write, and press Update this Twitter application's settings at the bottom of the page.
    5.Capture.PNG

  6. Return to the Details tab and verify that Access level is set to Read and Write. Take note of the Consumer Key and the Consumer Secret as these are the Client/Consumer Credentials for your application.
    3.capture.PNG

    Note: If you are creating the Twitter Application to only post on the Twitter User account that you registered with, then you can use the Create my access token button provided on this page to create access credentials. The Access Credentials on the Details tab link your application to your specific Twitter developer account (see Overview for the distinction between Access and Client Credentials).

    If you want users to be able to login and post to their own Twitter accounts then you do not need the Access Credentials on this page and only need the Client/Consumer Credentials.

Step C: Running a Twitter Example in LabVIEW

See the Instructions available in the Using the Twitter Toolkit in LabVIEW tutorial.

0 Kudos
Message 1 of 11
(30,066 Views)

I am getting an error 215 out of Verify Credentials.vi.

I have set up the application on Twitter and entered the Consumer Key and Secret.

Do you have to enter the Access Token and Secret anywhere?

Thanks,

Greg

0 Kudos
Message 2 of 11
(13,595 Views)

Hey Greg!

According to the Twitter Error Codes page it looks like Error Code 215 is a result of Bad Authentication Data: https://dev.twitter.com/docs/error-codes-responses

Some troubleshooting steps:

1. Make sure to remove any spaces before or after the Consumer Key or Consumer Secret when copying from the Twitter Application Settings page; make sure they are entered exactly as they appear on the page.

2. Check that your system clock and make sure the time is accurate.

3. Make sure you have specified a callback url such as http://www.example.com or your own website, etc.

It is not required to enter the Access Credentials. If you leave them blank then it is expected for the Verify Credentials to return an error. When Verify Credentials returns an error you will be sent to a page to login to Twitter and then valid Access Credentials will be returned when you login to your account and approve the application.


Milan
0 Kudos
Message 3 of 11
(13,595 Views)

Thanks for the response.

First of all, I am using the Post New Tweet - Finite.vi.

Once I added a callback url the program now works when I enter a Tweet, Consumer Key and Consumer Secret.

The problem I am getting now is that every time I run the program for the FIRST time, I am taken to Twitter to authenticate my app. Is there any way to not have to do this each time I run the app. I assume this is where the Access Credentials come in?

Thanks,

Greg

0 Kudos
Message 4 of 11
(13,595 Views)

OK, I think I have it now.

I added an Access Credentials control to the default state of the shift register and now I don't have to authorise my app each time.

Thanks for the help. All seems to be working nicely.

Greg

0 Kudos
Message 5 of 11
(13,595 Views)

Hey Greg!

Glad you are up and running! Yep, by setting Access Credentials you can prevent the user from having to login each time.


Milan
0 Kudos
Message 6 of 11
(13,595 Views)

Hello,

I get a GPIB error (error 0) when I try to run a simple program. The Twitter Open.vi gives no error, but the subvi after that gives. I'm using LabVIEW 2014.

Thanks,

Arend-Jan

0 Kudos
Message 7 of 11
(13,595 Views)

Hi Arend-Jan,

The best place to get help is to create a new discussion and mark it as a question. I have gone ahead and made one for us to chat in titled GPIB error (error 0) when I try to run a simple program.


Milan
0 Kudos
Message 8 of 11
(13,595 Views)

Hey MilanR,

I'm getting error 401 occured at New Tweet - Finite.vi...

Body: {"request":"\/1.1\/statuses\/update.json","error":"Read-only application cannot POST."}

I have ensured that I set the Read and Write request before using the VI.

Does this toolkit still valid as it was couple of year back when you people were discussing and I believe that error 401 is common error from twitter for all v1 APIs

https://dev.twitter.com/overview/api/response-codes

--
Ajay MV


0 Kudos
Message 9 of 11
(13,595 Views)

Oh.. That's working man.. Still valid..

  Thanks for this tool..

--
Ajay MV


0 Kudos
Message 10 of 11
(13,595 Views)