How can I create a "Call for help" with an alert on Insight?

Is there a sample on how to create a "Call for Help" (or issue) by an Alert on AVEVA Insight.

Parents
  • Jakob,

    As a reference point would advise a peek into the following document that highlights a brief overview of making use of "Defining a custom actions using an Azure Logic App". As part of the requirements you will need a subscription to Azure and capabilities to utilize the Logic App service but  we will detail some of the actions to create some integrations. (specifically referencing Teamwork as indicated in your screenshot above)

    Define a custom action using an Azure Logic App (readme)

    https://docs.aveva.com/bundle/insight/page/922343.html

    Once the prerequisites have been met and you have access to Azure and Logic App portal - navigate to the Azure portal to the "Logics App" landing page. Hint: you can enter in "Logic Apps" into the search above to redirect you to the proper service. 

    You will be directed to the Logic App overview in which users can configure their own customized App, users will then be required to enter in pertinent information about their setup, such as the subscription and resource group assignment and instance details (name, select "workflow as default" and region to publish) as well as commercial plan type (standard or consumption rates). Once these have been completed you can start to develop a workflow..

    You will now be able to start designing your logic app, users can navigate to the "Logic App Designer" which will redirect them to a blank canvas where we will start to build the integrations.

    Typically you'll be presented with a screen similar to below where you will need to specify a "trigger" in our situation we would like to receive a HTTP Request from Insight for the custom alert. In order for this to properly work we will need to create a "Request Body JSON Schema". Luckily we have a sample schema we can use by downloading the following .zip or can paste the following  simplified schema into the HTTP request.

    Download Insight-Logic JSON Samples (files)

    https://docs-be.aveva.com/bundle/insight/page/Insight-Logic-JSON-Samples.zip

    {
        "properties": {
            "actionCondition": {
                "type": "string"
            },
            "alertDescription": {
                "type": "string"
            },
            "alertName": {
                "type": "string"
            },
            "alertOwner": {
                "type": "string"
            },
            "alertTriggerTime": {
                "type": "string"
            },
            "asset": {
                "type": "string"
            },
            "behaviorId": {
                "type": "string"
            },
            "consequenceOfFailure": {
                "items": {
                    "properties": {
                        "Applicable": {
                            "type": "string"
                        },
                        "FailureType": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "FailureType",
                        "Applicable"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "executionTime": {
                "type": "string"
            },
            "insighturl": {
                "type": "string"
            },
            "optionalparameter": {
                "properties": {
                    "Test": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "prescriptiveActions": {
                "items": {
                    "properties": {
                        "PrescriptiveAction": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "PrescriptiveAction"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "tags": {
                "items": {
                    "properties": {
                        "Data": {
                            "items": {
                                "properties": {
                                    "DateTime": {
                                        "type": "string"
                                    },
                                    "Text": {
                                        "type": "string"
                                    },
                                    "Value": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "Value",
                                    "Text",
                                    "DateTime"
                                ],
                                "type": "object"
                            },
                            "type": "array"
                        },
                        "Expression": {
                            "type": "string"
                        },
                        "Fqn": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "Fqn",
                        "Data",
                        "Expression"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "tenantId": {
                "type": "string"
            },
            "tenantName": {
                "type": "string"
            }
        },
        "type": "object"
    }

    Select "Add Trigger" and look for HTTP Request

    Paste the mentioned schema above into the parameter window "Request Body JSON Schema", once it's saved it will generate a HTTP URL that will be used in the Logic App URL in the custom alerts within Insight.

    Next couple of configurations are quite straight-forward, there should be a plus sign available (underneath the HTTP Request trigger) to add an additional step, in which we need to add a declared variable. (in this case it will be the token/key used to authenticate and POST messages to Teamwork). You will need to login to your teamwork administration console and create a new key.

    Create the API Key within Teamwork used for the Logic App "Variable"

    Final step is to create another step in which we will do a HTTP POST to Teamwork, you can find literature on the help guide to understand the format needed to create the proper messaging or use the following. You can also see some of the API documentation needed to successfully POST a message to Teamwork.

    Teamwork API Documentation (readme)

    https://api-docs.poka.io/docs/general-information

    {
      "type": "Http",
      "inputs": {
        "uri": "<enter your teamwork instance information>",
        "method": "POST",
        "headers": {
          "Authorization": "@variables('API_Key')"
        },
        "body": {
          "allow_comments": true,
          "content": {
            "en": "Alert Notification has been sent from Insight to Teamwork, alertName='@{triggerBody()?['alertName']}', alertDesc='@{triggerBody()?['alertDescription']}', alertTime='@{triggerBody()?['alertTriggerTime']}', CreatedBy='@{triggerBody()?['alertOwner']}'"
          },
          "news_type": 11
        }
      },
      "runAfter": {
        "Initialize_variable": [
          "Succeeded"
        ]
      }
    }

    Once this is completed you can go into the Insight portal and create a custom alert, from the HTTP Request "step" in which you can use the URL created to insert into the custom alerts.

Reply
  • Jakob,

    As a reference point would advise a peek into the following document that highlights a brief overview of making use of "Defining a custom actions using an Azure Logic App". As part of the requirements you will need a subscription to Azure and capabilities to utilize the Logic App service but  we will detail some of the actions to create some integrations. (specifically referencing Teamwork as indicated in your screenshot above)

    Define a custom action using an Azure Logic App (readme)

    https://docs.aveva.com/bundle/insight/page/922343.html

    Once the prerequisites have been met and you have access to Azure and Logic App portal - navigate to the Azure portal to the "Logics App" landing page. Hint: you can enter in "Logic Apps" into the search above to redirect you to the proper service. 

    You will be directed to the Logic App overview in which users can configure their own customized App, users will then be required to enter in pertinent information about their setup, such as the subscription and resource group assignment and instance details (name, select "workflow as default" and region to publish) as well as commercial plan type (standard or consumption rates). Once these have been completed you can start to develop a workflow..

    You will now be able to start designing your logic app, users can navigate to the "Logic App Designer" which will redirect them to a blank canvas where we will start to build the integrations.

    Typically you'll be presented with a screen similar to below where you will need to specify a "trigger" in our situation we would like to receive a HTTP Request from Insight for the custom alert. In order for this to properly work we will need to create a "Request Body JSON Schema". Luckily we have a sample schema we can use by downloading the following .zip or can paste the following  simplified schema into the HTTP request.

    Download Insight-Logic JSON Samples (files)

    https://docs-be.aveva.com/bundle/insight/page/Insight-Logic-JSON-Samples.zip

    {
        "properties": {
            "actionCondition": {
                "type": "string"
            },
            "alertDescription": {
                "type": "string"
            },
            "alertName": {
                "type": "string"
            },
            "alertOwner": {
                "type": "string"
            },
            "alertTriggerTime": {
                "type": "string"
            },
            "asset": {
                "type": "string"
            },
            "behaviorId": {
                "type": "string"
            },
            "consequenceOfFailure": {
                "items": {
                    "properties": {
                        "Applicable": {
                            "type": "string"
                        },
                        "FailureType": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "FailureType",
                        "Applicable"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "executionTime": {
                "type": "string"
            },
            "insighturl": {
                "type": "string"
            },
            "optionalparameter": {
                "properties": {
                    "Test": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "prescriptiveActions": {
                "items": {
                    "properties": {
                        "PrescriptiveAction": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "PrescriptiveAction"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "tags": {
                "items": {
                    "properties": {
                        "Data": {
                            "items": {
                                "properties": {
                                    "DateTime": {
                                        "type": "string"
                                    },
                                    "Text": {
                                        "type": "string"
                                    },
                                    "Value": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "Value",
                                    "Text",
                                    "DateTime"
                                ],
                                "type": "object"
                            },
                            "type": "array"
                        },
                        "Expression": {
                            "type": "string"
                        },
                        "Fqn": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "Fqn",
                        "Data",
                        "Expression"
                    ],
                    "type": "object"
                },
                "type": "array"
            },
            "tenantId": {
                "type": "string"
            },
            "tenantName": {
                "type": "string"
            }
        },
        "type": "object"
    }

    Select "Add Trigger" and look for HTTP Request

    Paste the mentioned schema above into the parameter window "Request Body JSON Schema", once it's saved it will generate a HTTP URL that will be used in the Logic App URL in the custom alerts within Insight.

    Next couple of configurations are quite straight-forward, there should be a plus sign available (underneath the HTTP Request trigger) to add an additional step, in which we need to add a declared variable. (in this case it will be the token/key used to authenticate and POST messages to Teamwork). You will need to login to your teamwork administration console and create a new key.

    Create the API Key within Teamwork used for the Logic App "Variable"

    Final step is to create another step in which we will do a HTTP POST to Teamwork, you can find literature on the help guide to understand the format needed to create the proper messaging or use the following. You can also see some of the API documentation needed to successfully POST a message to Teamwork.

    Teamwork API Documentation (readme)

    https://api-docs.poka.io/docs/general-information

    {
      "type": "Http",
      "inputs": {
        "uri": "<enter your teamwork instance information>",
        "method": "POST",
        "headers": {
          "Authorization": "@variables('API_Key')"
        },
        "body": {
          "allow_comments": true,
          "content": {
            "en": "Alert Notification has been sent from Insight to Teamwork, alertName='@{triggerBody()?['alertName']}', alertDesc='@{triggerBody()?['alertDescription']}', alertTime='@{triggerBody()?['alertTriggerTime']}', CreatedBy='@{triggerBody()?['alertOwner']}'"
          },
          "news_type": 11
        }
      },
      "runAfter": {
        "Initialize_variable": [
          "Succeeded"
        ]
      }
    }

    Once this is completed you can go into the Insight portal and create a custom alert, from the HTTP Request "step" in which you can use the URL created to insert into the custom alerts.

Children