fcm-rust icon indicating copy to clipboard operation
fcm-rust copied to clipboard

What is the API key supposed to be? No errors are logged.

Open ollyde opened this issue 1 year ago • 0 comments

let env = env_vars();

let client = fcm::Client::new();

let mut map = HashMap::new();
map.insert("title", title);
map.insert("body", body);

if let Some(link) = deeplink {
    map.insert("link", link);
}

let mut builder = fcm::MessageBuilder::new(&env.google_cloud_private_key, token);

match builder.data(&map) {
    Ok(_) => println!("Data added to builder"),
    Err(e) => {
        println!("Failed to add data to builder: {:?}", e);
        return Err(e.into());
    }
}

let message = builder.finalize();

let response = client.send(message).await;
println!("Android Push Notification: {:?}", response);

Ok(())

I get

Android Push Notification: Err(ServerError(None))

ollyde avatar Nov 29 '24 16:11 ollyde