Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(service): add twilio #276

Merged
merged 4 commits into from
Aug 5, 2022

Conversation

svaloumas
Copy link
Collaborator

@svaloumas svaloumas commented May 11, 2022

Description

Adds Twilio (Messaging) service.

Resolves #115

Motivation and Context

Adds a new service to the list of the currently supported ones.

How Has This Been Tested?

Unit tests implemented under service/twilio/twilio_test.go.

Integration tests have been performed using a trial account from Twilio Console.

Sample code to run an integration test.

package main

import (
	"context"
	"log"

	"github.com/nikoksr/notify"
	"github.com/nikoksr/notify/service/twilio"
)

func main() {
	twilioSvc, err := twilio.New("account_sid", "auth_token", "your_phone_number")
	if err != nil {
		log.Fatalf("twilio.New() failed: %s", err.Error())
	}

	twilioSvc.AddReceivers("recipient_phone_number")

	notifier := notify.New()
	notifier.UseServices(twilioSvc)

	err = notifier.Send(context.Background(), "subject", "message")
	if err != nil {
		log.Fatalf("notifier.Send() failed: %s", err.Error())
	}

	log.Println("notification sent")
}

Please find below sample images from the results of the integration tests.

Screenshots / Output (if appropriate):

IMAGE 2022-05-11 17:10:09

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@svaloumas svaloumas force-pushed the feature/add-twilio-service branch 2 times, most recently from 07fd023 to 7a32777 Compare May 13, 2022 18:54
@codecov-commenter
Copy link

codecov-commenter commented May 13, 2022

Codecov Report

Merging #276 (2879767) into main (836eb8a) will increase coverage by 0.81%.
The diff coverage is 64.58%.

@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
+ Coverage   54.62%   55.44%   +0.81%     
==========================================
  Files          14       16       +2     
  Lines         540      588      +48     
==========================================
+ Hits          295      326      +31     
- Misses        222      235      +13     
- Partials       23       27       +4     
Impacted Files Coverage Δ
service/twilio/twilio.go 56.00% <56.00%> (ø)
service/twilio/mock_twilioClient.go 73.91% <73.91%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 836eb8a...2879767. Read the comment docs.

@emmanuelay
Copy link

Why is this not accepted @nikoksr ?

@nikoksr
Copy link
Owner

nikoksr commented Aug 4, 2022

@svaloumas so sorry for the severe delay! I fixed all compatibility issues with main and it looks like we're read to merge.

Since I updated this branche's go.mod, I'd be very thankful if you could quickly verify that the Twillio service you wrote is actually still working with the latest changes.

I greatly appreciate your patience and effort!

@svaloumas
Copy link
Collaborator Author

Hey @nikoksr, no worries at all! I've just tested it once again after pulling your changes and it's still functional. 😄

photo_2022-08-04 23 12 13

@nikoksr nikoksr merged commit 32b9410 into nikoksr:main Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(service): Add Twilio service
4 participants