Incoming WebHook Integration:

Requesting Assistance

I’m very new to Mattermost and creating custom integration’s. I’m using the following script to monitor a folder and forward changes to Mattermost:

#!/bin/bash

tail -n0 -F “$1” | while read LINE; do
** (echo “$LINE” | grep -e “$3”) && curl -X POST --silent --data-urlencode **
** “payload={"text": "$(echo $LINE | sed “s/"/'/g”)"}” “$2”;**
done

The script work as designed but it is missing the option to override the username (payload={“username”: “robot”,) channel (payload={“channel”: “off-topic”) and icon (payload={“icon_url”: “http://somewebsite.com/somecoolimage.jpg”).

Can someone help me with formatting to convert the script to add these functions (ie: where does the double quotes and backslashes go?).

Thank you.

Hi,
Using your code:
** “payload={“username”:“MyUserName”,“text”: “$(echo $LINE | sed “s/”/’/g”)”}" “$2”;*

So simply repeat that for each section:
“prop”:“propValue”,

Where prop is your property name (username, channel, icon_url) and propValue is the corresponding value. Remeber the , to separate each item.