Skip to content

andrejacobs/example_twitter_golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example_twitter_golang

Send a tweet to Twitter using Go.

This example code is a precursor for me while I am working on my hobby project ajtweet that I will be using to schedule tweets.

See my blog post for more details on how to explore the Twitter APIs and how I wrote this code.

NOTE: This uses the gotwi library for doing the heavy work.

Configuration

Install the required go packages:

go mod tidy

Configure your Twitter API Key, Secret and OAuth 1 User token and secret.

cp env_example .env
# Edit the .env file.

Build and Send a tweet

Build the executable:

go build -o tweet .

Source the environment variables:

source .env

Send a tweet:

./tweet "Test: Hello world from golang"
tweet id 1527644512285343745

About

Send a tweet to Twitter using Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published