Skip to main content

Send Deskpro ticket updates to Microsoft Teams using Workflows - Knowledgebase / Using Deskpro - Deskpro Support

Send Deskpro ticket updates to Microsoft Teams using Workflows

Authors list
  • Kim

You can use a Deskpro webhook to send ticket notifications directly to a Microsoft Teams channel. This can be used to notify a Teams channel when a new ticket is created or when an existing ticket is updated.

Create the webhook in Microsoft Teams

  1. In Microsoft Teams, go to the channel where you want to receive the Deskpro notifications.

  2. Select the ... next to the channel and select Workflows.


  3. Find the Send webhook alerts to a channel template.

  4. Select the Team and Channel where the notifications should be sent.

  5. Create the workflow.

  6. Microsoft Teams will provide a webhook URL. Copy this URL as you will need to add it to Deskpro.

Create the trigger in Deskpro

You can use a New Ticket trigger for notifications about newly created tickets, or a Ticket Update trigger for notifications when existing tickets are updated.

Go to:

Admin > Business Rules > Triggers

Create or edit the trigger you want to use and add a webhook action.

Configure the webhook with the following settings:

  • Method: POST

  • URL: Enter the Microsoft Teams webhook URL

  • Header: Content-Type: application/json

  • Payload type: json

  • Timeout: 20 seconds

  • Only custom payload: Enabled

Add the webhook payload

Add the following as the custom payload:

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.4",
        "body": [
          {
            "type": "TextBlock",
            "text": "Deskpro ticket #{{ ticket.id }}",
            "weight": "Bolder",
            "size": "Medium"
          },
          {
            "type": "TextBlock",
            "text": {{ ("Subject: " ~ ticket.subject)|json_encode|raw }},
            "wrap": true
          },
          {
            "type": "TextBlock",
            "text": {{ ("Status: " ~ ticket.status)|json_encode|raw }},
            "wrap": true
          },
          {
            "type": "TextBlock",
            "text": {{ ("Ticket field: " ~ ticket.field8)|json_encode|raw }},
            "wrap": true
          },
          {
            "type": "TextBlock",
            "text": {{ ticket_object.getFirstMessage().getMessageText()|json_encode|raw }},
            "wrap": true
          }
        ]
      }
    }
  ]
}

When the trigger runs, Deskpro will send the payload to the Microsoft Teams workflow and the ticket information will appear as an Adaptive Card in the selected Teams channel.

Customise the notification

The example payload includes:

  • Ticket ID

  • Ticket subject

  • Ticket status

  • A custom ticket field

  • First ticket message

You can change the payload depending on the information you want to send to Teams. Deskpro Twig variables can be used to include information from the ticket.

For example, ticket.field8 in the example above refers to a specific custom ticket field. You should replace this with the appropriate field for your Deskpro instance or remove that section if it is not required.

Send different types of ticket notifications

Triggers determine when Deskpro sends the notification.

For example, you can create:

  • A New Ticket trigger to notify Teams when a ticket is created.

  • A Ticket Update trigger to notify Teams when a ticket is updated.

  • A New Reply Trigger to notify Teams when a ticket receives a new reply.

Each trigger can use the same Microsoft Teams webhook URL if the notifications should all be sent to the same channel.

Helpful Unhelpful