Невозможно зарегистрировать удаленный веб-хук в приложении shopify реагировать - PullRequest
0 голосов
/ 27 февраля 2020

// Когда я пытаюсь зарегистрировать удаленный веб-крючок приложения, я получаю сообщение об ошибке ниже, мой код для регистрации удаленного веб-крючка, в то время как другие хуки, которые я создаю, работают нормально

const registrationUninstall = await registerWebhook({
address: `${HOST}/uninstalled`,
topic: 'app/uninstalled',
accessToken,
shop,
apiVersion: ApiVersion.October19
});

if (registrationUninstall.success) {
console.log('Successfully registered uninstall webhook!');
} else {
console.log('Failed to register uninstall webhook', registrationUninstall.result);
}


// This is the error i am getting while i am trying to register uninstalled app webhook:- 

Failed to register uninstall webhook {
errors: [
{
  message: 'Parse error on "/" (error) at [3, 44]',
  locations: [Array]
}
]
}

1 Ответ

0 голосов
/ 28 февраля 2020
If you are going to create shopify react app and want to register uninstall web-hooks all you need to give topic name with capital letters followed by underscore between keywords please refer below code for uninstall web hooks registration :- 

// Uninstalled Web Hook :- 
   const registrationUninstall = await registerWebhook({
     address: `${HOST}/webhooks/uninstalled_app`,
     topic: 'APP_UNINSTALLED',
     accessToken,
     shop,
     apiVersion: ApiVersion.October19
  });

  if (registrationUninstall.success) {
     console.log('Successfully registered uninstall webhook!');
  } else {
     console.log('Failed to register uninstall webhook', registrationUninstall.result);
  }
...