How to automatically create transactions using Tasker, AutoWeb and YNAB.
This post should help get you started on creating transactions using Tasker on your Android phone.
I will do my best to help if you get stuck!
It is a long post because of the size of the screenshots (I couldn't figure out how to reduce the size of them in the post).
- Get your personal access token as described here - copy it as you will need it later! https://api.youneedabudget.com/#personal-access-tokens
- Go here https://joaoapps.com/autoweb/ to set up AutoWeb - follow the instructions.
- In AutoWeb click "Browse Web Services".
- Search by typing in YNAB.
- Long press on YNAB and click "Import API".
- Go back to AutoWeb home page, select "Your Web Services".
- Long press on "YNAB".
- Click on "Edit API Config".
- Scroll down to "Secret Key Specific".
- Delete whatever is in the "Secret Key" field and paste your personal access token from step 1 here.
- Tap OK - you are now ready to start adding automated transactions!
- Go to YNAB on your computer browser and visit the budget and account you are interested in.
- Now look at the URL:
- Copy and paste the numbers and letters between the first two forward slashes - this is the budget ID.
- Copy and paste the numbers and letters between the second two forward slashes - this is the account ID.
- In Tasker, create a new Task.
- Add a new action and select "Plugin", "AutoWeb" and then "Web Service".
- Click the pencil icon to configure the action.
- Click API, select YNAB.
- Click API action (will not be greyed out) and select "Create New Transaction".
- You will need to copy your account ID from step 21 and paste it into "Account ID".
- Scroll to the bottom and paste your budget ID from step 20 into "Budget ID".
- Set up some initial values for testing, such as Date, Amount, Payee Name etc.
- Next, click "Output" and select all.
- When finished, click the tick icon to save.
- You will see the action configuration - check to make sure it looks OK, then click back.
- Run the task with the "play" button.
- If all goes well, you will see a green dot and no error messages.
- Now check your budget in YNAB - the new transaction should be there.
- This should be enough to get you going - now you can personalise the "create transaction" action to how you want to use it. I'll be adding a trigger to this action to capture amount (make it negative for outgoing e.g. -1000), date and payee of my Google Pay notifications.
Thanks for this. I was able to get this working and get a transaction to enter into YNAB. I am new to tasker and the api and so I have a couple of questions that I am hoping that you can answer.
1. When performing the test there is a dummy payee and amount that is entered. Will that get automatically overridden when a transaction comes across, or does it need to get replaced with a variable so it pull the name and amount from Google Pay?
2. How exactly does one actually link the google pay app so that info is passed? I did create a profile using Google Pay/App services and pinted it to the task that I created. Is that correct?
I hope that you are able to answer these questions for me as I have been hoping to have Google pay auto enter transactions for me.
This is the second half of the post (sorry I couldn't edit the first post to include it there).
Now that your task can successfully add a dummy transaction, we need to use it to import actual transactions from Google Pay into YNAB. To do this you will need to install another Tasker plugin called AutoNotification. The plugin is safe, it os developed by the same guy who develops Tasker and AutoWeb.
Once you have that installed and activated, we can get started. Note that the way I run through this uses an existing notification from Google Pay, but that isn't necessary. It does make it a bit easier though.
- Go to the profiles and add a new profile - select "Event" as the trigger.
- Next, select plugin, AutoNotification and then "Intercept".
- Next, tap the pencil to edit the configuration.
- Tap "Fill From Current".
- Select the notification - the payee should be listed to help you identify it.
- Next select the options as shown. This gets the information from the Google Pay notification to pass into YNAB.
- Tap the check at the top of the screen to save the configuration. It should look like this:
- When you tap the back button, you will be prompted to link the profile to a task. Select the dummy transaction task you created previously.
- Now we need to do some manipulation of the data grabbed from the notification to parse it correctly. Namely the amount needs to be negative as it is a debit and multiplied by 1000 to match YNAB format (miss this out and you will be over-budgeted very quickly!) Also, the date from Tasker needs to be reversed to match YNAB formatting, so we use an array to do that.
- Here is the complete task:
- For action number 1, the splitter used is left blank. If you have any issues, try a space. Just press the spacebar once, don't use quotes.
- For action 2, use the symbol for your native currency i.e. USA = $.
- For action 3, ensure you check the box marked "Do Maths".
- For action 5, use a hyphen as the splitter.
- Your last action should be the one using AutoWeb, so you will nee d to make sure you rearrange the tasks to suit.
- In the last action using AutoWeb, you will need to make the following changes:
- Date: set to "%ynabdatearr" (no quotes).
- Amount: set to "%amount" (no quotes).
- Payee name: set to "%antitle" (no quotes)
- You can change the memo field to be blank, or leave as "from Tasker" as a reminder when you view in YNAB.
- I haven't experimented with the "Approved" field yet. I imagine setting that to "Approved" would make the transaction be approved in YNAB, but for the meantime I want it off so YNAB alerts me that there is something to check.
- Likewise, you could give the Tasker generated transaction a flag colour or mark it as cleared if you like.
Hey rownie23, thanks for this. I managed to make my way through this, got stuck on the fact that I needed to create a bunch of tasks in addition to the dummy task that was in step 1. but after a bit I got it figured.
When I try and run the task it gets stuck right at the start, and as I have never used Tasker and these addons before I feel a little helpless! Here is the error that I receive, so hopefully you are able to help. I have tried using a space in the splitter, but it doesn't seem to make a difference as it doesn't seem to save the space.
I am not sure if I need to do a payment in order to test it.
Hopefully I do not get stuck on each step!
mitelman I have found the problem, its a big oversight on my part. By using the exisiting notification to set up the entry profile trigger, I made it only trigger to a very specific condition. Using you r example above, the transaction would only be entered into YNAB autoamtiacally if the transaction was at "TIM HORTONS #4763" and was exactly $2.02 with your Visa card ending 4407.
Removing these from the trigger should get it to work properly.
Apologies for the confusion!
rownie23 I have wiped out and rebuild everything. I still end up with the same error that I had before where it is getting stuck on the first variable split. I do not think it is seeing the notification properly as I get the same error when I dismiss the google pay notification. I wonder if the notification displays differently for me? But perhaps not since the time that I sent a copy of my config, it showed everything correctly when filling in from an existing notification.
Oh my lord thanks for this.
For the last year or two I have had tasker opening up ynab and stepping through the new transaction entry after I swipe away a Google pay notification. Keen to set this up with the API now. So much smoother.
Just read over things quickly so may have missed it but you don't seem to do anything with the payee? Do you correct them in ynab later manually?
In addition to this, you can copy the add transaction step in the Tasker task and add "if" conditionals to them. This allows you to post transactions to multiple budgets, if that's what you need.
I have a personal budget and a joint budget. In Google Pay I select either card and pay - now the transactions get added to the respective budget. It is so satisfying!
The condition you want to check on is the last 4 card digits.
Hello, and thanks for excellent tutorials! Exactly what I've been trying to achieve!
I'm running in to problem, however, at point 16 in the second one, where the manipulation of the notification data is done. How do I get to the next screen, and where can I do these changes?
(I'm quite new to Tasker.. this might very well be painfully obvious to you, but I can't find it!)
I wanted to share my project template which can be used after step 17 of the original post above.
There are instructions included inside the task to walk you through the rest.
I have setup this template to provide a couple of additional benefits.
1. Most of the work is done for you, Just fill in some areas to personalise it.
2. It works with Google and Samsung Pay
3. It will work with all date formats.
4. It has some small test actions to check everything is working.
Massive thanks to rownie23