Managing posts with an API

Learn how to fetch and create posts with the Notification Feed API

Introduction

You want to be able to manage your Notification Feed posts externally outside of Eager's dashboard. You can do this with the Notification Feed API.

Requirements

To use the Notification Feed API, you will need to know how to programatically make HTTP requests with your programming language of choice.

In these examples, we will use cURL to illustrate the HTTP call as cURL is commonly used and understood.

You will also need an API key to access your Notification Feed.

Getting An API Key

First, go to the Notification Feed you want to access by API in the Eager dashboard, and then click on the API menu:

Click on New API key to create a new API key.

You will need to specify the permission level for your key:

For example, you can specify that the key can only be used for reading posts, for writing, or for both.

Read permissions: Allows access to read all Notification Feed posts for the current feed.

Write permission: Allows writing and deleting all Notification Feed posts for the current feed.

Once you click on Save, you will be shown the API key. Keep this API key in a safe place and do not share with third parties unless you trust them (eg. Zapier).

Important! Your API key is not meant to be used client side. In other words, do not use your API within your JavaScript code. This is a security risk and exposes your API key to the public.

Making Requests

Our API url is at https://api.eagerapp.net. The following endpoints are available for the Notification Feeds:

  • GET /v1/notification_feeds/[feed_id].json (Gets existing posts)
  • POST /v1/notification_feeds/[feed_id]/posts.json (Creates a new post)

To access the endpoints, you must replace [feed_id] with your specific feed ID. You can find the feed ID in the URL in Eager's dashboard.

To make a request, the API endpoint performs an authentication against the header value of X-Api-Key, which you set as the secret key from the previous step.

Here is an example cURL request:

curl --header "Content-Type: application/json" \                                   
  --header "X-Api-Key: yourkey" \          
  --request POST \
  --data '{"post": {"title": "My Title", "content": "Hello World", "published": true}}' \
  https://api.eagerapp.net/v1/notification_feeds/[feed_id]/posts.json

Replace yourkey with your actual key, and [feed_id] with your feed's ID.

Creating Posts

The parameters you can set in your posts are as follows:

  • title [String]
  • content [String, can contain HTML]
  • scheduled_at [Date, in ISO 8601 format
  • published [Boolean of true or false]

Did this article help?

Thank you for your feedback