I'm building a SIL script that uses the httpPost method (I'm sending a POST to the Slack API). In my post, I'm sending an embedded link and the way Slack formats this is:
<http://www.google.com|This is a link to Google>
Where "This is a link to Google" is the hyperlink. So my full script would look something like this:
string url = "https://slack.com/api/chat.postMessage";
string [] headers = "Accept|text/plain";
string [] params = "token|my_token|channel|ckast-private|text|<http://www.google.com|This is a link to Google>";
httpPost(url, headers, params);
The problem is when sending a request via httpPost, it separates the key:values with "pipes" (|). So when it reads the above, it thinks the "pipe" is starting a new key:value pair. Is there a way to escape this out in the SIL script? I tried using double backslashes but that didn't work. Here's the error I'm getting:
Running sil script failed.
com.keplerrominfo.sil.lang.SILException: Exception while executing SIL program >>-Run:Send Notification (10001)<<
at com.keplerrominfo.jira.commons.silrunner.UnifiedSilRunner.throwAway(UnifiedSilRunner.java:233)
at com.keplerrominfo.jira.commons.silrunner.UnifiedSilRunner.interpret(UnifiedSilRunner.java:128)
at com.keplerrominfo.jira.plugins.jjupin.services.RunnableSilScriptServiceImpl.run(RunnableSilScriptServiceImpl.java:117)
at com.keplerrominfo.jira.plugins.jjupin.threading.AsyncJJupinRunner$AsyncJJupinRunnerCallable.createResult(AsyncJJupinRunner.java:205)
at com.keplerrominfo.jira.plugins.jjupin.threading.AsyncJJupinRunner$AsyncJJupinRunnerCallable.createResult(AsyncJJupinRunner.java:168)
at com.keplerrominfo.jira.commons.threading.JiraCallable.call(JiraCallable.java:62)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.keplerrominfo.sil.lang.SILInfoException: [SIL Error on line: 9, column: 1] Params invalid. Must have an even number of elements.