Has someone configured notifications on flyte with...
# ask-the-community
a
Has someone configured notifications on flyte without any emailer service? I’m trying to understand how I can set alerts on workflow failure which will be sent to Slack channel
b
We've worked around it by subscribing to the SNS topics and have them be process by a lambda that pushes the notification to slack.
k
we’ll support slack webhook in the next release. https://github.com/flyteorg/flyteadmin/pull/583
a
What about support to GCP?
k
we use google pub/sub. already support it now. check out the pr. really appreciate any feedback
a
Ok sounds good, is there any
webhooknotifications
configuration for GCP so we can try it out?
@Kevin Su
k
@Ariel Kaspit
Copy code
externalEvents:
  enable: true
  type: "gcp"
  gcp:
    projectId: "your-project"
  eventsPublisher:
    topicName: "gcp-topic"
    eventTypes:
      - all
webhooknotifications:
  type: "gcp"
  gcp:
    projectId: "your-project"
  webhooks:
    name: slack
    urlSecretName: slack
    payload: "{{ name }} succeeded"
    processor:
      queueName: webhook
      accountId: "590375264460"
Need to add it to flyteadmin config map, and you need to create a secret for webhook URL and token if needed
btw, one question for both of you. would you use different webhook in different Launch plan. For example, one workflow use slack webhook, and another use MS team webhook. In the current implementation, flyteadmin will call all the webhook endpoints if the workflow is completed. cc @Fabio Grätz
f
Yes, having different webhooks would be great 🙏 Not sure whether we will use different providers but rather: launch plan a should send a notification into slack channel of team a and launch plan b into channel of team b …
Copy code
lp = LaunchPlan.get_or_create(
    notifications=[
        Webhook(
            name=<webhook_name>,  # Should match the name in Flyte admin config map.
            phases=[
                WorkflowExecutionPhase.SUCCEEDED,
            ],
            payload=["{{ name succeeded }}"],
        ),
    ],
)
What you wrote in the PR suggests that in the admin config map the platform team maintains a mapping from webhook name to webhook urls and the users choose one of the webhook names in the launch plan. This sounds very good to me. In the future I’d also be very interested in being able to include a custom message in the notification (e.g. to tag responsible people on workflow failure but other people on workflow success) but this is not for this PR I guess:
Copy code
lp = LaunchPlan.get_or_create(
    notifications=[
        Webhook(
            name=<webhook_name>,  # Should match the name in Flyte admin config map.
            message="... some custom string ...",         # <-----
            phases=[
                WorkflowExecutionPhase.SUCCEEDED,
            ],
            payload=["{{ name succeeded }}"],
        ),
    ],
)
Edit: Or is payload exactly that? 🤔