question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to postMessage without any events

See original GitHub issue

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

How to use chat.postMessage Method without any Events?

For example, I want to send a message at 9 a.m every day.

There was no ‘body’ or ‘context’ to get a token.

Yes, I do not understand the slack API system well.

Would you like to help me?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Jun 18, 2020

@whitehander Hello, thanks for asking a question!

To just call chat.postMessage or any other Web APIs, it’s not always necessary to use Bolt. Installing only @slack/web-api and writing a small script as guided here would be enough for such a case. Regarding the possible ways to trigger the script, you can go with any solutions such as cron jobs, scheduled events by Cloud services.

If you’re interested in having some interactive parts (e.g., buttons, select menu) in the messages, you need to built a backend service that receives incoming requests from the Slack API server. Those HTTP requests tell your backend user action events. Bolt is the best solution for building such a backend service.

So, if you would like to implement both in a single app, having extra internal (= not internet-facing) endpoints for invoking periodical operations (daily, hourly) in a Bolt app may be a reasonable solution. Here is the guide for how to add extra routes in a Bolt app: https://slack.dev/bolt-js/concepts#custom-routes

0reactions
PkMnCrystal91commented, Mar 23, 2022

@srajiang yeah!! Thank you so much. I was a bit confused, but I just figured out and it worked

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window.postMessage() - Web APIs | MDN
The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it ...
Read more >
Using JavaScript and window.postMessage() - In Plain English
The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it ...
Read more >
How do you use window.postMessage across domains?
Here's the code that registers a message event listener in the page on A: window.addEventListener( "message", function (event) { // Do something } ......
Read more >
HTML5 window.postMessage - David Walsh Blog
window.postMessage allows for sending data messages between two windows/frames across domains. Essentially window.postMessage acts as ...
Read more >
HTML5 window.postMessage() - SCRIPTVERSE
A brief tutorial on the window.postMessage() method, which gives a provision for sending cross-domain data messages between two browser windows safely.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found