How to say Hello World via the Twitter API from browser-based JavaScript.

Overview

Twitter Hello World

Suppose I want to write an app that runs in the browser that just says Hello World from my Twitter account.

This is the canonical example, to illustrate the overhead of a development platform.

This shows where're starting, and how big an improvement is possible.

But first, the current state of the art in Twitter hello worlds circa the summer of 2022.

You can see what the app does by..

Go to this page and follow the instructions.

A blog post

Explains the whys and wherefores.

How the pieces fit together

First, this is not a tutorial for setting up a Twitter server app. I'm just listing the steps here so you can see how much work is involved in setting up the Hello World app.

  1. You'll need to set up an app on Twitter's developer portal.

  2. Set the callback URI for the app to http://yourdomain/callbackFromTwitter.

  3. Get the API Key and secret, and edit the config.json file in the server folder to include these values.

  4. There's a Node.js app in the server folder. Open the folder in your terminal app and run npm install to get all the packages it needs.

  5. Edit the config struct in the app so it's pointing to the correct port and server in config.httpPort and config.myDomain.

  6. Run the server app.

  7. There's also a browser-based app in the folder, in three files, styles.css, code.js and index.html.

  8. Edit code.js file so urlTwitterServer points to the Node app.

  9. Then run the client app. Log in to the app on Twitter. Click the button and enter a string for the Hello World message. If all goes well your message will appear on Twitter.

  10. When you're done be sure to click the link to log out.

With a simpler Twitter API

Here's the big idea.

Everything that's in the server app should be running on Twitter's server. This would be a new higher-level API.

Then look at the source code, here, for the Hello World client. That's what the developer would have to write. Twitter should still have an app registration process, except it wouldn't be concerned with how to get the user logged in, just that the user knows who they're giving access to their account to.

Obviously the user's app would have to be given access to more than just the functionality to send a tweet. If you want an idea of what that might look like, here's the interface file for the API I've been using for my own Twitter apps.

There's nothing very innovative about this, it's just following the natural process of factoring code.

Comments or questions?

Here.

You might also like...

Browser extension to add more keyboard shortcuts to twitter.com.

Browser extension to add more keyboard shortcuts to twitter.com.

Twitter Shortcut Plus Browser extension to add more keyboard shortcuts to twitter.com. Keyboard shortcuts Browse Browse links in background (default:

Jun 4, 2022

Clubhouse is a new type of social network based on voice—where people around the world come together to talk, listen and learn from each other in real-time.

Clubhouse is a new type of social network based on voice—where people around the world come together to talk, listen and learn from each other in real-time.

Awesome Clubhouse The clubhouse is a new type of social network based on voice—where people around the world come together to talk, listen and learn f

Nov 9, 2022

The invoker based on event model provides an elegant way to call your methods in another container via promisify functions

The invoker based on event model provides an elegant way to call your methods in another container via promisify functions. (like child-processes, iframe, web worker etc).

Dec 29, 2022

Open Source REST API for the best league in the world

Open Source REST API for the best league in the world

NBA REST API Open Source REST API for the best league in the world! We are not affiliated, associated, authorized, endorsed by, or in any way official

Nov 6, 2022

Connect your Ethereum smart contract to any real world API using the oracle pattern!

Minimal Viable Oracle (MVO) - An effective way to Build your own oracle with Solidity Smart contracts cannot access off-chain data directly. This repo

Aug 25, 2022

World's Best API, no doubt about it.

World's Best API, no doubt about it. Short Description This API is intended to serve smiley faces. Requesters must first register an API key, which th

Jul 5, 2022

Bookmate - Watch changes in Chrome bookmarks, and use bookmarks as an append-only key-value store via an fs-like API.

📗 Bookmate An append-only key-value store built on Chrome bookmarks, plus an asychronous stream of Bookmark changes. For NodeJS Actual production exa

Nov 8, 2022

Token-gated repositories via GitHub API.

GateRepo About | Implementation | License About Simple implementation of ERC20 token-gating GitHub repositories. Fueled by Mike's tweet. Implementatio

Oct 16, 2022

Get, change, and otherwise interact with your notes in Obsidian via a REST API.

Local REST API for Obsidian See our interactive docs: https://coddingtonbear.github.io/obsidian-local-rest-api/ Have you ever needed to automate inter

Dec 22, 2022
Comments
  • My Hello World app for Twitter

    My Hello World app for Twitter

    I wrote a simple Hello World app for Twitter.

    You could help me out by trying it and letting me know if it worked.

    It should be obvious what to do. :smile:

    http://twitterhello.scripting.com/

    opened by scripting 8
Owner
Dave Winer
Started two Silicon Valley companies. Wrote for Wired. Fellow at Harvard, NYU. Founder of podcasting, blogging, RSS.
Dave Winer
🥰 Mini world simulator is a terminal application made in JavaScript to control the world that is being generated.

Mini-world "Simulator" Mini world simulator is a terminal application made in JavaScript to control the world that is being generated. It has no other

Adrián 2 Mar 14, 2022
Next.js example using Hellō for authentication

Example application using Hellō and iron-session ?? Online demo at https://next-with-hello.vercel.app This example creates an authentication system th

Thomas Smith 3 May 20, 2022
Repository for the demos in the "Hello, Quarto!" talk

hello-quarto-demo Repository for the demos in the "Hello, Quarto!" talk Software RStudio: Version: Current release -- RStudio 2022.07.0+548 "Spotted W

Mine Cetinkaya-Rundel 8 Oct 12, 2022
A website to list tech twitter creators, across the world.

TechCreators A website to list tech twitter creators, across the world. Languages/Tools ????‍?? Demo Check out the website: TechCreators ???? Prerequi

Pushkaraj Kulkarni 18 Jan 3, 2023
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Twitter 2.9k Jan 8, 2023
Fuck Twitter NFTs - Userscript to delete or block all occurances of NFT Users on Twitter

FuckTwitterNFTs Fuck Twitter NFTs - Userscript to delete or block all occurances of NFT Users on Twitter Userscript will by default, attempt to delete

Blumlaut 1 Jan 20, 2022
Twitter bot to find what song is playing in a given uploaded twitter video.

what-song-is-this Twitter bot to find what song is playing in a given uploaded twitter video. How to setup. yarn install How to run. via npm script ya

Akinwande Akinboluwarin 17 Dec 11, 2022
A Twitter filtered search to only get the live broadcasts hosted on Twitter itself, Built using Vanilla JS and Node.js

Twitter Broadcasts Search A Twitter filtered search to only get the live broadcasts hosted on Twitter itself, Built using Vanilla JS and Node.js. Live

Mohammad Mousad 2 Oct 6, 2022
The browser (chrome/firefox) extension that hides annoying login pop-ups in the Twitter web app

The browser (chrome/firefox) extension that hides annoying login pop-ups in the Twitter web app

MaySoMusician 36 Dec 6, 2022