Swiftpack.co - Package - FabrizioBrancati/SwiftyBot

SwiftyBot Banner

Build Status codebeat badge Version Language Platform License


What does it doCompatibilityLanguage supportRequirementsCommunicationContributingInstalling and UsageDocumentationChangelogDemoTodoAuthorLicense


What does it do

SwiftyBot is an example on how to create a Telegram & Facebook Messenger bot with Swift using Vapor.
See Compatibility section to check service and version it supports, you can also see its blog post with the link in that table.

Compatibility

| Bot Type | Version | Blog Post Link | |--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------| | Telegram | 1.0...1.2 | How to create a Telegram bot with Swift using Vapor on Ubuntu / macOS | | Facebook Messenger | 2.0...2.3 | How to create a Facebook Messenger bot with Swift |

Language support

  • English (en)

Requirements

  • Ubuntu 14.04 or later with Swift 4.0 or later / macOS with Xcode 9.0 or later
  • Telegram account and a Telegram App for any platform (Telegram bot only)
  • Facebook account and a Facebook Messenger App for any platform (Facebook Messenger bot only)

Communication

  • If you need help, open an issue.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, see Contributing section.

Contributing

See CONTRIBUTING.md file.

Installing and Usage

Telegram

  • Install Swift on your computer / server
  • Install Vapor Toolbox (Optional)
  • Set a secret key in secrets/app.json
  • Enable TLS (You can use Let's Encrypt)
  • Use Apache or nginx as reverse proxy
  • Create a Telegram bot with BotFather
  • Use Supervisor to ensure your bot is always running

If you need more help through this steps, you can read How to create a Telegram bot with Swift using Vapor on Ubuntu / macOS blog post.

Facebook Messenger

  • Install Swift on your computer / server
  • Install Vapor Toolbox (Optional)
  • Set a secret key in secrets/app.json
  • Enable TLS (You can use Let's Encrypt)
  • Use Apache or nginx as reverse proxy
  • Create a Facebook App and Page
  • Get a Page access token and add it to secrets/app.json
  • Use Supervisor to ensure your bot is always running

If you need more help through this steps, you can read How to create a Facebook Messenger bot with Swift blog post.

Documentation

Every line of main.swift file is commented.
If you need Vapor documentation you can find it here.
If you need Telegram bot documentation you can find it here.
If you need Facebook Messenger bot documentation you can find it here.

Changelog

To see what has changed in recent version of SwiftyBot, see the CHANGELOG.md file.

Demo

Telegram

You can open Telegram and search for SwiftyBot and start talking with him!

Facebook Messenger

You can open Facebook and search for SwiftyBotMessenger and start talking with him!

Todo

  • [ ] Add tests
  • [ ] Add more functions and commands
  • [ ] Add support for edited messages
  • [ ] Add support for deleted messages
  • [ ] Add support for images
  • [x] Include BFKit-Swift dependency

Author

Fabrizio Brancati

Website: https://www.fabriziobrancati.com
Email: fabrizio.brancati@gmail.com

Icon

Roberto Chiaveri

Website: http://robertochiaveri.it

License

SwiftyBot is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 174
Help us keep the lights on

Releases

2.3.3 - May 5, 2018

SwiftyBot 2.3.3

5 May 2018

Added

  • Added messaging_type string in JSON response

2.3.2 - May 3, 2018

SwiftyBot 2.3.2

4 May 2018

Improved

  • Updated SwiftLint to 0.25.1
  • Updated Facebook Graph API to 3.0
  • Updated with Swift 4.1 compatibility
  • Updated BFKit-Swift to 3.1.x

2.3.1 - Feb 18, 2018

SwiftyBot 2.3.1

18 Feb 2018

Added

  • Added Hound CI

Improved

  • Updated SwiftLint to 0.25.0
  • Improved Config/secrets/ folder explanation #5

Thanks to @n0an for this release

2.3.0 - Sep 23, 2017

SwiftyBot 2.3.0

23 Sep 2017

Added

  • Added support for Swift 4

Improved

  • Updated Facebook Graph API to 2.10
  • Updated BFKit-Swift to 3.0.x
  • Updated SwiftLint to 0.22.0

2.2.0 - May 21, 2017

SwiftyBot 2.2.0

21 May 2017

Improved

  • Updated Facebook Graph API to 2.9
  • Updated Vapor to 2.0.x
  • Updated BFKit-Swift to 2.3.x
  • Updated with Swift 3.1 compatibility
  • Updated SwiftLint to 0.18.1