• Medium One

Send a Tweet from your Medium One Account

Updated: May 16

This tutorial will show you how to send tweets from your Medium One account.

In this tutorial, you will:

  1. Create a Twitter account

  2. Tweet from Medium One

Here’s what you need to get started:

  1. Medium One Prototyping Sandbox [Buy]

Step 1. Create a Twitter Account

If you don’t have a twitter account, create one on

Now you have a new twitter page.  Keep this page open on the same laptop where you will login to your Medium One account.  This allows us to link your Medium One account with your Twitter account, which we will do in the next step.

Step 2. Link your Twitter Account to Medium One

Login to your Medium One account.

In the left-hand menu, select External APIs, then click on Add New Service Key.

“Connect an External Service” will display.  Select Service, then Twitter from the dropdown menu.

Click Save and Activate.  You will see Twitter added as an external API.

Authorize Medium One to use your Twitter account.  Click Authorize app.

Once authorized, your Medium One account will acknowledge that it is linked to your twitter account.

Step 3. Create a Workflow to Send a Tweet

If you do not have any users in your Medium One sandbox, then create at least one.  Go to Manage Users (left-hand menu) and click Add New User. Create a user and save.

Let’s send a tweet at noon each day with the current weather for our location.  

Click on the Workflow Studio icon and then click Create.  

Add Inputs:

  1. Select Tags & Triggers

  2. Select Scheduler and drag the Daily module into the workflow.

  3. Double click on Daily and select your user, set Schedule to 12:00pm, and set Timezone to your time zone.  Click Save.

Add Code module:

  1. Select Modules

  2. Select Foundation and drag Base Python to the workflow editor window.

Connect Inputs to Code module:

  1. Connect Daily to Base Python.

Replace the Base Python code

This code uses the pre-existing Module Library  Weather.get_weather_by_coordinates(lat, lon). It gets the current weather at the latitude and longitude specified.  We are using the latitude and longitude for Santa Clara, California.  Note:  You can change this to any city by googling that city’s latitude and longitude and replacing it in this code.

Double-click on the Base Python module and replace all code with the following:

import Twitter
import Weather
import json

#Latitude and Longitude for Santa Clara, California
lat = 37.426048
lon = -121.975243

weather = Weather.get_weather_by_<wbr />coordinates(lat, lon)
#temperature in Kelvins
temp_K = weather['main']['temp']
#temperature in Fahrenheit
temp_F = (1.8 * (temp_K - 273)) + 32

Twitter.post_status("The current temperature is "+ str(temp_F) +"F") 

Your Base Python module should look like this:

Click Save and Activate.

At noon each day, you will tweet the current weather for Santa Clara, California.

Congratulations!  You have successfully added Twitter to your Medium One account!

Want to learn more about what Medium One can do?

Check out our documentation and tutorials & get started on your next IoT project!

© 2018 Medium One   All Rights Reserved

4633 Old Ironsides Dr. #280, Santa Clara, CA  95054        


  • YouTube - White Circle