#Nukesforbreakfast

1 messages ยท Page 1 of 1 (latest)

crisp spindleBOT
reef stump
#

No, it's not possible to have an event only sent to specific endpoint

latent sail
#

interesting. Alright. Would be a nice feature.

latent sail
#

is there a universal way to add differentiating metadata to an event? It doesn't seem like all events have a metadata object.

reef stump
#

Metadata is on the object, but not event. One way I can think of is to add the query parameter to your endpoint and differentiate where it comes from

latent sail
#

sorry, I'm not sure I understand.

#

what do you mean by

add the query parameter to your endpoint

reef stump
latent sail
#

are you saying I can add an arbitrary query parameter to my webhook endpoint URL that I configure in Stripe?

#

oooooh, so I can just add ?source=whatever on the end of the URL and stripe accepts it

#

now that's interesting. That might be the ticket.

reef stump
#

Yup! You may give it a try ๐Ÿ˜„

latent sail
#

Ok, I'll give this a shot. I'll have to see if I can wrangle AWS API gateway to inject that somewhere. It was hell trying to preserve the raw body for signature verification. ๐Ÿ˜…

reef stump
#

Sounds good!

latent sail
#

wait, how will that help? If all events go to all endpoints, the query string doesn't really differentiate anything, right? Say I trigger a fixture to send a payment_intent.succeeded event, that will still be sent to each endpoint and each endpoint will have their own source query string.

#

I need something to say X event trigger is really only for Y endpoint.

vast magnet
#

Hi @latent sail I'm taking over

#

As river explained before, the event will be sent to all webhook endpoints that listen to that type of events.

latent sail
#

right, so I'm not sure how adding a querystring to the configured endpoint URL helps.

#

I'm seeing a possible solution, maybe.

#

similar to the CLI's override method, perhaps I can inject a specific idempotency key or request ID to differentiate the events?

vast magnet
#

Let me clarify the requirements. So you want to set up different webhook endpointss that listen to different events? for example

  • endpoint A -> listens to payment_intent.succeeded
  • endpoint B -> listens to payment_intent.payment_failed
latent sail
#

not quite.

#

I have a set of code/AWS services used to validate and route webhook events to the right consumers along with validating the signatures.

Right now I have it such that a copy of this app is spun up any time a new PR is opened, and integration tests run against that copy. This copy gets its own webhook endpoint, but the events configured will be shared since it's currently done via IAC with Terraform.

So if I have branches fix/some-fix and chore/some-other-update both open with PRs, there will be one webhook endpoint for each branch, with each configured to listen to payment_intent.succeeded.

#

The goal is to be able to differentiate a payment_intent.succeeded event triggered by the automated tests on the fix/some-fix branch from the same type of event triggered by the automated tests on the chore/some-other-update branch.

#

In some cases I could use metadata, but a metadata hash doesn't appear to be available for all the event types I'm listening for.

vast magnet
#

The metadata is included in the event data. Do you have a event ID that I can take a look?

latent sail
#

one second

#

"evt_1MZoYwPkS2isW7rh5IA2rVfa"

#

this event doesn't seem to contain any metadata, nor have any way of adding it.

vast magnet
#

And do you have the ID of the request that set a metadata?

latent sail
#

the request that triggered that event?

#

I used stripe trigger from the CLI for that one.

vast magnet
#

No, the request you made to set a metadata

#

What's the command?

latent sail
#

stripe trigger account.application.deauthorized

vast magnet
#

I don't see you specify any metadata here.

latent sail
#

because there's no field to specify the metadata on the object of the event.

#

that's the object.

#

can the event itself have metadata?

vast magnet
#

One sec, are you only interested in the account.application.deauthorized event?

latent sail
#

no, there are multiple types of events I'm testing. I'm wondering if there's a generic solution to be able to differentiate between what triggered each event.

In some objects I can set metadata, like payment_intent.succeeded: stripe trigger payment_intent.succeeded --add payment_intent:metadata.test="local-test"

vast magnet
#

OK. The payment_intent has a metadata and you'll find it in webhook event if the metadata is set

latent sail
#

yep, but what about for objects that don't support a metadata hash?

vast magnet