# ResourceFeedback
The ResourceFeedback resource lets your app report the status of shops and their resources. For example, if
your app is a marketplace channel, then you can use resource feedback to alert merchants that they need to connect their marketplace account by signing in.
Resource feedback notifications are displayed to the merchant on the home screen of their Shopify admin, and in the product details view for any products that are published to your app.
This resource should be used only in cases where you're describing steps that a merchant is required to complete. If your app offers optional or promotional set-up steps, or if it makes recommendations, then don't use resource feedback to let merchants know about them.
Sending feedback on a shop
You can send resource feedback on a shop to let the merchant know what steps they need to take to make sure that your app is set up correctly. Feedback can have one of two states: requires_action
or success
. You need to send a requires_action
feedback request for each step that the merchant is required to complete.
If there are multiple set-up steps that require merchant action, then send feedback with a state of requires_action
as merchants complete prior steps. And to remove the feedback message from the Shopify admin, send a success
feedback request.
Important
Sending feedback replaces previously sent feedback for the Shop. Unlike REST-style APIs, you don't need to make a PATCH or PUT request to update any previously sent feedback. Send a new POST request to push the latest state of a shop or its resources to Shopify.
Formatting the resource feedback message field
If the feedback state is requires_action
, then you can send a string message that communicates the action to be taken by the merchant.
The string must be a single message up to 100 characters long and must end with a period.
You need to adhere to the message formatting rules or your requests will fail:
[Explanation of the problem]. [Suggested action].
Examples:
[Your app name]
is not connected. Connect your account to use this sales channel. [Learn more]
[Your app name]
is not configured. Agree to the terms and conditions to use this app. [Learn more]
Both Your app name
and Learn more
(a button which directs merchants to your app) are automatically populated in the Shopify admin.
Setting feedback permissions
Add the write_resource_feedbacks
permission to your requested scopes.
## Resource Properties
### ResourceFeedback
* created_at: DateTime when the resource feedback record was stored by Shopify.
Type: ISO 8601 UTC DateTime as string with year, month (or week), day, hour, minute, second, time zone.
* Type: x-string
* Example: "2024-09-19 14:10:56 UTC"
* updated_at: DateTime when the resource feedback record was last updated by Shopify.
Type: ISO 8601 UTC DateTime as string with year, month (or week), day, hour, minute, second, time zone.
* Type: x-string
* Example: "2024-09-19 14:10:56 UTC"
* resource_id: Unique id of the resource.
* Type: x-string
* Example: 321
* resource_type: Type of resource for which feedback is returned. eg. Shop, Product.
* Type: x-string
* Example: "Shop"
* state: Indicates the state that the Shop or resource is in, from the perspective of your app. Valid values are requires_action
, or success
.
* Type: x-string
* Example: "requires_action"
* messages:
A concise set of copy strings to be displayed to merchants, to guide them in resolving problems your app
encounters when trying to make use of their Shop and its resources.
Required only when state is requires_action
. Disallowed when state is success
.
Content restrictions for Shop feedback:
one message up to 100 characters long.
* Type: x-string
* Example: ["is not connected. Connect your account to use this sales channel."]
* feedback_generated_at:
The time at which the payload is constructed. Used to help determine whether incoming feedback is
outdated compared to feedback already received, and if it should be ignored upon arrival.
Type: ISO 8601 UTC datetime as string
with year, month [or week], day, hour, minute, second, millisecond, and time zone.
Note
If you queue a Feedback API payload for delivery at a later time, do not update this value
when the API call is actually made; ensure that the current time is set when building the payload.
* Type: x-string
* Example: "2024-09-19T14:10:56.723839Z"
## Create a new ResourceFeedback
Creates shop resource feedback.
### Endpoint
/admin/api/#{api_version}/resource_feedback.json (POST)
### Parameters
* api_version (required):
* feedback_generated_at (required): An ISO 8601 date and time indicating when the feedback was generated by your app.
* messages (required): An array containing a single message.
See
Formatting the resource feedback message field for formatting requirements.
* state (required): Must be one of the following values:
### Responses
#### 202
Create a new ResourceFeedback
Examples:
##### Create a shop feedback record indicating a problem specific to your app
Request:
```
POST /admin/api/unstable/resource_feedback.json
{"resource_feedback":{"state":"requires_action","messages":["is not connected. Connect your account to use this sales channel."],"feedback_generated_at":"2024-09-19T14:13:32.253844Z"}}
```
Response:
```
HTTP/1.1 202 Accepted
{"resource_feedback":{"created_at":"2024-09-19T10:13:32-04:00","updated_at":"2024-09-19T10:13:32-04:00","resource_id":548380009,"resource_type":"Shop","resource_updated_at":null,"messages":["is not connected. Connect your account to use this sales channel."],"feedback_generated_at":"2024-09-19T10:13:32-04:00","state":"requires_action"}}
```
##### Create a shop feedback record indicating the Shop is usable by your app
Request:
```
POST /admin/api/unstable/resource_feedback.json
{"resource_feedback":{"state":"success","feedback_generated_at":"2024-09-19T14:13:30.352855Z"}}
```
Response:
```
HTTP/1.1 202 Accepted
{"resource_feedback":{"created_at":"2024-09-19T10:13:30-04:00","updated_at":"2024-09-19T10:13:30-04:00","resource_id":548380009,"resource_type":"Shop","resource_updated_at":null,"messages":[],"feedback_generated_at":"2024-09-19T10:13:30-04:00","state":"success"}}
```
#### 422
Create a new ResourceFeedback
Examples:
##### Sending an invalid feedback payload returns an error
Request:
```
POST /admin/api/unstable/resource_feedback.json
{"resource_feedback":{"state":"foobar","feedback_generated_at":"2024-09-19T14:13:31.645368Z"}}
```
Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"messages":["State must be one of success and requires_action"]}}
```
#### 409
Create a new ResourceFeedback
Examples:
##### Sending outdated feedback (previous feedback
payload has a greater resource_updated_at value) returns an error
Request:
```
POST /admin/api/unstable/resource_feedback.json
{"resource_feedback":{"state":"success","feedback_generated_at":"2024-09-19T14:13:30.980868Z"}}
```
Response:
```
HTTP/1.1 409 Conflict
{"errors":{"messages":["Feedback request not delivered. Feedback request is older than a previously delivered feedback request."]}}
```
## Receive a list of all ResourceFeedbacks
Returns a list (zero or one) of resource feedback objects.
Important
Note that ids are not returned as part of this request. Records are immutable except when POST replaces them.
### Endpoint
/admin/api/#{api_version}/resource_feedback.json (GET)
### Parameters
* api_version (required):
### Responses
#### 200
Receive a list of all ResourceFeedbacks
Examples:
##### Get a list of resource feedback records for a specific shop
Request:
```
GET /admin/api/unstable/resource_feedback.json
```
Response:
```
HTTP/1.1 200 OK
{"resource_feedback":[{"created_at":"2024-09-19T10:13:29-04:00","updated_at":"2024-09-19T10:13:29-04:00","resource_id":548380009,"resource_type":"Shop","resource_updated_at":null,"messages":["is not connected. Connect your account to use this sales channel."],"feedback_generated_at":"2024-09-19T09:13:29-04:00","state":"requires_action"}]}
```