Use Case : WoW Tweet Bot

We will now see a second example of using the apis blizzard with  game scan modules. Our example is an application that automatically tweet your activity streams in game . We will initially see how to use it and see the inner workings that will lead you in application development using our modules

 

Pre-requisite

To use this application we need to have access at each api. So we will start with World Of Warcraft api

Go on Dev BattleNet, sign in if needed then add an application to get your api key. In the select box choose World Of Warcraft or Multiple according the use of blizzard games api you need.

 

Now we have to create a twitter app – for tweet on your account – you could create it on  Twitter application . Be careful to get read and write permission to the app then get the following keys :

  • API Key
  • API Secret
  • Access Token
  • Access Token Secret

 

Now we have all the key to begin the use off our application.

 

Install

 

You could gather the app on github repository  Game-scan/demo-wow-tweetBot  by using the git command line or downloading the zip archive from the website.

 

Do a  composer install for install all application required dependancies. Then create the .env  file at the same level than  .env.example file – please use the same variable in the new file. Indeed the have just to replace key with these of the previous step.

 

Use

 

For using the bot, the easier method is to call the index.php script (on src folder) at regular time – use cron task for this. And it’s all.

We have to notice that application must be able to create new file insides the application folder for work.

 

Working

 

Each cheak gather the new activity feed the the selected character then keep the recent – comparing timestamps with the  timestamp of the last tweeted activity (store on a file) .  For each activity we made a message – with additionnal information if needed and all message are tweet using another php librairie.

 

It’s all for this example of using game scan module, there are a lot of application to create like acl base on guild rank, statictics etc. Post a comment about what application you will be create with our modules. Same thing if you would have more information on this application

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *