GKE notifications to gchat room via pub/sub and cloud function not working

I am wanting to enable GKE notification events to be sent to a gchat room, the documentation for this specifically is non existent, only references slack via a webhook url, however, I am using a webhook url for the gchat room too. I have tried various setups and either I face a http 400 error when using the exact code provided by google for node.js:

Exception from a finished function: Error: An HTTP protocol error occurred: statusCode = 400 

After more googling I found this one, which seems to work according to the logs but nothing is coming through the the chat room:

https://github.com/echoboomer/gke-notification-handler/tree/main

See here:

The code is exactly the same as the github link (obviously I have inserted my gchat webroom url to the runtime variable too).

    #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Created By  : github.com/echoboomer
# =============================================================================
"""
This script processes GKE cluster upgrade-related notifications as part of a
GCP Cloud Function.
"""
# =============================================================================
# Imports
# =============================================================================
import base64
import json
import os
import requests
import sys


def process_event(slack_data, webhook_url):
    byte_length = str(sys.getsizeof(slack_data))
    headers = {
        "Content-Type": "application/json",
        "Content-Length": byte_length,
    }
    response = requests.post(webhook_url, data=json.dumps(slack_data), headers=headers)
    if response.status_code != 200:
        raise Exception(response.status_code, response.text)


def notify_slack(event, context):
    """Background Cloud Function to be triggered by Pub/Sub.
    Args:
         event (dict):  The dictionary with data specific to this type of
         event. The `data` field contains the PubsubMessage message. The
         `attributes` field will contain custom attributes if there are any.

         context (google.cloud.functions.Context): The Cloud Functions event
         metadata. The `event_id` field contains the Pub/Sub message ID. The
         `timestamp` field contains the publish time.
    """

    print(
        """This Function was triggered by messageId {} published at {}
    """.format(
            context.event_id, context.timestamp
        )
    )

    if "data" in event:
        # Print the event at the beginning for easier debug.
        print("Event was passed into function and will be processed.")
        print(event)

        # Shared Variables
        cluster = event["attributes"]["cluster_name"]
        cluster_resource = json.loads(event["attributes"]["payload"])["resourceType"]
        location = event["attributes"]["cluster_location"]
        message = base64.b64decode(event["data"]).decode("utf-8")
        project = event["attributes"]["project_id"]
        webhook_url = os.getenv("SLACK_WEBHOOK_URL")

        # UpgradeEvent
        if "UpgradeEvent" in event["attributes"]["type_url"]:
            # UpgradeEvent Variables
            current_version = json.loads(event["attributes"]["payload"])[
                "currentVersion"
            ]
            start_time = json.loads(event["attributes"]["payload"])[
                "operationStartTime"
            ]
            target_version = json.loads(event["attributes"]["payload"])["targetVersion"]
            title = f"GKE Cluster Upgrade Notification :zap:"
            slack_data = {
                "username": "Platform Notifications",
                "icon_emoji": ":satellite:",
                "attachments": [
                    {
                        "color": "#9733EE",
                        "fields": [
                            {"title": title},
                            {
                                "title": "Project",
                                "value": project,
                                "short": "false",
                            },
                            {
                                "title": "Cluster",
                                "value": cluster,
                                "short": "false",
                            },
                            {
                                "title": "Location",
                                "value": location,
                                "short": "false",
                            },
                            {
                                "title": "Update Type",
                                "value": cluster_resource,
                                "short": "false",
                            },
                            {
                                "title": "Current Version",
                                "value": current_version,
                                "short": "false",
                            },
                            {
                                "title": "Target Version",
                                "value": target_version,
                                "short": "false",
                            },
                            {
                                "title": "Start Time",
                                "value": start_time,
                                "short": "false",
                            },
                            {
                                "title": "Details",
                                "value": message,
                                "short": "false",
                            },
                        ],
                    }
                ],
            }
            process_event(slack_data, webhook_url)
        # UpgradeAvailableEvent
        elif "UpgradeAvailableEvent" in event["attributes"]["type_url"]:
            if os.getenv("SEND_UPGRADE_AVAILABLE_NOTIFICATIONS") == "enabled":
                # UpgradeAvailableEvent Variables
                available_version = json.loads(event["attributes"]["payload"])[
                    "version"
                ]
                title = f"GKE Cluster Upgrade Available Notification :zap:"
                slack_data = {
                    "username": "Platform Notifications",
                    "icon_emoji": ":satellite:",
                    "attachments": [
                        {
                            "color": "#9733EE",
                            "fields": [
                                {"title": title},
                                {
                                    "title": "Project",
                                    "value": project,
                                    "short": "false",
                                },
                                {
                                    "title": "Cluster",
                                    "value": cluster,
                                    "short": "false",
                                },
                                {
                                    "title": "Location",
                                    "value": location,
                                    "short": "false",
                                },
                                {
                                    "title": "Eligible Resource",
                                    "value": cluster_resource,
                                    "short": "false",
                                },
                                {
                                    "title": "Eligible Version",
                                    "value": available_version,
                                    "short": "false",
                                },
                                {
                                    "title": "Details",
                                    "value": message,
                                    "short": "false",
                                },
                            ],
                        }
                    ],
                }
                process_event(slack_data, webhook_url)
            else:
                pass
        else:
            print(
                "Event was neither UpgradeEvent or UpgradeAvailableEvent, so it will be skipped."
            )
            exit(0)
    else:
        print("No event was passed into the function. Exiting.")
        exit(0)

GKE cluster is using the right pub/sub setup too.

Any ideas:

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật