Use Zendesk Action Builder to send approval notifications from SweetHawk’s Approve app to Microsoft Teams. Each approver receives a direct message containing a link to their approval request, making it easy to open and respond from wherever they use Teams.
Steps covered in this article:
Before you begin
Make sure the SweetHawk connector is connected to Zendesk Action Builder by following this guide:
Connect SweetHawk to Zendesk Action Builder
You’ll also need to connect Microsoft Teams. Follow the Microsoft Teams section of Zendesk’s guide:
Connecting external systems to action builder for use in action flows
Note: Teams messages are sent from the Microsoft account that authorizes the connection. We recommend using a generic admin or service account with an appropriate display name.
Make sure the approver email addresses match their Microsoft Teams accounts.
Your completed action flow will look like this:
Add a tag from Approve
We recommend using a ticket tag to connect your Approve workflow to the action flow.
In the Approve app, edit the approval definition you want to send Teams notifications for.
- Under the approval definition’s events, select New approval step, then Zendesk Ticket updates.
- Add an action to add a ticket tag.
- Enter
send_approval_to_teamsas the tag. - Save the approval definition.
When an approval starts, Approve adds this tag to the ticket. It also adds the tag again whenever there is an escalation, reminder, or new approval step.
This keeps notifications aligned with the approval process. For example, when an approval moves to a second step with different approvers, the next Teams messages go to those approvers.
Set up the Action Flow
1. Create the Action Flow trigger
Configure the action flow to run when Approve adds the send_approval_to_teams tag.
If you’re new to Zendesk Action Builder, review Zendesk’s guide to creating action flows.
- Create a new action flow.
- Add a trigger card.
- Under Zendesk, select Tickets.
- Select Routing.
- Select Ticket tags changed.
- Click Add condition.
- Configure the condition as follows:
-
Variable:
Tags (added) -
Operator:
Contains at least 1 of -
Value: Enter the tag from the above step,
send_approval_to_teams.
-
Variable:
2. Remove the trigger tag
Immediately after the trigger, add a step to remove send_approval_to_teams from the ticket.
- Click the + beneath the trigger card.
- Under Zendesk actions, select Remove tags from ticket.
- Set the ticket ID using Ticket ID from the trigger card.
- Enter
send_approval_to_teamsas the tag to remove.
Removing the tag at the start allows Approve to add it again for the next reminder, escalation, or approval step.
3. Look up the approvers
Add a SweetHawk action to retrieve the approvers and their approval links.
- Click the + beneath Remove tags from ticket.
- Under External actions, select SweetHawk.
- Select Look up Approvers.
Under Approval definition, select the definition you want this flow to send Teams notifications for.
- Under Zendesk ticket ID, select Ticket ID from the trigger card.
The returned approver list supplies the recipient email address and approval URL used in the Teams message.
4. Repeat for each approver
Add a repeat step so each approver receives their own message.
- Click the + beneath Look up Approvers.
- Under Flow control and utilities, select Repeat for each list item.
Under List, select Look up Approvers (card 3), then select approvers.
This repeat step runs the Teams action below once for each approver, sending each person a message with their own approval link.
5. Send the Teams message
This example uses Post direct message to notify each approver individually. If you prefer to send notifications to a Teams channel, select Post message to channel instead.
- Inside the repeat block, click +.
- Under External actions, select Microsoft Teams.
- Select Post direct message.
- Under Email, use Add variable to select
emailfrom the repeat step (card 4). - Under Message, enter your approval notification (see below).
- Under Additional fields, add Message type and select HTML.
You can customise the message to suit your workflow. Include the url variable from the repeat step (card 4) so each approver can open their approval request. Here are two examples:
Create a simple approval message
Enter the following in Message, replacing the placeholders with variables using Add variable:
👍 <b>Approval requested</b><br> <b>Ticket:</b> #TICKET_ID<br><br> <a href="APPROVAL_URL"><b>Open approval request</b></a>
| Placeholder | Variable to insert |
|---|---|
TICKET_ID |
Ticket ID from Ticket tags changed (card 1) |
APPROVAL_URL |
url from the current item in Repeat for each (card 4) |
Note: To include additional ticket details, such as the subject or other ticket field values, add a Look up ticket card before the repeat step, using Ticket ID from the trigger. You can then insert the fields returned by that card into your Teams message using Add variable.
Include more detail in your message
You can also include the approval message and a link to the ticket, giving approvers more context directly in Teams. To include the approval message, insert the approval_message variable from the Look up Approvers card.
👍 <b>Approval requested</b><br> <b>Ticket:</b> <a href="https://YOUR_SUBDOMAIN.zendesk.com/agent/tickets/TICKET_ID">#TICKET_ID</a><br><br> <b>Message:</b><br> APPROVAL_MESSAGE<br><br> <a href="APPROVAL_URL"><b>Open approval request</b></a>
Replace YOUR_SUBDOMAIN with your Zendesk subdomain, then use Add variable to replace the placeholders:
| Placeholder | Variable to insert |
|---|---|
TICKET_ID — in both places |
Ticket ID from Ticket tags changed (card 1) |
APPROVAL_MESSAGE |
approval_message from Look up Approvers (card 3) |
APPROVAL_URL |
url from the current item in Repeat for each (card 4) |
Review and test the flow
Save the flow and test it using the ID of a ticket with an approval already in progress.
Once you’re happy with the results, activate the flow.