#๐Ÿ”’ Webhook Not Sending Despite 204 Status

5 messages ยท Page 1 of 1 (latest)

maiden otter
#
def send_embed_to_webhook(user_id, badge_id, badge_name):
    embed = {
        "title": RobloxAPIs.RobloxGetUsername(user_id),
        "url": f"https://www.roblox.com/badges/{badge_id}/badge",
        "description": f"{RobloxAPIs.RobloxGetUsername(user_id)} has earned the badge: {badge_name}",
        "color": 0x00b0f4,
        "timestamp": datetime.datetime.now(datetime.timezone.utc).isoformat(),
        "image": {
            "url": RobloxAPIs.RobloxGetBadgeImage(badge_id)
        },
        "thumbnail": {
            "url": RobloxAPIs.RobloxGetUserProfileImage(user_id)
        }
    }

    payload = {
        "content": "||<@&1220868554669424651>||",
        "embeds": [embed]
    }

    headers = {
        'Content-Type': 'application/json'
    }

    response = requests.post(webhook_url, json=payload, headers=headers)
    print(f"Webhook status code: {response.status_code}")
    if response.status_code != 204:
        print(f"Failed to send embed for user {user_id}. Status code:", response.status_code)

I'm trying to trigger a webhook when something changes on another website. Printing the data works fine, but when attempting to send the webhook, it doesn't go through, despite receiving a 204 status code any help would be appreciated

quiet bronzeBOT
#

@maiden otter

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

merry sphinx
#

double check webhook url

quiet bronzeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.