php - 通过 webhook 发送的 Slack 消息中出现不需要的表情符号

标签 php curl webhooks slack slack-api

我到处搜索,想找到其他人遇到这个问题,但找不到任何东西。

问题是我正在尝试使用 Shopify 订单号从 php 脚本向我的松弛 channel 发送消息。除了一件事之外,它的工作正常,它在消息中添加了一个红色方 block 表情符号,我不明白为什么。

消息如下:

red square that shouldn't be there

这是我用来发送松弛消息的代码:

  // Create a constant to store your Slack URL
  define('SLACK_WEBHOOK', 'https://hooks.slack.com/services/x/x/eActr8MIhT0SIyKuGGwR0ScU');
  // Make your message
  $message = array('payload' => json_encode(array('text' => 'Order '.$shopify_order['name'].' has been sent to Embroidery Works' )));
  // Use curl to send your message
  $c = curl_init(SLACK_WEBHOOK);
  curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($c, CURLOPT_POST, true);
  curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($c, CURLOPT_POSTFIELDS, $message);
  curl_exec($c);
  curl_close($c);

最佳答案

Worth nothing: #BA1242 is a dark-red color. You'll often see it on programmer forums when describing CSS. color-hex.com/color/ba1242 – @Chris

正如 Chris(谢谢!)指出的那样,Slack 会自动发布十六进制颜色的预览。事实证明,这个特定的商店代码与十六进制颜色相匹配。

关于php - 通过 webhook 发送的 Slack 消息中出现不需要的表情符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51392129/

相关文章:

python - 为什么在使用 python suds 连接到 Microsoft CRM 时出现连接错误/超时?

bitbucket - 将 gitlab 存储库自动同步到 bitbucket

php - 在 Laravel 8 中找不到 404

php - 我们如何才能在 php 中准确地进行缓存

curl (56) 接收失败

webhooks - Slack @here 通过传入 webhook 在 channel 中提及

用于 Paypal Webhooks 的 PHP 监听器脚本

php - 爆炸函数后计算绝对值

javascript - 打破数组内的数组 php

http - curl 输出不重定向到文件