松弛的API消息格式

时间:2017-02-22 07:29:54

标签: post format chat message slack-api

我想通过松散的聊天帖API传递这样的消息,该API将遵循以下格式:

*注意*注意单词将以前面和后面的两颗星打印为粗体。但是,考虑到*格式化一个粗体字,以便之前的星星不打印,因为松弛。

我的剧本

 $ch = curl_init("https://slack.com/api/chat.postMessage");
            $data = http_build_query([
             "token" => "*******",
             "channel" => '#notifications-test',                
             "text" => '*Attention* `@channel` - Please inform the client. 75% of monthly hours have been used.'
            ]);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            $result = curl_exec($ch);

请帮忙

1 个答案:

答案 0 :(得分:2)

使用"mrkdwn": false属性。这将关闭Slack中的自动格式化。

相关问题