Skip to main content

Nice to meet you, I’m a beginner in pagerduty…I want to Integrate my Arduino/raspberry pi with pagerduty… How to write the syntax for Integration for both Arduino/raspberry pi?.

Hey @wael, what type of integration you’re looking for?


If you want to show something on your arduino/RPI when there’s a new incident, you’d just need to use the REST API with whatever language you want.


Thank you for your support.

I just want to know necessary writing code for the integration code for connecting pagerduty with arduino to send data from Arduino to pagerduty .

I’m planning to use Button/motion sensor with Arduino(wifi)…

by click on the Button/motion sensor the event(data) be sent to Pagerduty.


By the way , could using to pagerduty to light LED ?(click on the Button send request to pagerduty , pagerduty trigger the LED )


@wael, I went around asking for good insights and turns out that one PM at PagerDuty loves Arduino as a hobby for random projects! Here’s what they shared with me after googling about it:




  • Check out this video to understand how to call an external REST API from an Arduino. The repository it refers to some sample code also includes a REST API call (with JSON payload like our API) and receives a response, which could then be modified to do something else (like when a user pushes a button on the Arduino):





Hope that helps with your project. Let us know how it goes!!!


Thank you for your support.

Is there is any example for arduino code ?

I just want to understand how to use Microcontroller to send events to Pagerduty.


Hi @wael.


We don’t currently have a native library for Arduino. Fortunately, PagerDuty events are JSON data sent via HTTP. So you should be able to create the events using something like the ArduinoJson library and send them using an HTTP client library.


This example looks like it could be a good starting place: https://arduinojson.org/v6/how-to/use-arduinojson-with-httpclient/#how-to-send-a-json-document-in-an-http-request


Like in other languages, you’ll want to populate the event elements, serialize them into JSON, and then send that JSON to the PagerDuty events endpoint. Events are simpler than incidents, and you won’t need an authentication key, only your routing_key. You can see more on how to structure events, including the required elements, in the docs.


For your second question, could PagerDuty be used to light an LED, that is possible as well. There would be two methods, depending on how you set up your components. The easiest is probably using a periodic pull-based query from the device managing the light - it could periodically request the triggered incidents on a service and light the LED if there are active incidents. Those requests require an API key and will return a JSON document. You’d send a GET request to https://api.pagerduty.com/incidents. You can filter the included incidents with a number of options, noted in the docs.


Another method could be the use of a webhook, if your controller has a public IP address. In that case, the webhook can be triggered on a number of different actions. The payload is not customizable, however, and can be substantial, so might not be suitable for smaller embedded systems. More on webhooks in the docs.


It would also be possible to put this together without a public IP using Automation Actions, if you are using it already, but that would be quite a large undertaking just to light an LED. The pull-based method is probably the shortest path for you!


Reply