WisePy creates a webhook listener using Flask that listens for incoming connections from Wise (formally Transferwise).
When parameters (set in variables at the top of the script) are met, a transfer is initiated using the Wise API.
WisePy requires Python3 and the following modules:
- uuid
- requests
- threading
- flask
- gevent
*** I highly recommend testing this with the Wise sandbox first, to test all is good: https://sandbox.transferwise.tech/ ***
Step 1 - Creating an API token:
- Login to Wise, go to your profile, click 'Settings' then 'API Tokens'
- Click 'Add Token'
Step 2 - Create a target account:
- Login to Wise, and go to 'Recipients'
- Click 'Add Recipient'
- Add the target bank account and currency
Step 3 - Modify the wise.py script:
- Edit the 'wise_api_token' variable with the API token that you configured in step 1
- Edit the 'wise_source_currency' variable to the source currency you're being paid in
- Edit the 'wise_target_currency' variable to the target currency you wish to send your deposit to (created in step 2)
- Edit the 'wise_minimum_deposit' variable to the amount (in source currency) being paid that will trigger an automated transfer. Eg, you may wish to not automate a transfer
- Edit the 'wise_target_account_number' variable to the account number that was put into the target account in step 2
Step 4 - Front-Ending the webhook:
The Webhook listens for http POSTS on http://127.0.0.1:8888/balance-update
This webhook will need to be front-ended according to Wise's requirements for it to work.
For more information on Wise's requirements, please visit: https://docs.wise.com/api-docs/features/webhooks-notifications
Front ending could be achieved using a web server such as Apache or Nginx with an SSL certificate from Letsencrypt, or it could be frontended by a service such as Cloudflare.
Step 5 - Creating the Webhook:
- Login to Wise, go to your profile, click 'Settings' then 'Webhooks'
- Create a webhook and test
- If all good, then it should show tests as successful.
Step 6 - Daemonising the script:
You may wish to set this script up in systemd as a service. A sample wisepy.service file is included in this repository to get you started.