Webhook - Test

fdesu
41
fdesu  

Hello,

Im trying to post some message on my channel (Slack), just for testing, but i cant make it run!, Show me "error 404"


Web Request,

void WebHook()
  {
   string strJsonText = "{text: Hello, world.}";
   uchar jsonData[];

   StringToCharArray(strJsonText, jsonData, 0, StringLen(strJsonText), CP_UTF8);

   char serverResult[];
   string serverHeaders;
   string requestHeaders = "Content-Type: application/json";

   int res = WebRequest("POST", "https://hooks.slack.com/services/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", requestHeaders, 10000, jsonData, serverResult, serverHeaders);

   if(res == -1)
      Print("Error en WebRequest, Código de error  = ", GetLastError());  //check error WebRequest
  }


Curl Example, work fine!

curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://hooks.slack.com/services/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


Thanks in Advanced!


Regards!

Dominik Egert
1327
Dominik Egert  
Have you added the URL to the allowed URLs in the Terminal?
fdesu
41
fdesu  
Dominik Egert:
Have you added the URL to the allowed URLs in the Terminal?

Hi Dominik,

Thanks for your reply!

I was wrong with 

"{text: Hello, world.}

but now is runing, thank anyways!

Dominik Egert
1327
Dominik Egert  
Oh, yes. I see. Invalid json.

Sorry, I did not see this.
fdesu
41
fdesu  
Dominik Egert:
Oh, yes. I see. Invalid json.

Sorry, I did not see this.

Don't worry, thanks for your time!

Anyways!