Guild Wars 2 SMS Bot [Entry]

itsasine

ItsASine (Kayla)

Posted on April 24, 2020

Guild Wars 2 SMS Bot [Entry]

What I built

Using Twilio’s Autopilot API, I made an SMS bot that integrates with the Guild Wars 2 API. Right now, the app leverages the GW2 API for checking the conversion rates for in-game currency conversion. Now that a proof of concept is up, though, it can be extended to do whatever the Guild Wars 2 API can do. I opted to have one reliable feature to demonstrate rather than have it do a bunch of things half well.

Demo Link

As it’s an SMS Bot, you can get to it by texting (724) 257-4486. The Flask app is hosted on free Heroku, so it may take a while to “wake up” at first, so here are some images:

Greetings
Gold to Gems
Gems to Gold

Link to Code

GitHub logo ItsASine / GW2-SMS-Bot

Twilio Hackathon project for an SMS chatbot that does Guild Wars 2 currency exchange math

GW2-SMS-Bot

How It Works

This chatbot uses Python and Flask to connect the Twilio API with the Guild Wars 2 API. It's hosted on Heroku, and you can talk to it via SMS texting.

Features

  • In Twilio
    • Greets the user and listens for additional commands
    • If the user requests help, lists the currently implemented commands
    • If the user says goodbye, sends the user a farewell message
    • Listens for if the user wants to supply an api key
  • In Python
    • Asks for an amount and type of currency and returns the amount in another currency (gold to gems, gems to gold)
    • Accepts the API key and stores it for usage elsewhere (currently there's no integration with the Account api, so it is unused)

How To Use It

  • Text (724) 257-4486 😄

Demo

Greeting

Converting gold Converting gems

How To Make It

Requirements

  • Python3
    • Package requirements can be installed with python -m pip install -r requirements.txt
  • A…






https://github.com/ItsASine/GW2-SMS-Bot

How I built it

Technologies involved are:

  • Twilio Autopilot API for handling the chatting over SMS
  • Flask (Python) for the middle code between Twilio and Guild Wars 2
  • Heroku to host the Flask code
  • The Guild Wars 2 API to get in-game info

Out of that, the only thing I’ve worked with before was the Guild Wars 2 API, mainly to get stuff like guild messages to display. It was new doing anything interactive, using Heroku over Netlify, and working with Python outside of schoolwork.

Cool stuff:

  • Twilio’s documentation is fantastic. The quickstarts were straightforward to go off of, and the blog had a bunch of examples to get ideas and approaches.
  • Flask made spinning up a proof of concept efficient. The guts of the app didn’t take long at all to get into the right place.

Annoying stuff:

  • I don’t know if Twilio’s documentation had me spoiled, or I was too used to no-fuss apps, but trying to get an API hosted on Heroku was a pain. Their documentation was very detailed in some spots and then “Do the thing” in other spots. I feel like I spent this month mostly fighting the deployment rather than developing.
  • I have no clue how the GW2 API works, haha. I noticed that when doing the currency conversions between in-game gold and premium gems, my app has one rate, another app that I know hits that API has another rate, and the game itself has an even more different rate. Hopefully, this is just caching (and I would assume GW2 is as close to realtime as it gets, while a large site like GW2 Efficiency might do their own caching)

Additional Resources/Info

If you play Guild Wars 2 and want to request a feature, here are the APIs available:

https://wiki.guildwars2.com/wiki/API:Main#Version_2_endpoints
https://wiki.guildwars2.com/wiki/API:2#Active_endpoints

Here are screenshots of the configuration in Twilio if you want to see behind the curtain a bit!

Bot tasks

Custom field type

💖 💪 🙅 🚩
itsasine
ItsASine (Kayla)

Posted on April 24, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related