GraphQL API

The GraphQL API gives you full creative control of AnnounceKit to build customized solutions for your application.

Client

The API can be explored by using the GraphiQL IDE.

Endpoint

The GraphQL API has a single endpoint that returns flexible data structures, and it remains constant no matter what operation you perform.
https://announcekit.app/gq

Authentication

To communicate with the GraphQL API, you need to supply Basic Authentication token in request Header, or you can use your login Cookies (sesid, sesid.sig).
After singing-in to Dashboard, you can use GraphiQL IDE without supplying Basic Authentication token or any Cookies.

Reference

API Reference is automatically generated from GraphQL schema and can be explored from GraphiQL IDE’s Documentation Explorer section.

Tutorial

How to create a post with the GraphQL API?

Creating AnnounceKit post using GrapQL API is very easy.
Initially, make sure that you have created a project and authenticated to the GraphQL API.

Step 1. Get project id

Firstly, You need the id of the project. You’ll use it to retrieve labels and create a post.

Run Query

{
  me {
    active_project {
      id
      name
    }
  }
}

As a result, you get the id and name of the project. Please check the name field to make sure that you have the correct project.

{
  "data": {
    "me": {
      "active_project": {
        "id": "2672",
        "name": "Awesome App"
      }
    }
  }
}

Step 2 (Optional). Get labels

If you want to attach labels to the post, you need id of the label. Labels in the post are optional.

Run Query

{
  labels(project_id: 2672) {
    id
    name
  }
}

Here you get a list of the labels that you have created and the default ones. You’ll use these id fields in the following step.

{
  "data": {
    "labels": [
      {
        "id": "5442",
        "name": "fix"
      },
      {
        "id": "5443",
        "name": "announcement"
      },
      {
        "id": "5444",
        "name": "improvement"
      }
    ]
  }
}

Step 3. Publish post

At this step, you’ll combine all the values that you get and finally create a post.

These arguments are required project_id, title, body

You can use some basic HTML tags in the body argument. By default, a post will be created as a draft, so if you want to publish it, please set is_draft argument as false.

Please check API Reference for all mutation savePost arguments and detailed usage.

Run Query

mutation {
  savePost(project_id: 2672, title: "Test", body: "<h2>Hello World</h2>", labels: [5442, 5443], is_draft: false) {
    id
  }
}

As a query result, you get the id of the created post.

Feel free to write us in chat, or email to support@announcekit.app if you need any assistance or have questions.