Slack

The Slack output in  ArcGIS Velocity allows you to send messages to Slack channels. These messages can include text, graphics, and buttons, providing an interactive and engaging way to communicate information.  With Velocity, feature data can be included in the message that is posted to a Slack channel. This is a mechanism to communicate information to users across different systems. 

To use this output type, you must first generate a webhook URL in Slack. This webhook URL is then used to configure the Slack output in Velocity.

Example

以下是输出的使用示例:

An analyst configures a scheduled real-time analytic to process a vehicle crash dataset that is regularly updated. The analyst adds a Slack output to the analytic that sends a message to a Slack channel. This message provides summary statistics including the total number of vehicle crashes and a breakdown of crashes by time of day.

Usage notes

使用输出时,请谨记以下信息:

Slack message JSON examples

The following example creates a basic Slack message displaying vessel information.

Example 1: Basic Slack message

 
// Output is wrapped in Text() 
Text({ 
    "blocks": [ 
      { 
        "type": "header", 
        "text": { 
          "type": "plain_text", 
          "text": "Vessel Information", 
          "emoji": true 
        } 
      }, 
      { 
        "type": "section", 
        "fields": [ 
          {   
												"type": "plain_text", 
            "text": "Vessel Name: " + $feature.name, 
            "emoji": true 
          }, 
          { 
            "type": "plain_text", 
            "text": "Vessel ID: " + $feature.num, 
            "emoji": true 
          } 
        ] 
      } 
    ] 
})

The example above creates the following vessel information message that includes the vessel name and ID.

A Velocity alert containing vessel information details

The following example generates a Slack message with a link and markdown text.

Example 2: Slack message with link and markdown text

 

// Output is wrapped in Text() 
Text({ 
    "blocks": [ 
        { 
            "type": "header", 
            "text": { 
                "type": "plain_text", 
                "text": "New vessel detected at " + $feature.currTime, 
                "emoji": true 
            } 
        }, 
        { 
            "type": "section", 
            "text": { 
                "type": "plain_text", 
                "text": "Vessel Name " + $feature.name + ", traveling at " + $feature.speed + " miles per hour, was detected entering the service territory.", 
                "emoji": true 
            } 
        }, 
        { 
            "type": "section", 
            "text": { 
                "type": "mrkdwn", 
                "text": "Click the <https://www.esri.com/en-us/arcgis/products/arcgis-velocity/overview|link> for additional information about this vessel. :boat: " 
            } 
        } 
    ] 
})

The example above creates the following newly detected vessel message that includes the vessel name, date and time, and a link for more information.

A Velocity alert that includes details for a new vessel detected

Parameters

以下是输出的参数:

ParameterDescriptionData type
Slack Webhook URL

(必填)

The incoming webhook URL created in Slack.

字符串

POST body

(必填)

The JSON  Arcade  expression. The JSON must be wrapped in the Text() Arcade expression.

Arcade Expression

Additional logging

(可选)

You can enable logging for raw HTTP requests and responses generated by  Velocity.

注:

仅当进行故障排除时,才应启用此参数,并且应在完成故障排除时禁用。 如果在启用参数后启动分析,调试级别日志即会出现在分析日志页面上。 如果需要故障排除方面的帮助,请联系 Esri 技术 Support。

布尔

Considerations and limitations

下面是使用此输出时的注意事项和限制:

  • It is important to understand the velocity of the data. Each record sent to this output generates a separate request. If more than one request is made in a second, the client connection can be throttled. The best practice is to use this output for incidents that are expected to occur infrequently.

    Learn more about the incoming webhooks rate limits

  • It is important to understand the message being sent. Slack will truncate messages that contain more than 40,000 characters and a simple text value should not exceed 4,000 characters.

    Learn more about truncating content