Skip to content

Instantly share code, notes, and snippets.

View hmagarotto's full-sized avatar

Henrique Magarotto hmagarotto

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hmagarotto
hmagarotto / send_message.sh
Created March 27, 2018 19:37
Script to send a test message to Rocket.Chat Livechat
#!/bin/bash
RESULT=$(curl -s 'http://localhost:3000/api/v1/login' -d "username=user&password=pwd")
USERID=$(echo ${RESULT} | jq -r '.data.userId')
AUTHTOKEN=$(echo ${RESULT} | jq -r '.data.authToken')
H_USERID="X-Auth-Token: ${AUTHTOKEN}"
H_AUTHTOKEN="X-User-Id: ${USERID}"
curl -s -H "Content-type: application/json" -H "${H_USERID}" -H "${H_AUTHTOKEN}" "http://localhost:3000/api/v1/livechat/messages" -d'{
"visitor": {