Skip to content

AbraAPI is an API platform designed for seamless integration and management of notifications. Inspired by the Pokémon Abra, it provides robust functionality to register and retrieve notifications effortlessly. Simplify your notification workflows and streamline integrations with AbraAPI.

License

Notifications You must be signed in to change notification settings

SoderJuliano/AbraApi

Repository files navigation

🇺🇸 en-US doc

AbraAPI - Documentation

Release 1.0.0

Description

The AbraAPI is a public API that allows you to register and retrieve notifications for integrations. The name "Abra" is based on the Pokémon Abra, known for its teleportation ability. This API was developed with the aim of providing an efficient and scalable system for managing notifications across different systems or individual profiles within those systems. Through the AbraAPI, you can send, receive, and even mark notifications as read.

Example Usage

Below, we provide examples of using the main methods available in the AbraAPI.

POST - Send Notification Endpoint: /notifications

This endpoint allows you to send a new notification.

Example request:

POST /notifications HTTP/1.1
Host: abra-api.top
Content-Type: application/json

{ 
  "key": "!@ExempleKey",
  "title": "New message",
  "content": "You have received a new message."
}

Example response:

{
  "id": "a462ea672aa0akf4069ac1al",
  "key": "!@ExempleKey",
  "dateCreated": "2023-06-11T13:58:01.916Z",
  "dateUpdated": null,
  "title": "New message",
  "content": "This is a test notification",
  "read": false
}

GET - Retrieve Notifications Endpoint: /notifications/retrieve

This endpoint allows you to retrieve all registered notifications by key.

Example request:

GET /notifications/retrieve?key=!@ExempleKey HTTP/1.1
Host: abra-api.top
Example response:

json

[
  {
    "id": "a462ea672aa0akf4069ac1al",
    "title": "New message",
    "content": "You have received a new message.",
    "dateCreated": "2023-06-11T14:09:49.081Z",
    "read": false
  },
  {
    "id": "a882ea679aa0akf4069ac1aa",
    "title": "Profile update",
    "content": "Your profile has been successfully updated.",
    "dateCreated": "2023-06-11T14:09:49.081Z",
    "dateUpdated": "2023-06-11T14:09:49.081Z",
    "read": true
  }
]

PATCH - Mark Notification as Read

Endpoint: /notifications/a882ea679aa0akf4069ac1aa

This endpoint allows you to mark a notification as read.

Example request:

PATCH /notifications/a882ea679aa0akf4069ac1aa HTTP/1.1
Host: abra-api.top
Content-Type: application/json

Example response:

{
  "id": "6462eb672fa0abf4069bc1a5",
  "title": "Profile update",
  "key": "!@ExempleKey",
  "dateCreated": "2023-06-11T14:05:37.965Z",
  "dateUpdated": "2023-06-11T14:05:37.965Z",
  "content": "Your profile has been successfully updated.",
  "read": true
}

Release 1.0.1

There are two new endpoints:

Endpoint: /notifications/edit

Exeple of request:

PUT /notifications/edit
Host: abra-api.top
{
  "id": "64bc090ad12cb806af38f65e",
  "title": "I`m and edited notification",
  "key": "TheKeyIUsedToRegisterTheNotification",
  "content": "The new content I want put in. :)"
}

Response:

{
  "read": true,
  "appUrl": "site.com",
  "content": "The new content I want put in. :)",
  "key": "TheKeyIUsedToRegisterTheNotification",
  "dateCreated": "2023-07-22T16:51:22.366Z",
  "dateUpdated": "2023-07-22T17:14:28.630Z",
  "id": "64bc090ad12cb806af38f65e",
  "user": "user",
  "title": "I`m and edited notification"
}

Endpoint: /notifications/delete

Example of request:

DELETE /notifications/delete
Host: abra-api.top

{
  "id": "64bc090ad12cb806af38f65e",
  "key": "TheKeyIUsedToRegisterTheNotification",
  "appUrl": "site.com",
  "user": "user"
}

Response:

{
  "content": "Notification 64bc090ad12cb806af38f65e deleted successfully."
}

Final Considerations

The AbraAPI is a powerful API for registering and sending notifications to systems or individual profiles. It provides endpoints to retrieve notifications, send new notifications, and mark notifications as read. Through these functionalities, you can efficiently and effectively manage notifications generated by the integrated systems.

For more informations consult the Swagger documentation https://abra-api.top/api



🇧🇷 pt-BR doc

AbraAPI - Documentação

Versão 1.0.0

Descrição

A AbraAPI é uma API pública que permite registrar e recuperar notificações para integrações. O nome "Abra" é baseado no Pokémon Abra, conhecido por sua habilidade de teletransporte. Esta API foi desenvolvida com o objetivo de fornecer um sistema eficiente e escalável para gerenciar notificações em diferentes sistemas ou perfis individuais dentro desses sistemas. Através da AbraAPI, é possível enviar, receber e até mesmo marcar notificações como lidas.

Exemplos de Uso

A seguir, apresentamos exemplos de uso dos principais métodos disponíveis na AbraAPI.

