A simple service to turn a text into a tweet. My use case for this is for me to be able to tweet via my Somewear satellite messenger device. The Somewear can text US/CA phone numbers via satellite so all I need to do is turn a text into a tweet. Twitter's text to tweet service won't work for this as it needs to be tied to my phone number, which won't work in this case as the texts will be coming from Somewear's phone numbers which could theoretically change at any time.
- Follow the instructions here to install Serverless and set up the AWS cli and credentials.
- Setup a Twilio account
- Setup a Twitter account and Twitter app to get the credentials needed for the next step
- Set up a
keys.test.ymland do the same for any other environments (see example below)
REQUIRED_SUBSTRINGis a value that needs to be in the SMS message for the tweet to posted. The string itself is removed from the tweet and the remaining string is 'trimmed' to remove spaces from the beginning / end of the string.
- To deploy run
serverless deploy -v(you can optionally add the
--stage ENV_NAMEflag otherwise it defaults to
- Copy the endpoint from the
Stack Outputsending in
smsreceivedand add it as one of your number`s SMS webhook hook in the Twilio console
- Send a text message to the number from the previous step and you should see that message show up as a tweet on your Twitter account
TWITTER_CONSUMER_KEY: EXAMPLE_TWITTER_CONSUMER_KEY TWITTER_CONSUMER_SECRET: EXAMPLE_TWITTER_CONSUMER_SECRET TWITTER_ACCESS_TOKEN_KEY: EXAMPLE_TWITTER_ACCESS_TOKEN_KEY TWITTER_ACCESS_TOKEN_SECRET: EXAMPLE_TWITTER_ACCESS_TOKEN_SECRET REQUIRED_SUBSTRING: EXAMPLE_REQUIRED_SUBSTRING