Saturday, March 2, 2019

How to get Civilization 6 turn notifications on your iPhone

The Feb 2019 update to Civilization VI added support for multiplayer "Play by Cloud" games. These are long-running asynchronous games where the save file lives on the cloud and everyone take their turn when it comes up. It's useful to be notified when it's your turn to keep the game moving. Steam has desktop notifications that can help, but it would be great if you could be notified elsewhere too. I'll show you how we can use this to set up notifications to your phone.

The developers also added "Play By Cloud Webhook URL" option in the "Game Options" screen. If you type a URL there, Civ will send a message to that URL every time it is your turn in a game. The message looks something like this:

{
   "value1": "Utah Friends game",
   "value2": "BJ",
   "value3": "134"
}

The first value is the name of the multiplayer game. The second value is the name of the player whose turn it is. The third value is the turn number.

Of course, that's only helpful if you have a computer waiting around on the internet for someone to send it messages like that. Luckily, there's a service already doing exactly that!

IFTTT stands for "If this, then that". It's a free web service that lets you connect your apps together. You can do things like "If I post on Facebook, then post it on Twitter" or "If the forecast shows rain, send me an email". In this case, we want "If you receive a Civ VI turn notification, send me a notification." We can build that on IFTTT by using the "Webhooks" trigger and the "Notifications" service.

Building our applet

We'll go through this step-by-step
  • Create an account at IFTTT.com
  • After you're signed in, go to "My Applets"
  • Choose "New Applet". You'll see this:
  • Select "+this" and choose "Webhooks"

  • Select the "Receive a web request" trigger.

  • When asked to give your event a name, choose something like "civ6_turn_notification", and click "Create trigger"
  • We've determined that our trigger will run whenever a "civ6_turn_notification" web request is received. Now we need to decide what will happen in response. Select "+that".
  • We want to receive a notification on our phone, so we're going to choose the "Notifications" service.

  • There are two options: A basic notification and a rich notification. A basic notification works fine for our needs. 

  • Now we get to decide what our notification will say! We can use the three values Civ is sending in the message to fill in our notification. I used "It's {{Value2}}'s turn in {{Value1}}. (Turn {{Value3}})", but you can use whatever you want.
  • We've now created a trigger and a response, which together are called an "applet". On the last page, you'll be asked to give your applet a name. Enter the name, click "Finish", and we're done with that part!
  • Make sure you've installed the IFTTT app and logged in, so your phone will be connected to IFTTT.

Configuring Civ to send the Webhook

You're almost done! Now we just need to set up Civ 6 to send the message to your new little applet.

You'll need to visit the IFTTT Webhooks settings page to get your account key. You'll see a URL listed there that looks something like this:

https://maker.ifttt.com/use/<some_weird_text_here>

You can visit that URL to see an example of how it all works and try it out, but in short, the text in the place of "<some_weird_text_here>" is your webhook key that ties things to your particular account so that you're getting the notifications instead of me. We're going to take that account key and build a webhook URL for Civ. Yours will look like this:

https://maker.ifttt.com/trigger/civ6_turn_notification/with/key/<that_same_weird_text_here>

You can see the event name we chose earlier inside the URL. If you used a different event name, you'll need to use that same name here. Take that URL and put it into Civ 6, on the "Game Options" page. It will look something like this:



And now you're done! You can choose whether to be notified every turn or just on your own turn, whatever works best for you.

Enjoy!