How can I use Node.JS to keep track of faulty responses to send an alert to Slack when it reaches a limit?

Not applicable

I want to know how I can set up a Node.JS proxy that can keep track of faults raised by Apigee and when x amount of faults have been raised in y amount of time.

The reason for this is because I need to be able to receive alerts in Slack when that happens and I mainly found examples of slack bots written in Node.js.

If there is a better way to to this, I'm also open for that as an answer.

1 1 161
1 REPLY 1

Not applicable

Hi @Friso Denijs,

Let's break your question into 2 parts.

#1 How do I send alerts to slack from node.js proxy?

#2 How to keep track of let's say all responses with response code > 4XX?

For #1, you can refer this https://github.com/apigee-webhooks/management-api-facade/tree/91c8755fc3ffe6dba7dbcba852706bfd570f1b... cc @Diego Zuluaga

For #2, you can either use a KVM, Cache or Baas to keep track from your node.js or using the OOB policies.

but I think it is easy for you to use a quota policy with a response code identifier (in the response pipeline or fault rules and then do a proxy chaining to your node.js APIproxy which can send alerts/notifications to slack), that way you don't need to keep track or implement anything else and it does the job for you.

ref: http://docs.apigee.com/api-services/reference/quota-policy.

To keep it simple, don't use distributed and you can receive alerts per MP and you can do the math offline.

Let me know if that helps or let's see if anyone else has any more ideas.