Using Google Assistant & Zapier to automate your buy & sell orders

blog photo
Julian GabensteinMay 19, 2022

Buying shares can require a high number of different manual steps. For example, if you are using a trading app, you need to open your app, search for a specific stock you are interested in buying, specify the amount and click on the buy button. While this is definitely an improvement compared to what was available 10 years ago, we believe that there is an even simpler way. Wouldn’t it be amazing if you could buy shares by speaking to your phone and giving a specific 5 word instruction? We think so. Luckily, this can easily be implemented by using a Virtual Assistant. Therefore, in this blog post we’ll show you how to use Google Assistant & Zapier and connect the two to the Trading API.

Title Card for "Using Google Assistant & Zapier to automate your buy & sell orders"

What is a Virtual Assistant?

Virtual Assistants (VAs) are true to their name: think of them as your smart artificial assistant at home that can address many of your requests and needs. After speaking to the device with your voice (the input), the VA reacts, calls a service, then works with the command you provided and shares a response (the output). A specific example can be that you use your VA to play the music you enjoy. In a first step, you give a specific command, e.g. “Play the playlist ‘Top 100 Germany’”. Next, the VA searches for the playlist by going through the connected service (e.g. Echo would likely search for the playlist in Amazon Music, Google Home would search in YouTube Music…) available that offers this kind of playlist. When a suitable playlist is identified, the VA shares a response like “I found a playlist that could fit your search” and starts playing the music. 

This is basically how a VA works with your commands. According to statistics, the number of people that use a VA in the US was set to reach 66.4 million by 2019, which is around 26.2% of US adults. Currently, Amazon’s Echo is the most popular smart speaker service in the US, with 46.5 million people having it installed in their home, but Google (Home) is catching up and is expected to lead with 48.1% sales shares in 2025 (see more statistics herehere or here).

There is an almost infinite number of possible use cases. You can connect them to your calendar to create and be reminded of events and appointments or you can even book short stays for your vacation. 

And we came up with an additional use case for you: how about connecting your VA to a trading API to to build your own voice-controlled (trading) project. Sounds good? Alright, then let’s take a closer look at how to bring this idea to life. 

How can we combine Virtual Assistants with APIs?

The API allows developers to create their own brokerage experience at the stock market and therefore, allows developers to build many different customized use cases. You can transfer a usually manual process into a more convenient one: speaking. This can eventually be a great time saver. Another advantage could be customizing your service and integrating brokerage contextually into your everyday life (create a service in a context that you are using already anyway). 

Now that we’ve established the ground rules, let’s focus on bringing this idea to life. To integrate your VA with the trading API, we suggest to use Zapier. Zapier is a great tool which you can use to automate your workflow across more than 4000 apps & services — you can connect each of them to creating your own automated task. Using so-called “Zaps”, you can define an automated workflow between services, whereby the “Zaps” are specific steps within the flow. “Zaps” make your life easier — one “Zap” can take over tasks that you would normally do manually. Of course, that saves time. Let’s now dive deeper into the Zapier implementation to connect your VA (Google Assistant) to the trading API with a step-by-step guide.

Setting up Zapier for your Google Assistant 

Before we start, we need to get access to the 3 mentioned tools: Zapier, Google Assistant and the Trading API. Sign up on Zapier to create the “Zaps” (skills) for your Google Assistant. If you want to use Google Assistant you’ll need (to create) a Google Account to make the “Zap” happen. Also, don’t forget to log in for to receive market data and to set orders. 

Creating a Zapier account

Go to the Zapier home page and sign up. I would recommend to directly connect your Zapier account with your Google Account, as this makes it easier to connect to your Google Assistant Service.When your account is created, you can log in. After that, go to the Zaps page. It should look something like this: 

Zapier dashboard
How to integrate with Google Assistant

To link the Google Assistant Service with the API, we need to create a “Zap”. Do that by clicking the orange button on the left side of the Dashboard. 

creating zaps on Zapier

