Monday, November 18, 2019

Automated Scheduling of Facebook Live Video via Google Apps Script

Currently Facebook allows users to schedule a live video broadcast only a week in advance. If you broadcast weekly this can get tedious, so with a little bit of coding we can automate the process.

This will require a Facebook account (with admin rights to a page if you broadcast through that page) as well as a Google account. We are going to create a Google Spreadsheet with an associated Google Apps Script that will run every week to schedule your live video.
  1. Create a Google Spreadsheet
  2. Under the Tools menu, click Script editor
  3. Into that new script paste the contents of this file
  4. Create a new Facebook App under the My Apps menu on
  5. Under Settings click on Basic and copy your App ID and App Secret (click Show) into the appropriate places back in your Google Script editor
  6. Setup gsuitedevs' OAuth2 library for Google Apps Script by following the four steps there
  7. Run the logRedirectUri function in your Google Script, then under the View menu click Logs, copy the Redirect URL (starting with http)
  8. On the Facebook developer page, set up Facebook Login for your app
  9. Under the Facebook Login Settings, paste in the OAuth Redirect URI that you copied earlier
  10. In your Google Script, run the scheduleLivestream function, this won't actually schedule anything yet but instead will log a URL for you to paste into your browser to authorize the script (under the View menu click Logs, or look at the original spreadsheet)
  11. Using the Facebook Graph API Explorer, add the following permissions to your app: pages_show_list, manage_pages, publish_pages, publish_video
  12. Run the Google Script function scheduleLivestream again and watch for any errors, if it successfully schedules a broadcast then you'll see a new line in your spreadsheet
  13. Add triggers to your Google Script: under the Edit menu click Current project's triggers
    1. Click Add Trigger and set the options:
      1. scheduleLivestream
      2. Head
      3. Time-driven
      4. Week timer
      5. Every Wednesday (or whatever you prefer)
      6. 1pm to 2pm (or whatever)
      7. then click Save
    2. Click Add Trigger and set the options:
      1. onOpen
      2. Head
      3. From spreadsheet
      4. On open
      5. then click Save
  14. In your Google Script, change the following lines:
    1. var status = 'SCHEDULED_UNPUBLISHED';  to  var status = 'SCHEDULED_LIVE';
    2. var day = dateNow.getDate() + ((7dateNow.getDay()) % 7);  to var day = dateNow.getDate() + ((9dateNow.getDay()) % 7);  // for Tuesday
    3. var newDate = new Date(year, month, day, 10, 25); to the time you'd like to start the broadcast
    4. you can also change the var title line to whatever you'd like
  15. Run the scheduleLivestream function again to test, and to make sure everything has been authorized
  16. Check at some point after the Trigger time you set to make sure that the broadcast has been scheduled
Hopefully all of that worked, let me know if I've missed any steps or if this needs more detail.

Thursday, November 7, 2019

The Benefits of Small Conferences

In the last few weeks I have been to quite a few conferences around Alberta, and have been reflecting on the ideal conference size. A conference should involve information sharing and discussions or networking, the latter may be less possible at larger conferences.

Events like the annual ISTE Conference with about 20,000 attendees are impressive, and you may meet someone like Mayim Bialik, but it feels like the odds of meeting someone with whom you can have sustained and ongoing discussions are decreased. There is an ocean of information available, but I'd argue that through the internet we already have that available.

So perhaps the ideal conference size is between 150 and 500 participants. Large enough for a diversity of perspectives, but small enough to be able to meaningfully share those perspectives and get to know people. We tend to value growth as a measure of success, but perhaps we need other metrics.


Monday, November 4, 2019

Colab Git Puller Bookmarklet

Similar to the Callysto nbgitpuller bookmarklet, here's the code for a bookmarklet to open a Jupyter notebook from GitHub in Google Colab. Drag the following link to your bookmark bar/menu:


Click that bookmarklet when you are viewing a Jupyter notebook on GitHub, it will pop up a window with a link. Copy that link and you can use it to open the notebook in Colab.

If you prefer a bookmarklet that just opens the notebook in Colab (rather than giving you a link to paste somewhere) then use this one:


As always, comment if you encounter any issues or have any suggestions.