POST - Enviar Notificação Endpoint: /notifications

Este endpoint permite enviar uma nova notificação.

Exemplo de requisição:

POST /notifications HTTP/1.1 Host: api.abra.top Content-Type: application/json

{ 
  "key": "!@ExempleKey",
  "title": "Nova mensagem",
  "content": "Você recebeu uma nova mensagem."
}

Exemplo de resposta:

{
  "id": "a462ea672aa0akf4069ac1al",
  "key": "!@ExempleKey",
  "dateCreated": "2023-06-11T13:58:01.916Z",
  "dateUpdated": null,
  "title": "Nova mensagem",
  "content": "Você recebeu uma nova mensagem."
  "read": false
}

GET - Recuperar Notificações Endpoint: /notifications/retrieve

Este endpoint permite recuperar todas as notificações registradas.

Exemplo de requisição:

GET /notifications/retrieve?key=!@ExempleKey HTTP/1.1
Host: api.abra.top

Exemplo de resposta:

[
  {
    "id": "a462ea672aa0akf4069ac1al",
    "title": "Nova mensagem",
    "content": "Você recebeu uma nova mensagem.",
    "dateCreated": "2023-06-11T14:09:49.081Z",
    "read": false
  },
  {
    "id": "a882ea679aa0akf4069ac1aa",
    "title": "Atualização de perfil",
    "content": "Seu perfil foi atualizado com sucesso.",
    "dateCreated": "2023-06-11T14:09:49.081Z",
    "dateUpdated": "2023-06-11T14:09:49.081Z",
    "read": true
  }
]

PATCH - Marcar Notificação como Lida

Endpoint: /notifications/{id}

Este endpoint permite marcar uma notificação como lida.

Exemplo de requisição:

bash

PATCH /notifications/a882ea679aa0akf4069ac1aa HTTP/1.1
Host: api.abra.top
Content-Type: application/json

Exemplo de resposta:

{
  "id": a882ea679aa0akf4069ac1aa,
  "title": "Atualização de perfil",
  "content": "Seu perfil foi atualizado com sucesso.",
  "dateUpdated": "2023-06-11T14:09:49.081Z",
  "read": true
}

Versão 1.0.1

Existem duas novas funcionalidades:

Endpoint: /notifications/edit

Exemplo de requisição:

PUT /notifications/edit
Host: abra-api.top
{
  "id": "64bc090ad12cb806af38f65e",
  "title": "Eu sou uma notificação editada",
  "key": "AChaveQueUseiParaRegistrarANotificação",
  "content": "O novo conteúdo que desejo adicionar. :)"
}

Resposta:

{
  "read": true,
  "appUrl": "site.com",
  "content": "O novo conteúdo que desejo adicionar. :)",
  "key": "AChaveQueUseiParaRegistrarANotificação",
  "dateCreated": "2023-07-22T16:51:22.366Z",
  "dateUpdated": "2023-07-22T17:14:28.630Z",
  "id": "64bc090ad12cb806af38f65e",
  "user": "usuário",
  "title": "Eu sou uma notificação editada"
}

Endpoint: /notifications/delete

Exemplo de requisição:

DELETE /notifications/delete
Host: abra-api.top

{
  "id": "64bc090ad12cb806af38f65e",
  "key": "AChaveQueUseiParaRegistrarANotificação",
  "appUrl": "site.com",
  "user": "usuário"
}

Resposta:

{
  "content": "Notificação 64bc090ad12cb806af38f65e excluída com sucesso."
}

Considerações Finais

A AbraAPI é uma API poderosa para o registro e envio de notificações em sistemas ou perfis individuais. Ela fornece endpoints para recuperar notificações, enviar novas notificações e marcar notificações como lidas. Através dessas funcionalidades, é possível manter um controle eficiente e atualizado sobre as notificações geradas pelos sistemas integrados.

Para maiores informações consulte nossa documentação no Swagger https://abra-api.top/api


Running the Project

To run the project, follow these steps:

Clone the repository. Install the dependencies by running npm install. Set up the environment variables by creating a .env file in the root directory and adding the required variables. Start the server by running npm start. Environment Variables The following environment variables are required to run the project:

NODE_ENV: The environment in which the project is running (e.g., development, production). PORT: The port on which the server should listen. MONGO_URI: The MongoDB connection string. JWT_SECRET: The secret key for generating JSON Web Tokens. Versions The following versions are used in the project:

Node.js: 14.21.3 NestJS: 8.0.0 MongoDB: 4.4.12 Installation To install the project dependencies, run the following command:

Insert in Terminal npm install Running Locally

To run the project locally, follow these steps:

Set up the environment variables by creating a .env file in the root directory and adding the required variables.

add the file dev.env in the root folder add the certificates files inside the src folder add private.key inside src as well

Start the server by running npm start.

About

AbraAPI is an API platform designed for seamless integration and management of notifications. Inspired by the Pokémon Abra, it provides robust functionality to register and retrieve notifications effortlessly. Simplify your notification workflows and streamline integrations with AbraAPI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published