Subscription reason in request body? Or some other...
# support
k
We're implementing some subscription based workflows using webhooks. When the subscription is received on the server, it looks like we only get the resource in the request body. Is it possible to see the subscription resource that actually fired the notification? Thanks in advance!
f
Hi @kylependergast , yea you should be able to get the Subscription in the Bot from the header
X-Medplum-Subscription
that gets set. ex.
Copy code
export async function handler(medplum: MedplumClient, event: BotEvent): Promise<any> {
  const subscriptionId = event.headers?.['X-Medplum-Subscription'] as string;
  //...

}
l
hey there! I actually see a body payload on new records, along with the headers. Something I'm not seeing however is update from my
Subscription
to my webhook when a record changes. Specifically, I'm trying to keep my
Organization
records sync'd to an database via webhook and I'm not seeing evetns after that initaly creationg. Any idea why that might be @finnbergquist ?
i
@lazybaer are you using any extensions on your subscription like the following? https://www.medplum.com/docs/subscriptions/subscription-extensions#subscriptions-for-create-only-or-update-only-events. By default you should see the subscription fire for both
create
and
update
events
l
hey @Ian Plunkett I think this was, indeed, my root problem: https://discord.com/channels/905144809105260605/1478510857616097321/1478879318724710512
thanks for following up! That was definitely it!
55 Views