diff --git a/bin/interoPaheko.sh b/bin/interoPaheko.sh index 63176bb..7fc4aaf 100755 --- a/bin/interoPaheko.sh +++ b/bin/interoPaheko.sh @@ -53,11 +53,12 @@ TEXTE=" # dupont ; jean-louis; jean-louis.dupont@kaz.bzh ; gregomondo@kaz.bzh; gogol ; O; O; N; N; N; N;N;;gogol_team; 10 " PostMattermost() { - PostM=$1 - CHANNEL="kaz:Creation-Comptes" - . $KAZ_KEY_DIR/env-mattermostAdmin - docker exec -t ${mattermostServName} bin/mmctl --suppress-warnings auth login $httpProto://$URL_AGORA --name local-server --username $mattermost_user --password $mattermost_pass >/dev/null 2>&1 - docker exec -t mattermostServ bin/mmctl post create ${CHANNEL} --message ${PostM} >/dev/null 2>&1 + . $KAZ_KEY_DIR/env-mattermostAdmin + PostM=$1 + CHANNEL=$2 + TEAMID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "${URL_AGORA_API}/teams/name/${EQUIPE}" | jq -r .id ) + CHANNELID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" ${URL_AGORA_API}/teams/${TEAMID}/channels/name/${CHANNEL} | jq -r .id ) + curl -s i-X POST -i -H "Authorization: Bearer ${mattermost_token}" -d "{\"channel_id\":\"${CHANNELID}\",\"message\":\"${PostM}\"}" "${URL_AGORA_API}/posts" >/dev/null 2>&1 } ExpMail() { @@ -171,7 +172,7 @@ Int_paheko_Action() { if [[ "${IP_MAIL}" = "true" && "$(cat ${FILE_NOTIFICATION})" -ne "1" ]] then ExpMail ${IP_MAILDEST} "Erreur dans la fiche paheko" "${ERRMSG}" - PostMattermost "Erreur dans la fiche paheko ${email}" + PostMattermost "Erreur dans la fiche paheko ${email}" "Creation-Comptes" # on ecrit 1 dans le fichier pour ne pas envoyer pleins de mails et notif agora echo 1 >${FILE_NOTIFICATION} fi