Closed InspectlyMads closed 9 months ago
Hi @InspectlyMads im getting the same error. Have you found a workaround ?
Hi @InspectlyMads im getting the same error. Have you found a workaround ?
For me the issue was my danish timezone. I forked the project and added CultureInfo.InvariantCulture to the eventTimeStamp. My "event_time" now looks like this in TopicManagementResponse.cs:
` [JsonProperty("event_time")] private string EventTimeString { get { return this.EventTimestamp.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss.ffffff000'Z'", CultureInfo.InvariantCulture); }
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Invalid event timestamp. Event timestamp should be a non-empty string");
}
this.EventTimestamp = DateTime.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.None);
}
} `
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
What happened? How can we make the problem occur? This could be a description, log/console output, etc.
I am trying to send notification messages from my backend to the phones, which is working perfectly if I just use the "Notification" in the "Message" class. However when I try to use an AndroidNotification i get the following error: FirebaseAdmin.Messaging.FirebaseMessagingException: Invalid value at 'message.android.notification.event_time' (type.googleapis.com/google.protobuf.Timestamp), Field 'event_time', Invalid time format: Failed to parse input
Relevant Code:
Message message = new Message() { Android = new AndroidConfig() { Notification = new AndroidNotification() { Title = "Test title", Body = "Body test", TitleLocKey = "added_to_project", BodyLocKey = "project", EventTimestamp = new DateTime(2011, 6, 10), }, Priority = 0, }, Data = new Dictionary<string, string>() { {"type", "1"}, }, Token = deviceToken, };