CryptoSignal / Crypto-Signal

Github.com/CryptoSignal - Trading & Technical Analysis Bot - 4,100+ stars, 1,100+ forks
https://www.linkedin.com/in/AbenezerMamo
MIT License
4.84k stars 1.26k forks source link

Notif for Slack work but for telegram not enable #288

Open yohukm opened 6 years ago

yohukm commented 6 years ago

i using this setting

notifiers: slack: required: webhook: https://hooks.slack.com/services/T87HUE084/B88E01AF8/XXXXXoeV0fk81YgdXGD6CSs optional: template: "{{exchange}}-{{market}}-{{indicator}}-{{indicator_number}} is {{status}}!{{ '\n' -}}"

telegram:
    required:
        token: 556960520:AAF-uECdDAL7yqxRb3PkiYWGfV3-_XXXXXX
        chat_id: -1001353606xxx
    optional:
        parse_mode: html
        template: "{{exchange}}-{{market}}-{{indicator}}-{{indicator_number}} is {{status}}!{{ '\n' -}}"

for slack work but for telegram nothing happen

ghost commented 6 years ago

There's no error message, just no output? Does it say in the startup messages that the notifier is enabled?

yohukm commented 6 years ago

yes after i put chat id
enable notifiers slack and telegram
but no message sent to telegram

december-soul commented 6 years ago

same here. enabled notifers: ['telegram'] but i never get any messages.

ghost commented 6 years ago

Thanks! I should have this sorted in the next couple of days

december-soul commented 6 years ago

I have to improve, I works for me. (i just use telegram, not slack and telegram like yohukm)

for testing i have added


----------------------------- app/notification.py -----------------------------
index 258faae..3fbc3b3 100644
@@ -71,6 +71,7 @@ class Notifier():
                 chat_id=notifier_config['telegram']['required']['chat_id'],
                 parse_mode=notifier_config['telegram']['optional']['parse_mode']
             )
+            self.telegram_client.notify("crypto-signal is up")
             enabled_notifiers.append('telegram')

         self.webhook_configured = self._validate_required_config('webhook', notifier_config)

i saw that the crypto-signal app send successful a message. after that I realized that there were just no messages to send.

Worksforme

ghost commented 6 years ago

Thanks for the further update!

ghost commented 6 years ago

Just to make sure all of the conversation is present here:

[10:27 AM] jsmurphy: @yohukm For your open git issue, does the issue with telegram occur always, or only when you have both slack and telegram enabled?
[10:43 AM] yohukm: i always use both, i will try  telegram only
i make bot   privacy disable   invite to super group    , find id  group     invite bot
now try to use only telegram
ghost commented 6 years ago

This issue seems to occur only when multiple notifiers are configured. I will continue to investigate the root cause.

december-soul commented 6 years ago

Maybe you can test this. just to get closer to the problem

index 258faae..1427887 100644
--- a/app/notification.py
+++ b/app/notification.py
@@ -92,11 +92,11 @@ class Notifier():
             new_analysis (dict): The new_analysis to send.
         """

+        self.notify_telegram(new_analysis)
         self.notify_slack(new_analysis)
         self.notify_discord(new_analysis)
         self.notify_twilio(new_analysis)
         self.notify_gmail(new_analysis)
-        self.notify_telegram(new_analysis)
         self.notify_webhook(new_analysis)
ikwtif commented 6 years ago

I don't think it's related to multiple notifier config setup, I have the same issue. No messages in telegram chat with only telegram configured. I think it's not sending anything because there is nothing to send for some reason. config file structure I use:

settings:
   update_interval: 100

exchanges:
    binance:
        required:
            enabled: true

notifiers:
    telegram:
        required:
            token: abcd1234
            chat_id: abcd1234
        optional:
            parse_mode: html
            template: "{{exchange}}-{{market}}-{{indicator}}-{{indicator_number}} is {{status}}!{{ '\n' -}}"
ikwtif commented 6 years ago

I found my "issue" at least, not sure if it is completely related to OP as it is a misinterpretation of how alerts work. The config always defaults alert_frequency: once so there is no alert on the first run trough. I tried it a few months back and just got instant messages on telegram so I guess this was something that changed and I overlooked. Makes sense in hindsight. Probably should have read the docs more carefully. Might be good to add to the doc as I see alert_frequency not really explained in there to let people know you can just set it up so you get messages every interval of the script. It's only briefly adressed in Notifier Templating

ghost commented 6 years ago

Glad you resolved your problem, the docs are definitely not as clear as they could be. I do my best to keep them usable, though I have a very limited amount of time to work on this project and truly good documentation takes a long time to write.

I do however happily accept PR's on documentation improvements

yohukm commented 6 years ago

i use only telegram and work for chatid it must group and supergroup
chat id for group have "-" here my config i make 3 for 3 folder all for telegram https://pastebin.com/qymEwn1X https://pastebin.com/f7EivneV https://pastebin.com/BMYWVUC7

here my config .yml 1 binance bittrex split 1 config 90 coin make 3 folder binance bittrex1 bittrex2

ghost commented 6 years ago

Root cause identified, basically because the notifiers run sequentially it thinks that it has already notified on the status by the time it gets to the second notifier in the chain. I am going to work on a fix this weekend.

ghost commented 6 years ago

I've made a couple of attempts at patching in a quick fix for this, I think this is actually going to require a more drastic re-write to the notifier class than I was initially thinking. It will still get fixed... just take a little while longer before I really have time to re-evaluate what the best way to do that is.

keithfawcett commented 6 years ago

So what's odd for me is that I have Telegram first and gmail second, but I only get the notifications in gmail.

ghost commented 6 years ago

They do not execute in the order they are provided in the yaml file, the order is pre-determined in code.