Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/web-ridge/sns_ses
Amazon SQS (Message Queuing Service) golang convert and parse to json structs of notification-contents of the Amazon SNS message of the Amazon SES service (Amazon Simple Email Service)
https://github.com/web-ridge/sns_ses
Last synced: 3 days ago
JSON representation
Amazon SQS (Message Queuing Service) golang convert and parse to json structs of notification-contents of the Amazon SNS message of the Amazon SES service (Amazon Simple Email Service)
- Host: GitHub
- URL: https://github.com/web-ridge/sns_ses
- Owner: web-ridge
- License: mit
- Created: 2021-05-27T10:14:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-27T11:08:34.000Z (over 3 years ago)
- Last Synced: 2024-06-20T05:08:40.166Z (5 months ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sns_ses
Amazon SQS (Message Queuing Service) golang convert and parse to json structs of notification-contents of the Amazon SNS message of the Amazon SES service (Amazon Simple Email Service)
[amazon/notification-contents](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html#top-level-json-object)# Bindings for
- Received Mail
- Bounce
- s3 Receipt
- Complaint
- Delivery## Example
```golang
func handlePubSubMailMessage(ctx context.Context, msg *sqs.Message) error {
body := &sns_ses.Body{}
err := json.Unmarshal([]byte(*msg.Body), &body)
if err != nil {
return err
}message := &sns_ses.Message{}
err = json.Unmarshal([]byte(body.Message), &message)
if err != nil {
return err
}
switch message.NotificationType {
case sns_ses.NotificationTypeBounce:
case sns_ses.NotificationTypeComplaint:
case sns_ses.NotificationTypeDelivery:
case sns_ses.NotificationTypeReceived:
messageContent, err := incomingMailS3.GetObject(&s3.GetObjectInput{
Bucket: aws.String(message.Receipt.Action.BucketName),
Key: aws.String(message.Receipt.Action.ObjectKey),
})}
}
```## Extra
If you want to strip signature and quoted-replies from the received message you could use another library we made: [web-ridge/email-reply-parser](https://github.com/web-ridge/email-reply-parser)