App reviews, troubleshooting, and recommendations
Hello everyone,
I am trying to provide extraHeaders in the Shopify REST Client, when I do requests, to verify the call at my HTTPS endpoint. For some reason it dosen't work though. I am fairly new to JS and Shopify, so if someone could maybe help me out, I would appreciate it.
const extraHeaders = {
headers:
{'Server-Authentication': 'xxxxxxxxxx'}
};
export async function createWebhook(shop, token) {
const baseUrl = getBaseUrl(shop);
const url = baseUrl+'/admin/api/2021-07/webhooks.json';
const body = {
"webhook": {
"topic": "products/update",
"address": "https://www.xxxxxxxxx.com/api/webhooks/",
"format": "json"
}
}
try{
const client = new Shopify.Clients.Rest(shop, token);
const result = await client.post({
path: 'webhooks',
data: body,
type: DataType.JSON,
extraHeaders: extraHeaders,
});
console.log(result);
return result;
}catch(err){
console.error(`Error creating a new Webhook: `, err)
}
}
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024