Json 松弛RTM消息

Json 松弛RTM消息,json,node.js,slack-api,slack,Json,Node.js,Slack Api,Slack,我使用node.js构建slack机器人。我使用了@slack/client。它很好用。 现在我有了一个JSON格式的数据,它是通过slackmessagebuilder获得的。 像这样, { "attachments": [ { "fallback": "Required plain-text summary of the attachment.", "color": "#36a64f", "pre

我使用node.js构建slack机器人。我使用了
@slack/client
。它很好用。 现在我有了一个JSON格式的数据,它是通过
slackmessagebuilder
获得的。 像这样,

{
    "attachments": [
        {
            "fallback": "Required plain-text summary of the attachment.",
            "color": "#36a64f",
            "pretext": "Optional text that appears above the attachment block",
            "author_name": "Bobby Tables",
            "author_link": "http://flickr.com/bobby/",
            "author_icon": "http://flickr.com/icons/bobby.jpg",
            "title": "Slack API Documentation",
            "title_link": "https://api.slack.com/",
            "text": "Optional text that appears within the attachment",
            "fields": [
                {
                    "title": "Priority",
                    "value": "High",
                    "short": false
                }
            ],
            "image_url": "http://my-website.com/path/to/image.jpg",
            "thumb_url": "http://example.com/path/to/thumb.png",
            "footer": "Slack API",
            "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
            "ts": 123456789
        }
    ]
}

如果我通过显示json文本的
rtm.sendMessage()
函数发送此json。如何将此json转换为格式化的slack消息?提前谢谢。

如果您对这个问题有任何疑问,可以问我
There are two ways to send message to slack:
1)rtm.sendMessage('hello ' + user.name + '!', dm.id); and 
2)you can use api.chatpost message api ,using request module which is used to send data .
i am using this in my project you can also view this , how i do that.
check my github https://github.com/shekhartyagi26/slack_Rtm/