How to Setup a !weather Command


#1

As weather APIs are not generally free, PhantomBot is unable to provide a built-in command to support this. However, it is possible for you to easily add a command after you sign-up for a weather API service. There are many services available, these steps show how to use Apixu which allows for 10,000 free look-ups a month.

First, go to Signup - Apixu.com

On the first screen, provide details for an account as requested:

They require you to verify your account via email:

When you receive that email, click on the link, as with any verification service.

Now, login to the service again per their request. Your username is your email address.

Once you login, you are provided an API key:

In this case, my API key is 046908053301467f8ef165232180505. Take note of your API key, this is needed when you add the custom command. Please note that I regenerated my API key and this one is invalid, it is not suggested that you try to use it as a test.

In PhantomBot, add a custom command, using your API key where API_KEY_GOES_HERE is shown:

!addcom weather (customapijson http://api.apixu.com/v1/current.json?key=API_KEY_GOES_HERE&q=$1 {Weather for } location.name {: } current.condition.text {Temps: } current.temp_f {F } current.temp_c {C})

Example:

!addcom weather (customapijson http://api.apixu.com/v1/current.json?key=046908053301467f8ef165232180505&q=$1 {Weather for } location.name {: } current.condition.text {Temps: } current.temp_f {F } current.temp_c {C})

Ran from chat:

weather 80219
[05-05-2018 @ 11:02:40.903 MDT] Weather for Denver : Partly cloudy Temps: 62.1 F 16.7 C

As mentioned at the top of this, 10,000 look-ups are provided a month. If more are needed for your channel, review their pricing:


Weather command request