Skip to content

Instantly share code, notes, and snippets.

@timlianov
Created April 25, 2022 10:23
Show Gist options
  • Select an option

  • Save timlianov/22bbe8e16d635f256cd969de7ea84909 to your computer and use it in GitHub Desktop.

Select an option

Save timlianov/22bbe8e16d635f256cd969de7ea84909 to your computer and use it in GitHub Desktop.
telegram multiline message from Jenkins job
cat << EOF > str_pre
❌ ${JOB_NAME}
%0A
%0APR: ${ghprbPullLink}
%0AJOB: ${JOB_URL}
EOF
STR_PRE=$(cat str_pre)
STR=$(echo $STR_PRE | sed 's/\./\\./g; s/\*/\\*/g; s/\[/\\[/g; s/\-/\\-/g;')
curl -X POST https://api.telegram.org/<bot_api_token>/sendMessage -d "chat_id=<chat_id>&text=$STR&disable_web_page_preview=True&parse_mode=MarkdownV2”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment