apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: send-to-telegram labels: app.kubernetes.io/version: "0.1" annotations: tekton.dev/pipelines.minVersion: "0.12.1" tekton.dev/tags: messaging spec: description: >- These tasks post a simple message to a telegram chat. This task uses the Bot API of telegram to send a message. params: - name: bot-token-secret type: string description: Token of the bot through - name: chat-id type: string description: ID of the chat to send the message towards - name: message type: string description: The message to notify about steps: - name: post image: curlimages/curl:7.68.0 script: | #!/bin/sh MESSAGE=`echo $MESSAGE | sed -e 's/\"/\\\\"/g'` JSON="{\"chat_id\": ${CHAT_ID}, \"text\": \"${MESSAGE}\" }" curl -X POST -H 'Content-Type: application/json' -d "${JSON}" https://api.telegram.org/bot${BOT_TOKEN}/sendMessage env: - name: BOT_TOKEN valueFrom: secretKeyRef: name: $(params.bot-token-secret) key: token - name: CHAT_ID value: $(params.chat-id) - name: MESSAGE value: $(params.message)