Skip to content
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

Synchronize timestamp from slack with database #22

Open
sindrebilden opened this issue Jul 10, 2020 · 0 comments
Open

Synchronize timestamp from slack with database #22

sindrebilden opened this issue Jul 10, 2020 · 0 comments

Comments

@sindrebilden
Copy link
Contributor

sindrebilden commented Jul 10, 2020

A lot of fun things can be created by a good integration with the reactions in slack.
Slack does not provide an id to messages i the event-api when given reactions but the timestamp ts of the message.

The posted haiku:

{'bot_id': 'XXXXXXXXX', 'suppress_notification': False, 'type': 'message', 'text': '', 'user': 'XXXXXXXXX', 'team': 'XXXXXXXXX', 'bot_profile': {'id': 'XXXXXXXXX', 'deleted': False, 'name': 'bot', 'updated': 1476284487, 'app_id': 'XXXXXXXXX', 'icons': {'image_36': 'https://url.com/image', 'image_48': 'https://url.com/image', 'image_72': 'https://url.com/image'}, 'team_id': 'XXXXXXXXX'}, 'attachments': [{'fallback': 'Haiku #3331 av Sindre Bilden', 'text': 'this is just a test\nthere is nothing to see here\nplease move along now', 'title': 'Haiku #3331', 'footer': '- Sindre Bilden', 'id': 1, 'color': '5d799e'}], 'source_team': 'XXXXXXXXX', 'user_team': 'XXXXXXXXX', 'channel': 'XXXXXXXXX', 'event_ts': '1594409951.033600', 'ts': '1594409951.033600'}

Reaction to the posted haiku:

{'type': 'reaction_added', 'user': 'XXXXXXXXX', 'item': {'type': 'message', 'channel': 'XXXXXXXXX', 'ts': '1594409951.033600'}, 'reaction': '+1:', 'item_user': 'XXXXXXXXX', 'event_ts': '1594410088.033800', 'ts': '1594410088.033800'}

The timestamp ts: '1594409951.033600' acts as an identifier in the channel.
If haikubot listens for its own post of haikus, the timestamp in the database can be updated to match the timestamp from slack, thus indirectly provide an id.

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

No branches or pull requests

1 participant