#pieknu_webhooks

1 messages ยท Page 1 of 1 (latest)

worthy radishBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1339567265846267924

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

austere isle
#

Regarding the discrepancy between Webhook and the Event Tab, via the shell I'm allowed to filter through events listed in the Event tab. But as u can see, these are back from 2024, while the Webhook tabs failed events wont be listed in the shell

marsh coral
#

๐Ÿ‘‹ happy to help

#

give me a few minutes and will be with you shortly

austere isle
#

Sure, appreciate your help ๐Ÿ™‚

marsh coral
#

unfortunately it's not possible to resend the events that are older than 30 days

austere isle
#

they are just a week old

#

This one for example; event ID: evt_3QprwoKsO9xkCfbk12rdXCmu

marsh coral
#

oh these you can

#

I was talking about the ones you shared earlier (Oct 2024)

austere isle
#

Oh ๐Ÿคฃ what I ment with the ones from 2024, is when I go on the "Event" tab on the workbench, these are the latest that are getting shown

#

on the other hand the "Webhook" tab, gives me the one I need.

#

but, I'm unable to bulk fetch all failed events via the shell:

example is given pzthon code:
`# Fetch failed events for the specific webhook endpoint
failed_events = stripe.Event.list(
delivery_success=False,
)

Resend failed events

for event in failed_events.auto_paging_iter():
if event["id"] in resent_events:
print(f"Skipping already resent event: {event['id']}")
continue

print(f"Resending event: {event['id']}")
try:
    stripe.WebhookEndpoint.resend(event["id"])
    print(f"Successfully resent {event['id']}")

    # Track resent event
    resent_events.add(event["id"])
    with open(TRACKING_FILE, "w") as f:
        json.dump(list(resent_events), f)

except Exception as e:
    print(f"Failed to resend {event['id']}: {str(e)}")`

But dthe data of failed_events is always 0

marsh coral
#

you don't have to resend these events manually. if you've already fixed the issue the events will be sent back to you

austere isle
#

but, the documentation states Stripe is only retrzing to send failed ones for up to 3 days. or am I getting soemthing wrong here ?

marsh coral
#

oh yes you're right

#

I misread the dates

austere isle
#

no worries one of the screenshots above with a latest example wasn't a good example :))

but in case of this one here:
evt_3QprwoKsO9xkCfbk12rdXCmu

#

I can see there's a resend button.

But I have like thousends of those, so I tried to follow the documentation to do a bulk resend

#

events = stripe.Event.list(
delivery_success=False,
)

this code snippet that's given, always returns 0 failed ones

#

Do u have an idea or a suggestion, how I'm able to bulk fetch all the ones that have failed. Because it seems like I'm doing something wrong ๐Ÿฅฒ

marsh coral
#

oh I see the issue now

#

you're listing the events that are undelivered on your own account

#

whereas the events that you are trying to resend are on your connected accounts

austere isle
#

OHHHHH

#

do u know if there's a wildcard to fetch all events from all connected accoutns? or is that something I have to take into account in the shell?

marsh coral
#

but if you have multiple connected accounts you need to fetch for each connected account separately by passing the stripe-account header

austere isle
#

so there's no wildcard for that ๐Ÿฅฒ

#

I see I see, will give it a shot!

austere isle
#

heh, the last thing I would have tried, was using the stripe-account :))

stripe events list --limit="999" --delivery-success=false --stripe-account=acct_1QXOXXXXXXXX

now it also lists the ones that are failed.
and I thought by simple not stating it, it would work as a wildcard.

AHHH, I new I overlooked something ๐Ÿฅฒ

#

thanks for the help tarzan!

#

Do u know if there's a CLI command to fetch all "connected accounts" ?

#

as in getting a list with all their ID's

marsh coral
#

yes

#

so basically you can do that for any resource type

#

you can do stripe accounts list

austere isle
marsh coral
#

sure you too