Skip to main content
Solved

Need help with using {Asset.x} variables with webhook during ticket creation rule

  • October 25, 2024
  • 6 replies
  • 226 views

Forum|alt.badge.img+2

Hello, I wanted to ask if it is possible to be able to use the {Asset.x} data point variables in webhooks to send to a google chat when a ticket is created, or is it only limited to {Ticket.x} variables?

This is the webhook code I am using:

{
  "cardsV2": [
    {
      "card": {
        "sections": [
          {
            "widgets": [
              {
                "decoratedText": {
                  "icon": {
                    "materialIcon": {
                      "name": "devices"
                    }
                  },
                  "topLabel": "Device Model:",
                  "text": "<b>{{Asset.ModelName}} || {{Asset.ManufacturerModelName}}</b>",
                  "wrapText": true
                }
              },
              {
                "decoratedText": {
                  "icon": {
                    "knownIcon": "DESCRIPTION"
                  },
                  "text": "<b>{Ticket.IssueCategoryName} > {Ticket.IssueTypeName}</b>"
                }
              },
              {
                "textParagraph": {
                  "text": "<i>\"{Ticket.IssueDescription}\"</i>",
                  "maxLines": 20
                }
              },
              {
                "divider": {}
              },
              {
                "decoratedText": {
                  "icon": {
                    "knownIcon": "TICKET"
                  },
                  "topLabel": "Ticket Number:",
                  "text": "<a href=\"https://x.incidentiq.com/agent/tickets/{Ticket.TicketId}\">{Ticket.TicketNumber}</a>",
                  "wrapText": true
                }
              },
              {
                "decoratedText": {
                  "icon": {
                    "knownIcon": "MAP_PIN"
                  },
                  "topLabel": "Location:",
                  "text": "{Ticket.LocationName}",
                  "wrapText": true
                }
              },
              {
                "decoratedText": {
                  "icon": {
                    "knownIcon": "PERSON"
                  },
                  "topLabel": "Submitted By:",
                  "text": "<a href=\"https://x.incidentiq.com/agent/users/{Ticket.OwnerId}\">{Ticket.OwnerFirstName} {Ticket.OwnerLastName}</a>",
                  "wrapText": true
                }
              },
              {
                "decoratedText": {
                  "icon": {
                    "knownIcon": "PERSON"
                  },
                  "topLabel": "Submitted For:",
                  "text": "<a href=\"https://x.incidentiq.com/agent/users/{Ticket.ForId}\">{Ticket.ForName}</a>",
                  "wrapText": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}

 

And this is the end result in the Google Chat space:

 

Any advice or insight would appreciated.

Best answer by jclark

You will be limited to Ticket variables since it is a ticketing webhook.

There is one variable, Ticket.Assets, which sends most of this through as one entire datapoint. You’d have to find a way to parse it between the webhook and Google Chat. 

Someone posted an idea a while back about drilling down these variables. It would be worth commenting/voting on it, if I can find it I’ll post it here in a comment.

6 replies

Forum|alt.badge.img+16
  • Specialist
  • Answer
  • October 28, 2024

You will be limited to Ticket variables since it is a ticketing webhook.

There is one variable, Ticket.Assets, which sends most of this through as one entire datapoint. You’d have to find a way to parse it between the webhook and Google Chat. 

Someone posted an idea a while back about drilling down these variables. It would be worth commenting/voting on it, if I can find it I’ll post it here in a comment.


Kathryn Carter
Forum|alt.badge.img+18
  • Community Manager
  • October 28, 2024

@dmanzyuk Thank you for submitting your question to our community! 😄

There are a few ideas that could work here. 

Not sure if these were one you were referring to @jclark 


Forum|alt.badge.img+16
  • Specialist
  • October 28, 2024

Those aren’t it, but they are good ideas!
I think what I’m remembering is a comment on an idea, where someone wanted exactly this - to be able to parse certain fields down another level. The data is there, but another level or two of dot-notation would go a long way.


Forum|alt.badge.img+2
  • Author
  • Observer
  • October 28, 2024

Those aren’t it, but they are good ideas!
I think what I’m remembering is a comment on an idea, where someone wanted exactly this - to be able to parse certain fields down another level. The data is there, but another level or two of dot-notation would go a long way.

I believe I found the idea you were referring to. It was something i upvoted and looked through before I posted this. 

 

That would be great as well, but I was hoping to even be able to use Asset variables that are there already. I assumed that this would work initially because I was able to send the data point variable that I wanted (“ {Asset.ModelName} “) through an email alert on the same exact ticketing rule. So theoretically the rule should have access to that information and be able to send it with a webhook.


I was hoping that maybe I was missing some syntax or something along those lines, but that doesn’t seem to be the case.


Forum|alt.badge.img+16
  • Specialist
  • October 28, 2024

@dmanzyuk That’s what I was referencing in my original comment. {Ticket.Asset} is a variable, but it contains an additional level of data, so the model is included with that variable along with a bunch of other info that isn’t parsed out. If it went down another level in dot-notation, you could potentially do {Ticket.Asset.ModelName} and get what you need.

Here is what I get for the {Ticket.Asset} variable, as an example:

[{
\"TicketAssetId\":\"\",
\"AssetId\":\"\",
\"CreatedDate\":\"2024-10-28T10:44:28.510\",
\"AssetTag\":\"123456\",
\"SerialNumber\":\"53R14LNUM83R\",
\"AssetTypeId\":\"\",
\"CategoryId\":\"\",
\"ModelId\":\"\",
\"ModelName\":\"Chromebook 14\",
\"AssetStatusTypeId\":\"\",
}]

 


Forum|alt.badge.img+16
  • Specialist
  • October 28, 2024

Also, you’re right. That is the one I was referencing!