簡體   English   中英

Microsoft Teams escaping 文本中的下划線

[英]Microsoft Teams escaping underscores in text

我在 ruby 中關注 function 通過 webhook 將 aws 日志發送到微軟團隊頻道。 有些文本包含下划線符號,如connection_web ,但在 MS 團隊中顯示為connectionweb 如何獲得准確的 output?

require 'json'
require 'net/https'
require 'uri'
require 'base64'
require 'zlib'
require 'stringio'
def lambda_handler(event:, context:)
  log_event = JSON.parse(decode_and_decompress(event["awslogs"]["data"]))
  response = speak(messages_from_blob(log_event))
  puts response.body
end
def speak(message)
  http = Net::HTTP.new("MS-Teamwebhook.com", 443)
  http.use_ssl = true
  request = Net::HTTP::Post.new(ENV["HOOK_URL"])
  request.body = JSON.generate({
    text: message
  })
  http.request(request)
end
def decode_and_decompress(input)
  binary_compressed = Base64.decode64(input)
  gz = Zlib::GzipReader.new(StringIO.new(binary_compressed))    
  gz.read
end
def messages_from_blob(event_data)
  event_data["logEvents"]
    .map{ |e| e["message"] }
    .join("\n")
end

@Jagadeesh:我使用以下請求使用 postman 正文並將最后一段中value中的消息 passwd 發送到 msteam 通道,現在 output 已完美接收。 但是使用上面的 ruby 代碼無法接收到相同的消息。

{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"summary": "Office 365 Notification",
"title": "Office 365 Service Degradations",
"sections": [
    {
        "markdown": false,
        "facts": [
            {
                "name": "Service Incident:",
                "value": "ID"
            },
            {
                "name": "Start time:",
                "value": "check_disk_critical"
            },
            {
                "name": "Service:",
                "value": "SERVICENAME"
            },
            {
                "name": "Description:",
                "value": "# Time: 210211  6:12:12
    # User@Host: live_test_demo_web[live_test_demo_web] @  [10.7.13.209]  Id: 468920921
    # Query_time: 2.070946  Lock_time: 0.000041 Rows_sent: 0  Rows_examined: 762480
    use web;
    SET timestamp=1613023932;
    UPDATE `testing_web`.`abc_customer_data` SET `test_processing`=0 WHERE `id` > 0;"
            }
        ],
        "title": "Office 365 Service Problem"
    }
]
}

我們已經為此提出了一個錯誤,相關團隊正在努力解決這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM