Webhook won't appear

Shopify Partner
9 0 0

Hi, im making an app using  Sandeepshetty Shopify API to register a shipping service and two webhooks, one when uninstalled the app and the other to read orders when are fulfilled.

The shipping service is registered, but when the webhook is registered it looks fine, but using postman to confirm that they are registered throw me this even given the id of the webhook.

{"webhooks":[]}

This is the code

<?php

	require 'vendor/autoload.php';
	use sandeepshetty\shopify_api;
	
	$db = new Mysqli("localhost", "user", "pass", "database");
	
	$data_settings = $db->query("SELECT * FROM tbl_usersettings");
	$shop_data = $data_settings->fetch_object();
	
	$select_settings = $db->query("SELECT * FROM tbl_appsettings");
	$app_settings = $select_settings->fetch_object();
	
	$shopify = shopify_api\client($shop_data->store_name, $shop_data->access_token, $app_settings->api_key, $app_settings->shared_secret);
	
	//carrier
  	$carrier = array
  	(
  		"carrier_service" => array
  		(
  			"name" => "99minutos.com",
  			"callback_url" => "http:/carrierservice.com/shopify/shippingrates.php",
  			"format" => "json",
  			"service_discovery" => true
  		)
	);
	
	//registro webhook shipping
    $fulfill = array
    (
    	"webhook" => array
    	(
    		"topic" => "orders/fulfilled",
			"address" => "http://carrierservice.com/shopify/webhookshipping.php";,
			"format" => "json"
		)
	);
	
    //webhook uninstall
    $uninstalled = array
    (
    	"webhook" => array
    	(
    		"topic" => "app/uninstalled",
			"address" => "http://api.99minutos.com/shopify/webhookuninstalled.php";,
			"format" => "json"
		)
	);
	
	//Carrier
	$carrier_services=$shopify('POST', '/admin/carrier_services.json', $carrier);
	echo '<pre>'; print_r($carrier_services);echo '</pre>' ;
	
	//webhook Shipping
	$webhookfulfill = $shopify('POST', '/admin/webhooks.json', $fulfill);
	echo '<pre>'; print_r($webhookfulfill);echo '</pre>' ;
	
	//webhook uninstall
	$webhookuninstalled = $shopify('POST', '/admin/webhooks.json', $uninstalled);
	echo '<pre>'; print_r($webhookuninstalled);echo '</pre>' ;
?>

Greetings!

0 Likes
Shopify Staff
Shopify Staff
591 0 45

Are you using your AccessToken when trying to get that list of webhooks? If you aren't using the access token then you won't be able to see them. Webhooks are scoped to the permission that created them in order to prevent applications from stepping on eachother.

0 Likes
Highlighted
Shopify Partner
9 0 0

Thanks, I had forgotten to put the access token. 

Everything works fine

0 Likes
New Member
11 0 0

@Saul

 

Can you post that whole code after adding the access token?

0 Likes