Installation and first steps

Once installed on the server

Basic installation:

  1. Clone into your server folder the PushApi repository and configure your vhosts.
  2. Run composer install in order to add all required dependencies to the project.
  3. If you have not Redis installed in your server, install it after doing anything else.
  4. Remove "SAMPLE" for the config file "config.php.SAMPLE" and update it with your server configurations.
  5. Create a folder in "/var/logs/" called "pushapi" and give it the right permissions. In this folder will be stored all logs generated by PushApi. You can change it on "config.php" file.

Verifying if it works

You can try if it works, just follow this steps:

  • Open the development log file with tail: "tail -f /var/log/pushapi/development-errors.log".
  • Do a request to the API like: http://pushapi.dev/app (note that pushapi.dev is the domain that I have set in my "/etc/hosts" file).
  • Check if log displays some messages or try it with an app like Postman or Insomnia to see if there are an error message printed.

Once installed...

If you have installed the Push API, you possibly don't know which are the following steps, here are the basic steps that you should know or take care:

  1. All the calls of the API need to be done with an app authentication and this can be done creating an app. The first step is create an app and get the information returned (now you can generate the authentication).

  2. The following step is to create themes. This will make you think which notifications you want to generate and what targets it will have (choose the correct range).

  • Unicast range to send to a user.
  • Multicast range to send to a group of users that are following a channel.
  • Broadcast range to send a notification to all users (i.e. newsletter).
  1. Create some channels. Each channel is a group of interested users that wants to receive notifications about that channel.

  2. Create users, that will force to add an email to the user because it is required for the registration. It can be added users massively sending various emails separated by comma.

With this steps you can now send notifications to unicast and broadcast themes because it is set, as default, that if users haven't set its preferences foreach theme, they will receive notifications for all the available devices.

Once the basic steps are done, it is recommended to finnish the database configuration:

  1. If it is known which channels each user wants to receive information, it can be created subscriptions for each one of them.

  2. Also if it is known users preferences.

In order to have a better explanation of the mail subjects, it can be set the translations of the theme names. For each one it should be created a new subject.

📘

Important for Android and iOs apps

When the app gets the registration id from their servers, they should send to the Push API the new identifications or the notifications won't reach its targets.

Once all these steps are done, the API is correctly initialized. It can store the notifications with the send route. In order to send the stored notifications, workers should be running.