Skip to content

Latest commit

 

History

History
120 lines (97 loc) · 5.67 KB

Twilio.md

File metadata and controls

120 lines (97 loc) · 5.67 KB

Overview

Prerequisities

This guide assumes:

  1. You are familiar with JSON formatting
  2. You have read and understood the Alarms Wiki
  3. You are comfortable with the layout of alarms.json.

Introduction

Twilio allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs.

PokeAlarm offers the following for Twilio:

Basic Config

These alarms.json parameters are required to enable the alarm service:

Required Parameters

Parameters Description
type must be twilio
active 'True' for alarm to be active
account_sid Your Account SID from Twilio
auth_token Your Auth Token from Twilio
from_number Your Twilio number to send from
to_number Your number to receive texts from

Example: Basic Alarm Configuration using Required Parameters

{
	"active": "True",
	"type":"twilio",
	"account_sid":"YOUR_API_KEY",
	"auth_token":"YOUR_AUTH_TOKEN",
	"from_number":"YOUR_FROM_NUM",
	"to_number":"YOUR_TO_NUM"
}

Note: The above code is to be inserted into the alarms section of alarms.json. It does not represent the entire alarms.json file.

Advanced Config

In addition to the above required parameters, several optional parameters are available to personalize your notifications.

Optional Parameters

These optional parameters below are applicable to the pokemon, pokestop, gym, egg, and raid alarm code of the JSON file.

Optional Pokemon Parameters

Parameters Description Default
message Text message for pokemon updates "A wild <pkmn> has appeared! <gmaps> Available until <24h_time> (<time_left>)."

Optional Pokestop Parameters

Parameters Description Default
message Text message for pokestop updates "Someone has placed a lure on a Pokestop! <gmaps> Lure will expire at <24h_time> (<time_left>)."

Optional Gym Parameters

Parameters Description Default
message Text message for gym updates "A Team <old_team> gym has fallen! It is now controlled by <new_team>. <gmaps>"

Example: Alarm Configuration Using Optional Parameters

Below is an example of these optional parameters and how they are incorporated into a functional alarm layout.

{
    "active": "True",
    "type":"twilio",
    "account_sid":"YOUR_API_KEY",
    "auth_token":"YOUR_AUTH_TOKEN",
    "from_number":"YOUR_FROM_NUM",
    "to_number":"YOUR_TO_NUM",
    "pokemon":{
        "from_number":"YOUR_FROM_NUM",
        "to_number":"YOUR_TO_NUM",
        "message": "A wild <pkmn> has appeared! <gmaps> Available until <24h_time> (<time_left>)."
    },
    "pokestop":{
        "from_number":"YOUR_FROM_NUM",
        "to_number":"YOUR_TO_NUM",
        "message": "Someone has placed a lure on a Pokestop! <gmaps> Lure will expire at <24h_time> (<time_left>)."
    },
    "gym":{
        "from_number":"YOUR_FROM_NUM",
        "to_number":"YOUR_TO_NUM",
        "message": "A Team <old_team> gym has fallen! It is now controlled by <new_team>. <gmaps>"
    },
    "egg": {
        "message": "A level <raid_level> raid is incoming! <gmap> Egg hatches <begin_24h_time> (<begin_time_left>)."
    },
    "raid": {
       "message": "A raid on <pkmn> is available! <gmap> Available until <24h_time> (<time_left>)."
    }
}

Note: The above code is to be inserted into the alarms section of alarms.json. It does not represent the entire alarms.json file.

How to get the Account SID, Auth Token, and Twilio Number

  1. Go to Twilio and click 'Get a free API key'. Fill out the following form, and enter your phone number to verify your account.

  2. On the left hand side, click the Home Button and then click Dashboard. The Account SID and Auth Token will be listed. To reveal the Auth Token, click on the lock next to it.

  3. Scroll down and click on '# Phone Numbers'. Then click 'Get Started' to get your free number.

  4. If you wish to text to different numbers, you need to register each before you are allowed to message them. This can be done from the 'Verified Caller ID's' page.