top of page
Twitter Integration

Twitter Integration

Tweet and get the latest tweet using the twitter-integration Velo package

Intermediate.png

Beginner

1K

Published:

March 9, 2021

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

In this example, we use the Twitter Integration Velo package to post and get tweets from a Wix site. You can tweet a timestamp to the VeloExamples Twitter account and get the latest tweets from any Twitter account.


For more information about this Velo Package, please see the Readme in the package folder located in the Code Files section of your site.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It

We installed the Velo package on our site, and followed the steps described in the Setup section of the package’s readme file.  

 

Page Elements


In our site we added the following elements:


  • Loader GIF: runs when getting or sending a tweet. 


Generate a Tweet


  • 2 buttons: one for generating the current timestamp and tweeting it, and one hidden button that is shown after tweeting and links to Twitter.

  • Text element: to display a success message.
     

Get Latest Tweet


  • Text input: for entering a Twitter account name to get the latest tweet.

  • Text box: (read-only mode) for displaying the content of the tweet.

  • Button: to get the latest tweet. 

 


Backend code


We used a web module named twitter-wrapper.jsw to wrap the package functions and use them in our page code. In the web module, we imported the tweet() and getLatestTweet() functions from the package. The web module contains 2 functions: 

 

  • tweetWrapper(): Gets the content of the tweet (the timestamp, in our example) and calls the package’s tweet() function with the content.

 

  • getLatestTweetWrapper(accountNameInput): Calls the package’s getLatestTweet() function with the provided account name or if no account is specified, with our default Twitter account: @VeloExamples.

 

Page Code


We imported the wrapper functions from the web module. Then we added onClick event handlers to the 2 buttons. When a site visitor clicks a button, the corresponding backend function is called, either generating or getting a tweet. 

APIs We Used

Non-code example.

Non-code example.

Non-code example.

Related Articles

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Salesforce Integration

Salesforce Integration

Manage account data records in Salesforce using the salesforce-integration Velo package

Intermediate.png

Intermediate

Google Sheets Integration

Google Sheets Integration

Manage phonebook data in a Google Sheet using the google-sheets-integration Velo package

Intermediate.png

Intermediate

SendGrid npm Integration

SendGrid npm Integration

Use SendGrid’s npm module to send emails from your site

Intermediate.png

Intermediate

Anchor 2
bottom of page