Microsoft Teams在文本中转义下划线



我在ruby中有以下功能,通过webhook将aws日志发送到微软团队频道。有些文本包含下划线符号,如connection_web,但在MS团队中显示为connectionweb。如何得到确切的输出?

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:我使用邮差体使用以下请求,并在最后一段将value中的消息passwd发送到msteam通道,现在输出完全收到。但是同样的消息不能用上面的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"
}
]
}

我们已经提出了一个错误,相关团队正在努力解决。

最新更新