Add the triggers (a trigger sets a service that starts your “Zap”) for your “Zap”. First, you need to select Google Assistantfor your first trigger to start the workflow and then choose Webhooks for the Action that should happen (make an order). Webhooks can be used to automate your messages sent from apps when a trigger is activated. Using Webhooks in Zapier can save time because you can specify API calls directly in the provided UI. In general, Webhooks can help you a lot in correctly setting up the API request, even if you are still a beginner. 

setting up a trigger which starts your zap

For Google Assistant, choose New Pushed Voice Message as a trigger event. You can understand trigger events as tasks that the Google Assistant can or will perform. The New Pushed Voice Message event allows you to add customized phrases that the Assistant will recognize and subsequently execute the related action. 

choosing Google Assistant as trigger for Zapier

Add a phrase you want the user to say to activate the trigger. A specific phrase is necessary, so the Google Assistant can react to your input. We recommend you to write multiple trigger phrases which makes the request more flexible when talking with your speaker later.  

setting up trigger for google assistant service on zapier

Press “Continue”. If everything went well, you will receive a confirmation of your assistant trigger, which will look similar to the one below. We can now use this for the second part of the Zapier implementation: integrating the API. 

response after pushing voice message for google assistant on zapier
How to integrate the API

To combine Google Assistant and the API, we use Webhooks. With that service, you can call an URL of an external API to later receive a message or payload from it. As we want to place an order, we need to select POST here (see the docs for more information on the POST /orders request). The cool thing here is that this is just a minimum use case that can be customised and extended by your desires. You can be add more potential request/endpoint calls or services. We’re presenting only the basics of the use case here. 

choosing web hooks for action in Zapier

Fill in the Set up action with the relevant data. In the URL field, fill in the trading url. In our example, we use the paper money environment, find more information here. Select JSON as Payload Type. Under data, you can specify the request body. Fill in the required data for your trade by specifying what exactly you want to trade. Using the International Securities Identification number (ISIN) you can uniquely identify a specific security. We are going for Tesla in our example. Next, set an expiration date for your order (the date cannot be longer than 30 days into the future). Specify either “buy” or “sell” for the side parameter. For quantity, specify the number of shares you’d like to buy or sell. For venue, define the stock exchange you want to trade at. is currently connected to the Munich Stock Exchange, so we are setting XMUN here.

adding data for the request body

As requests with the API require authentication, add Authorization under Header & fill in “Bearer YOUR-API-KEY” right next to it (you can find or create your API KEY (a specific individual value) on the dashboard. Copy one of your API keys and paste them behind “Bearer” in your API request).

adding authorization + api key for headers

Click on “Continue” & test the Action. If everything worked, you should see a similar response as the one in the screenshot below. The response parameter mode shows the environment you traded in and status shows “ok” if your request was successful. An important response parameter is the order ID, which you can find under results — you’ll need the ID to activate your order. As part of the results, you can also see the order “status”. As the status is “inactive”, we need to move on to the next part: order activation! We will do that in a second. 

result of web hooks after api request

But before that, since everything is tested and seems to work as we intended, we now want to set our “Zap” live, so we can actually use it in the Google Assistant app. To do that, press the “Publish Zap” button at the bottom of the page. You can also do it on the Zaps menu list after saving your created “Zap” (simply switch the off button to on, your “Zap” will be activated then). 

turning a zap on

Great, we are now done with setting everything up on Zapier. Let’s move on to the next step: testing! 

Execute your order with your phone 

We are now moving over to our phone to see our “Zap” in action. This is the exciting part of use cases where you can try out the functionalities of them in practice. 

Now, open the Google Assistant app. 

Say “Talk to Zapier” to the Assistant. This is a trigger sentence that sets up the connection to the Zapier services.

connecting with zapier via google assistant app

When Google Assistant is connected with Zapier, you can now say the phrase that we defined earlier to buy five shares of Tesla.

