From f26cf0668b160828b410987578078971fcd645b8 Mon Sep 17 00:00:00 2001 From: Rishi Ramraj <thereisnocowlevel@gmail.com> Date: Fri, 8 Jul 2022 12:06:22 -0400 Subject: [PATCH 1/2] Add messages/post --- examples/bash/post/messages/post | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 examples/bash/post/messages/post diff --git a/examples/bash/post/messages/post b/examples/bash/post/messages/post new file mode 100755 index 0000000..40353b1 --- /dev/null +++ b/examples/bash/post/messages/post @@ -0,0 +1,15 @@ +#!/bin/bash +if [ $# -ne 3 ] +then + echo "./post <token> <conversation_id> <message>" + exit 1 +fi +data="{\"content\": \"$3\", \"attachments\": []}" + +SERVER=${SERVER:=api} +curl "https://$SERVER.getsling.com/conversations/$2/messages" \ + -X POST \ + -d "${data//[$'\t\r\n ']}" \ + -H "Content-Type: application/json" \ + -H "Authorization: ${1//[$'\t\r\n ']}" \ + -H "accept: */*" \ From ae69aea6207c18eadb506e401ea37d3910d76b96 Mon Sep 17 00:00:00 2001 From: Rishi Ramraj <thereisnocowlevel@gmail.com> Date: Fri, 8 Jul 2022 12:08:17 -0400 Subject: [PATCH 2/2] Fix message mangling --- examples/bash/post/messages/post | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bash/post/messages/post b/examples/bash/post/messages/post index 40353b1..d112a2f 100755 --- a/examples/bash/post/messages/post +++ b/examples/bash/post/messages/post @@ -9,7 +9,7 @@ data="{\"content\": \"$3\", \"attachments\": []}" SERVER=${SERVER:=api} curl "https://$SERVER.getsling.com/conversations/$2/messages" \ -X POST \ - -d "${data//[$'\t\r\n ']}" \ + -d "${data}" \ -H "Content-Type: application/json" \ -H "Authorization: ${1//[$'\t\r\n ']}" \ -H "accept: */*" \