Skip to content

Deserialization of SendGridMessage #1104

Closed

Description

@sebastienlabine

Hi!

I have multiple microservices that are publishing events to my email service lambda funciton to send their own SendGridMessage. The problem is that I need to be able to serialize the SendGridMessage Class and to deserialize in my email service function.

Currently, I end up with multiple field missing, making it impossible to send my message.

Could we have a function that help us revives the SendGridMessage from a serialized input?

Activity

  1. shwetha-manvinkurke commented on Apr 19, 2021

    @shwetha-manvinkurke
    Contributor

    @sebastienlabine Do you have a code sample that you can share? What fields are missing in the deserialized output?

  2. sebastienlabine commented on Apr 26, 2021

    @sebastienlabine
    Author

    @shwetha-manvinkurke Sorry for the late answer. The most basic example was with

    var message = new SendGridMessage();
    message.AddTo("test@test.com");
    message.SetTemplateId("id");
    message.SetFrom("noreply@test.com");

    If I remember correctly the serialization of the message then Deserialization of the message misses the To and the Template Id.

    As a bypass I send the request generated JSON (with .Serialize()) to my message API then directly send it from the API, however I cannot edit the message afterwards. Maybe implement a Deserialize() method that does the inverse if Serialize()?

  3. thinkingserious commented on Apr 26, 2021

    @thinkingserious
    Contributor

    Hello @sebastienlabine,

    I'm not sure what you mean by "I cannot edit the message afterwards". I'm thinking you would just modify the JSON before sending (example of calling the mail/send endpoint with the raw JSON). Please let me know if that would work for your use case. Thank you!

    With best regards,

    Elmer

  4. sebastienlabine commented on Apr 27, 2021

    @sebastienlabine
    Author

    Thats the current workaround im using. What I mean is you can’t reconstruct the SendGridMessage object from the generated output and then apply other methods on the object because the deserialization is not working correctly!

  5. thinkingserious commented on Apr 27, 2021

    @thinkingserious
    Contributor

    Thanks for clarifying @sebastienlabine!

    This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions