Example: Sending text messages to Telegram

stable
By Stephan in Miscellaneous Published October 2020 👁 2,001 views 💬 4 comments

Description

This is an example script to show how to send text messages to external sources like (in this case) Telegram. Please note: This script only works in Version 4 of the Haasbot, version 3 does not have support for this.
HaasScript
p = ClosePrices(1);

-- Make some sort of logic to trigger it
if (p[1] > 100000) then

  -- Please visit the following website listed to see how you can 
  -- get the Telegram token: https://core.telegram.org/bots
  BroadcastToTelegram('123456789:ABCDEFHIJKLMNOP','This is a message send directly from HaasScript')

end

4 Comments

Sign in to leave a comment.

V
VxLCLi over 5 years ago

I didn't see, This Version did not Release

J
Jonathan_Duclos over 5 years ago

Would love to user this!
I guess that rev 4 is the next HaasCloud?

K
Katerin almost 4 years ago

Im trying BroadcastToTelegram('123456789:ABCDEFHIJKLMNOP','This is a message send directly from HaasScript') with a condition but getting this error?
whats wrong any idea?
ERROR: BroadcastToTelegram(): Invalid input count of 2 (only takes 1).

V
VMSierra over 2 years ago

Just use BroadcastToTelegram(’This is a message send directly from HaasScript’)

Yo do not need to specify the bot token because you have already save it on the haasonline configuration menu before starting using Telegram.