There is just one generic mutation that can handle all message creation. I am unsure how scalable this is. Main benefit I can think of is that we wouldn't need to adjust the graphql layer every time we added a new medium to send messages/notifications with. The more I think about this thought the more unreasonable it feels.
sendMessage(input: SendMessageInput!): Boolean
enum MessageType {
EMAIL
SMS
}
input SendMessageInput {
sender: String
recipient: String!
subject: String
htmlBody: string
message: String
type: MessageType
templateId: ID
organizationId: ID
}
We make a separate mutation for every medium of message/notification sending. Main beneift here is that it is very clear what you are performing. I think as of right now I prefer this one. I like how explicit it is. Because in the end, we are going to make a lot of these messages/notifications event driven anyways (I think), so ideally the 3rd party user won't be using these mutations as often as they will be initially.
sendCustomEmail(input: SendCustomEmailInput!): Boolean
sendTemplateEmailInput(input: SendCustomEmailInput!): Boolean
sendCustomSMS(input: SendCustomSMSInput!): Boolean
sendTemplateSMS(input: SendTemplateSMSInput!): Boolean
input SendCustomEmailInput {
sender: [String]!
recipient: [String]!
subject: String!
htmlBody: String!
}
input sendTemplateEmailInput {
templateId: ID!
locale: Locale!
organizationId: ID!
}
input SendCustomSMSInput {
sender: String!
recipient: [String]!
messsage: String!
}
input sendTemplateSMSInput {
templateId: ID!
locale: Locale!
organizationId: ID!
}