Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhooks data without updated/created item reference (id) #9518

Closed
3 tasks done
nazariydj opened this issue Nov 5, 2021 · 5 comments · Fixed by #10272
Closed
3 tasks done

Webhooks data without updated/created item reference (id) #9518

nazariydj opened this issue Nov 5, 2021 · 5 comments · Fixed by #10272
Assignees
Labels

Comments

@nazariydj
Copy link

nazariydj commented Nov 5, 2021

Preflight Checklist

Describe the Bug

When I get a webhook data I'm unable to know which item and by who was updated/created. Payload contains only edited fields data (no id, no user_updated / user_created informations).

{ "collection": "video", "payload": { "date_created": "2020-09-01T16:02:17+02:00" }

To Reproduce

  1. enable webhook for some collection
  2. edit item
  3. display body payload data

Errors Shown

No response

What version of Directus are you using?

9.0.0

What version of Node.js are you using?

16.13.0

What database are you using?

MySQL

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying Directus?

Docker

@rijkvanzanten
Copy link
Member

@nickrum I believe this is an easy fix. Instead of pulling all this from the payload, it should pull the accountability etc information from the meta instead:

const webhookPayload = pick(data, [
'event',
'accountability.user',
'accountability.role',
'collection',
'item',
'action',
'payload',
]);

@eliteproxy7

This comment has been minimized.

@rijkvanzanten

This comment has been minimized.

@WayneEld
Copy link
Sponsor

WayneEld commented Nov 15, 2021

Seems to be still happening in 9.0.1 and seems to be sending the same limited informationl.
e.g { "payload" : { "name" : "Hi there" }, "collection" : "clients" }

No id of item altered.

@felixvo
Copy link

felixvo commented Nov 15, 2021

@nickrum I believe this is an easy fix. Instead of pulling all this from the payload, it should pull the accountability etc information from the meta instead:

const webhookPayload = pick(data, [
'event',
'accountability.user',
'accountability.role',
'collection',
'item',
'action',
'payload',
]);

Should item now be key and keys according to

| `(<collection>.)items.create` | The new item | `collection` |
| `(<collection>.)items.update` | The updated item | `keys`, `collection` |
| `(<collection>.)items.delete` | The keys of the item | `collection` |
| `<system-collection>.create` | The new item | `collection` |
| `<system-collection>.update` | The updated item | `keys`, `collection` |
| `<system-collection>.delete` | The keys of the item | `collection` |

felixvo pushed a commit to felixvo/directus that referenced this issue Nov 16, 2021
felixvo added a commit to felixvo/directus that referenced this issue Nov 16, 2021
fix: missing action and item id in webhook data (directus#9518)
goggi added a commit to crawlyfi/directus that referenced this issue Dec 1, 2021
fix: missing action and item id in webhook data (directus#9518)
felixvo pushed a commit to felixvo/directus that referenced this issue May 19, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
6 participants