skip to Main Content

I’ve searched everywhere to find someone else with this issue but couldn’t find anything.

The issue is I am trying to send a message from a php script to my slack channel with the Shopify order number. It’s working as it should apart from one thing, It’s adding a Red Square emoji in the messages and I can’t figure out why.

This is what the message comes through as:

red square that shouldn’t be there

And this is the code I’m using to send the slack message:

  // 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);

2

Answers


  1. Chosen as BEST ANSWER

    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

    Slack automatically posts previews of hex colours as Chris (Thanks!) pointed out. Just turns out that this particular store codes match hex colors.


  2. Is it possible to display the message without that hex code in slack. I mean when the message is entered with hex code in typing area and as soon as the message is posted, only the red squealed should be displayed.
    Something similar to use of emoji

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search