8000 Telegram Callback from_id and chat_id error · Issue #8461 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Telegram Callback from_id and chat_id error #8461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
drgnomage opened this issue Jul 13, 2017 · 1 comment · Fixed by #8523
Closed

Telegram Callback from_id and chat_id error #8461

drgnomage opened this issue Jul 13, 2017 · 1 comment · Fixed by #8523

Comments

@drgnomage
Copy link
drgnomage commented Jul 13, 2017

Home Assistant release (0.48.1):
Python release (Python 3.6.1):
Telegram/callback:

Description of problem:
Can't send to image message to telegram group on callback responce. From the logs I can see that from_id and chat_id have = instead of _. This functioned correctly when using user_id.

Expected:
Photo to be sent when inline keyboard is clicked.

Jul 13 10:38:51 Media hass[14908]: 2017-07-13 10:38:51 INFO (MainThread) [homeassistant.core] Bus:Handling <Event telegram_callback[L]: user_id=103778131, from_first=Josh, from_last=Fowler, data=/win, message=message_id=402, from=id=380284543, first_name=Glitchbusters Home Assistant, username=GlitchbustersHAbot, chat=id=-219222317, title=Home Automation Testing, type=group, all_members_are_administrators=True, date=1499935434, text=Random Word

  • alias: 'Telegram bot for winner'
    id: Telegram win bot
    hide_entity: false
    trigger:
    platform: event
    event_type: telegram_command
    event_data:
    command: '/word'
    args:
    - 'test'
    action:
    • service: telegram_bot.send_message
      data_template:
      title: 'Random Word'
      target: '{{ trigger.event.data.chat_id }}'
      message: 'This random words winner is {{ trigger.event.data.from_first }} with {{ trigger.event.data.text }}. Use /win to claim your prize.'
      inline_keyboard: [[["Click here for winner prize!", "/win"]]]
  • id: telegram_win
    alias: Telegram bot for win
    hide_entity: false
    trigger:
    platform: event
    event_type: telegram_callback
    event_data:
    data: /win
    action:
    service: telegram_bot.send_photo
    data_template:
    target: '{{ trigger.event.data.chat_id }}'
    url: http://www.popular-mag.com/wp-content/uploads/a7545babeea20443bc592608c9a02643-1487887103.gif
    caption: Dick pic
    file: /tmp/picture.gif

Please let me know if any more information is needed.

@azogue
Copy link
Member
azogue commented Jul 17, 2017

Hi @drgnomage, it seems it's failing with groups, when there is not a chat_id attribute.

You can reach the group id target with {{ trigger.event.data.message.chat.id }} instead of {{ trigger.event.data.chat_id }}.
(data.message contains the original message with the pressed button).

I'll make a small PR to fix this, thanks for reporting it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0