What is the best way to authorize calls to the shopify Admin API within a webhook handler

CarBar
Shopify Partner
11 0 2

I am creating a webhook handler (within aws lambda) for my shopify app.

 

Note: I'm using eventbridge to receive webhooks, but i believe the concept is the same.

 

When a customer creates a new order this webhook will be called, and from within my webhook handler i would like to make an authenticated request to the Nodejs `@shopify/shopify-api` Admin API.

My question is, what is the best way to do this?

For example, how do i use the details from the webhook event to create a session which i can then use to make requests to the Admin API?

eg;

const product = await shopify.rest.Product.find({session, id: '7504536535062'});

product.title = 'A new title';

await product.save({
update: true,
});



Replies 0 (0)