Skip to content

A cf worker that consume messages from the queue and notifies Slack.

Notifications You must be signed in to change notification settings

blck-snwmn/slackworker

Repository files navigation

slackworker

Deploy CodeQL

A worker that consume messages from the queue and notifies Slack.

Setting(for Local)

  1. Create a file named .dev.vars in the project root directory.
  2. Write the following key-value pairs in the .dev.vars file:
SLACK_TOKEN=<Your_SLACK_TOKEN>

Replace

  • '<Your_Slack_Bearer_Token>' with the bearer token for the Slack file upload API

Setting

Run the following commands to add your secrets to the Workers configuration:

secret

wrangler secret put SLACK_TOKEN

queues

wrangler queues create slackqueue

Deploy

After you've added the secrets, deploy the Worker with the following command:

wrangler deploy

Use

Send to queue from cf worker(note: Queues is open beta)

Add the following to your wrangler.toml

[[queues.producers]]
queue = "slackqueue"
binding = "SLACK_NOTIFIER"

Add the following to your worker script

export interface Env {
	SLACK_NOTIFIER: Queue;
}
...
await env.SLACK_NOTIFIER.send({
    type: "chat.postMessage",
    body: {
        channel: "your channel id"
        text: "Hello, world!", // or blocks
    },
});

About

A cf worker that consume messages from the queue and notifies Slack.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published