This Temporal application demonstrates the use of activities and workflows to send error notifications to Slack.
The primary goal is to attempt an activity (compose_greeting), and if it fails, send an alert to Slack detailing the error.
- 
compose_greeting: This activity takes a greeting and a name as input and simulates an activity that will always fail. It also has logic to heartbeat to Temporal and sleep for a second before failing. This is used to show the retry capabilities of Temporal.
 - 
slack_notification: This activity is designed to send error messages to a specific Slack channel using a webhook. If there's a problem sending the message to Slack, this activity will raise an exception.
 
- 
SayHello: This workflow tries to execute the
compose_greetingactivity. The activity is set to retry up to 2 times with a timeout of 5 seconds. - 
SayError: This workflow is designed to be called when the
SayHelloworkflow encounters an exception. It will execute theslack_notificationactivity to send an error message to Slack. 
The primary execution logic first attempts to run the SayHello workflow. If it encounters an exception, it then runs the SayError workflow to alert Slack of the error.
Note: See the tutorial hello_slack for detailed instructions on setting up the Slack webhook integration.
- 
Ensure you have Temporal server running locally.
 - 
Start the Temporal worker by executing:
 
poetry run python run_worker.pyThis worker listens for tasks from the Temporal server and executes the workflows and activities as required.
- Execute the main application:
 
poetry run python run_workflow.pyThis will start the SayHello workflow. Since the compose_greeting activity is designed to always fail, the exception will be caught, and the SayError workflow will be triggered, sending an error notification to Slack.
Ensure to replace the WEBHOOK_URL in the activities file with your actual Slack webhook URL. Remember to keep this webhook URL private and secure, as anyone with access to it can post messages to your Slack channel.
- temporalio
 - requests
 
Ensure these are installed in your environment before running the application.
poetry install