How can I make my node server do something when a ...
# orm-help
j
How can I make my node server do something when a server side subscription event occurs? From the docs, is the web hook the thing that happens in response to a user node being updated?
Copy code
subscriptions:
  userChangedEmail:
    webhook:
      url: <http://example.org/sendSlackMessage>
      headers:
        Content-Type: application/json
        Authorization: Bearer cha2eiheiphesash3shoofo7eceexaequeebuyaequ1reishiujuu6weisao7ohc
    query: |
      subscription {
        user(where: {
          mutation_in: [UPDATED]
        }) {
          node {
            name
            email
          }
        }
      }
https://www.prisma.io/docs/reference/server_side-subscriptions/overview-to1ahf0ob6 Rather than ping a webhook, how can I run a function on my node server?
n
you can do this without server-side subscriptions, by adjusting your mutation resolver at the node server.
j
OK thanks. I also want to create email notifications when posts are replied too. Presumably this requires a server side subscription?
n
Why?
If you want to, you can again modify the mutation resolver at your Node server without using a server-side subscription.
j
OK thanks. What types of things are SSS normally used for then?
n
Sending a POST request to another endpoint in reaction to a specific mutation.