8000 Telegram callbacks: fix `chat_id` for a callback query from a chat group (#8461) by azogue · Pull Request #8523 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Telegram callbacks: fix chat_id for a callback query from a chat group (#8461) #8523

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

Merged

Conversation

azogue
Copy link
Member
@azogue azogue commented Jul 17, 2017

Description:

When receiving a telegram_callback from a chat group, the chat_id is not attached to the event data. This fixes it.

chat_id should be present at : {{ trigger.event.data.chat_id }} but it isn't.
(It's also present in: {{ trigger.event.data.message.chat.id }})

Related issue (if applicable): fixes #8461

Example entry for configuration.yaml (if applicable):

telegram_bot:
  platform: polling
  api_key: !secret telegram_bot_api_key
  allowed_chat_ids:
    - !secret telegram_bot_chat_id_1
    - !secret telegram_bot_chat_id_2
    - !secret telegram_bot_group_1

automation:
- alias: 'Telegram bot for winner'
  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. DEBUG: ```{{ trigger.event.data }}```'
      inline_keyboard: [[["Click here for winner prize!", "/win"]]]

- alias: Telegram bot for win
  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 }}'
        # WORKS NOW: target: '{{ trigger.event.data.message.chat.id }}'
        url: http://www.popular-mag.com/wp-content/uploads/a7545babeea20443bc592608c9a02643-1487887103.gif
        caption: Dick pic

@mention-bot
Copy link

@azogue, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @sander76 and @pvizeli to be potential reviewers.

@MartinHjelmare MartinHjelmare added this to the 0.49.1 milestone Jul 17, 2017
@MartinHjelmare MartinHjelmare merged commit cca0d3e into home-assistant:dev Jul 17, 2017
@azogue azogue deleted the telegram-callback-from-group branch July 17, 2017 12:49
@balloob balloob mentioned this pull request Jul 24, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegram Callback from_id and chat_id error
5 participants
0