product create webhooks not sending published_at value

Solved

product create webhooks not sending published_at value

akshuklait
Shopify Partner
6 0 2

Hello Everyone, 

if we are creating any new product published on Online store, getting "published_at": null, value,
Here is the latest example

{
  "id": 4540030025809,
  "title": "published product creation",
  "body_html": "test",  
  "created_at": "2020-03-30T12:17:05+05:30",
  "handle": "published-product-creation",
  "updated_at": "2020-03-30T12:17:05+05:30",
  "published_at": null,
  "template_suffix": "",
  "published_scope": "web",
  "admin_graphql_api_id": "gid://shopify/Product/4540030025809",
}
A few days back it was sending value as
"published_at": "2020-03-30T12:16:05+05:30",
Just after product creation, when checking json data #product-id.json,  it's showing proper response as it needs to be 
    "id": 4540036612177,
    "title": "test",
    "body_html": "",
    "vendor": "Dev Store",
    "product_type": "Canned cat food",
    "created_at": "2020-03-30T12:46:07+05:30",
    "handle": "test-10",
    "updated_at": "2020-03-30T12:16:09+05:30",
    "published_at": "2020-03-30T12:16:03+05:30",
    "template_suffix": "",
    "published_scope": "web",
    "tags": "",
Any help would be highly appreciated.
Thanks in advance
Accepted Solution (1)
hassain
Shopify Staff (Retired)
624 104 188

This is an accepted solution.

Hi @akshuklait and @neha4here ,

 

The reason why "published_at" is null in the payload of the "product/create" webhook notification is simply because that product has not been published yet.

 

You can easily confirm this yourself if you subscribe to both the "product/create" and "product/update" webhook topics. When you create a new product, you will get a new webhook notification for the product creation event where the "published_at" field will be null. Then, about 5 seconds later, you will get a new notification for a product update event where the same product that was newly created now has a non-null "published_at" value. The "published_at" value will typically be set to a value that is less than the created_at value, to ensure the product will be published as soon as possible.

 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

neha4here
Shopify Partner
22 1 19

Hi,

 

I am facing the same problem. When getting the product's status from Shopify, not getting the value for published_at key.  It seems a problem in the Shopify webhook.

 

Please help.

Neha Singh | Associate Product Manager & Marketplace Integration Expert @ CedCommerce
If you find the answer helpful, please Like.
If you need any other help or discussion, kindly Comment.
If you think you got the solution, kindly mark answer Accept As Solution.
hassain
Shopify Staff (Retired)
624 104 188

This is an accepted solution.

Hi @akshuklait and @neha4here ,

 

The reason why "published_at" is null in the payload of the "product/create" webhook notification is simply because that product has not been published yet.

 

You can easily confirm this yourself if you subscribe to both the "product/create" and "product/update" webhook topics. When you create a new product, you will get a new webhook notification for the product creation event where the "published_at" field will be null. Then, about 5 seconds later, you will get a new notification for a product update event where the same product that was newly created now has a non-null "published_at" value. The "published_at" value will typically be set to a value that is less than the created_at value, to ensure the product will be published as soon as possible.

 

To learn more visit the Shopify Help Center or the Community Blog.