sharing the phrase "buy five shares of Tesla" with Zapier

After a few moments, your order should be placed. The confirmation of that looks like this:

triggered zap

If you’d like to have a confirmation that makes it clearer which Zap you’ve called, choose something like “Execute Order with” as a name for your Zap and this will be displayed on your Google Assistant. 

How to activate the order

After Google Assistant placed your order, you need to activate it such that it gets routed to the stock exchange and executed. This Two-Factor Authentication provides an additional level of security for you to always have full control over your placed orders. There are two ways to manually activate an order: 1) by using the mobile app or 2) on the Dashboard

We are going for option 2 in this example. Open the Dashboard and scroll down to the orders table, identify the order you are interested in and press the Activate button in the Actions column. 

orders from the dashboard

After this step, you should now see the status “Activated”. That’s the green light for you! The order is now routed to the stock exchange, ready for execution. When the order status changes to “executed” this means that your order is (well 🤷‍♂️) executed, which means that your trade is finalized. Congratulations. 

Rounding things up

While it is not necessary to write custom code to set up a Zapier connection, it can be useful if you want to add more functionality to your “Zaps”. In this tutorial, we presented a very basic example for how to connect VA to a trading API. Of course, there are many more customization possibilities that would make the project even better. For example, you could include more advanced code snippets to create and even activate the order directly in your “Zap” (e.g., through the “Code by Zapier” service). Also, you could try out making the service more flexible so that you can buy multiple shares and quantities rather than hard coding these parameters. With that in mind, maybe you could dive deeper into algotrading and its techniques which allows you to automate your trading activities in real time. 

If you are interested in finding some inspiration for adding code into your Zap, check out my GitHub repo where I provide a specific Python code example. The code simply allows you to call the order request and to activate your order right after the request by taking out the order ID of your ordered stock.

I hope you enjoyed this use case. The goal was to present one of many examples for contextual brokerage that you can customize based on your individual preferences. I hope you enjoyed reading this article and got inspired to build your own “Zap”. 

Don’t forget to sign up to to start building your own trading project. If you have any questions, make sure to contact us via or join our Slack community.

We are looking forward to your project with lemon markets :) 

🍋 Julian

You might also be interested in

blog photo

4 reasons why YOU should automate your trading strategy

In the current volatile market conditions, everyone is trying to find ways to minimise portfolio loss. In that context, have you ever thought about automating your trading strategy? In this article, we will dive into 4 reasons for doing so. Expect to learn how it can save you time, make your trading more efficient and lead to data-based decisions.

blog photo

Profiting in Bear Markets with 5 Useful Algorithmic Trading Strategies

You may have heard the term “bear market” being thrown around a lot recently on the news and online. Perhaps you have looked at your favourite stock picks and only see red. In this article, we explain what bear markets are and algorithmic strategies that can be advantageous during a bear market.

blog photo

Using Google Assistant & Zapier to automate your buy & sell orders

In this blog post we’ll show you how to use Google Assistant & Zapier and connect the two to the Trading API.

Dive Deeper

Find more resources to get started easily

Check out our documentation to find out more about our API structure, different endpoints and specific use cases.


Join community

Join our Slack channel to actively participate in our community, ask questions to other users and stay up to date at all times.


Interested in building with us?

We are always looking for great additions to our team that help us build a brokerage infrastructure for the 21st century.

Need any help?
Ask a question in our CommunityAsk a question in our CommunityGet started with our DocumentationGet started with our DocumentationGet inspired on our BlogGet inspired on our Blog
© 2022Privacy PolicyImprint
Systems are down

As a tied agent under § 3 Sec. 2 WplG on the account and under the liability of DonauCapital Wertpapier GmbH, Passauer Str. 5, 94161 Ruderting (short: DonauCapital), GmbH offers you the receipt and transmission of orders for clients (§ 2 Sec. 2 Nr. 3 WpIG) of financial instruments according to § 3 Sec. 5 WpIG as well as brokerage of accounts.