Track time you spent on your projects using your #Voice
Tags: voice, showdev, actionsongoogle, dialogflow
Published: 2020-06-27 17:19:43

###Why?
If you are a freelance developer, you probably have to track your time for the projects you do - or perhaps you just want to know, how long did you work on your side project, that you never finished. But keeping some app open all the time and keeping the entries in sync is a bit of a hassle and distracting. I was facing the same problem, so I decided to solve it with my favorite interface - Voice! 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f3dlj8luvb5z7izl4mz0.jpg)

###Solution
I have created Action for Google Assistant called Tracker for Toggl. Why Toggl? Because while voice is great, voice app itself is not enough for timetracking, you probably want web access, fancy reports and mobile app too. Toggl is a time-tracking app, which is available for free, so I picked it as a "backend" for the Action. 

How does it work? Google Assistant offers [Actions on Google](https://developers.google.com/assistant) platform, which you can use to build your own conversational experiences, where you take full control over what the user says and how you respond. 
That means you have to understand, what the user says. I use Dialogflow to do the NLU and Firebase Cloud Functions for fulfillment and web hosting.

###Showcase

There are several ways, how you can try the Action out! If you have a Google Assistant enabled device - like Google Nest Mini or Home Hub, you can say "Hey Google, talk to Tracker for Toggl", which will get you talking with the Action! Or if you are on the computer, use the [Assistant Directory](https://assistant.google.com/services/a/uid/000000a477904132) (Google Play version for voice apps) to send it easily to your phone or smart speaker. 

At the launch, you are welcomed with initial introductions and an opportunity to sign in with your Toggl API Token, which is used for communication between Action and Toggl. 

![Welcome message](https://dev-to-uploads.s3.amazonaws.com/i/eaqnnei2ilqsp3ag9ggt.png)

Now, if you are using a smart speaker or display, you will be redirected using notification to perform the sign in using web popup. You enter the token, it will verify that it is actually token for your account and hurray, back to the Action! Don't worry, you have to sign in only once.

![Login page](https://dev-to-uploads.s3.amazonaws.com/i/mst6bw2qd4bjhrj6qmwn.jpg)

Now you can access all features that the Action has to offer + your previous entries, projects, and workspaces are also available!

The simplest thing you can do is to start tracking, lets try it out by saying "Start tracking Writing an article for project Toggl Action".

Several things have to happen here. First, the NLU has to recognize the intent itself - to start new time tracking. After that, there are 2 Slots to extract. First is the name of the task "Writing an article" and second is "Toggl Action", which will get matched to users projects.

![Success!](https://dev-to-uploads.s3.amazonaws.com/i/c8vkihrut5rntev70xca.png)

Now that tracking is running, we can confirm in Toggl web app that it's working! So you can combine webapp and the Action, whenever you need it.

![Sync with Toggl](https://dev-to-uploads.s3.amazonaws.com/i/1fk5pwr16mm21tw3j9t1.jpg)

And we can easily stop it, by saying "Hey Google, ask Tracker for Toggl to stop tracking" anytime. 

You can also get reports, so for example, if you want to know how long did you work today, you can just ask.

![Report today](https://dev-to-uploads.s3.amazonaws.com/i/bcpbbh437uektodu8pse.png)

Of course, you can choose different time intervals or even filter by specific projects. Let's follow up by saying "And past month?".

![Month report](https://dev-to-uploads.s3.amazonaws.com/i/6iunb20uno5hsff1gtve.png)

Here we have a wider variety of tasks, so we get a nice sum up. You can filter this more with projects and workspaces. 

Few other things you can do:
* Hey Google, ask Tracker for Toggl to start tracking Testing (go right to the task)
* Continue last tracking 
* Get name and project for current tracking
* Set description/project/tags after the tracking has started
* Get help any time, to get you back on track
* and some easter eggs.. :)

You can check out the full feature list at the [Tracker for Toggl web](https://tracker.valasek.dev/)!

The project is still in the early phase and I would appreciate any feedback, thanks for reading!