0

I am working on an app in Flutter where an influencer can bid for jobs and the employer can either hire or reject them. I need to send push notifications to the employer whenever he receives a bid and to the influencer whenever he is hired or rejected. I need to automate this process like in other apps. How can I do this? Both Influencer and Employer will be using the same app where they will log in as an influencer or Employer.

1 Answers1

0

You have to use Firebase cloud messaging FCM Firebase Cloud Messaging What does it do, in the flutter app get the FCM token of that device and save it somewhere in the backend MySQL database for example or any other database, when ever an influencer bid usually you grab and send that information to the backend that power the app, so after saving the bid in the database, next step you grab the device FCM token of the user you want to notify, you can grab one FCM token or as many as you want and loop through them and send a notification to the device by calling the Firebase project using CURL for example with PHP

curl -X POST --header "Authorization: key=<API_ACCESS_KEY>" \
--Header "Content-Type: application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"to\":\"<YOUR_DEVICE_ID_TOKEN>\",\"notification\":{\"title\":\"Hello\",\"body\":\"Yellow\"}}"

see this answer How can I send a Firebase Cloud Messaging notification

Ridha Rezzag
  • 3,672
  • 1
  • 34
  • 39