expo-notifications not sending notifications from my nodejs server

Please provide the following:

  1. SDK Version:42.0.0
  2. Platforms(Android/iOS/web/all):Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

In my nodejs app I send a request to expo api throught the link: ‘https://exp.host/--/api/v2/push/send’. I use this link to use expo api and send notifications. However I get no notification and instead I just get an error. Below is my code:

async function sendPushNotification(expoPushToken) {

  const message = {

    to: expoPushToken,

    sound: 'default',

    title: 'title!',

    body: `body of the message`,

    data: { someData: 'goes here' },

  };

  try {

    const response = await axios.post('https://exp.host/--/api/v2/push/send', {

      message,

    });

    console.log(response.data);

  } catch (err) {

    console.log('error!');

  }

 
}

This link also does not work locally on my react-native code … does anyone know why it does not work? I don’t know if I need but I added on my app.json the code below according to the docs:

"plugins": [

      [

        "expo-notifications",

        {

          "icon": "./assets/avatar.png",

          "color": "#03a062",

          "sounds": ["default"],

          "mode": "development"

        }

      ]

    ],

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.