Skip to content

Vonage-Community/blog-messages-swift_vapor-async_sms

Repository files navigation

How to send SMS Messages with Swift and Vapor using Async/Await

Nexmo is now known as Vonage

This is a Swift project that uses Vapor to create a HTTP server for the Vonage Messages API. This allows you to send an SMS message to a phone number. This blog shows the project in use with a web page to allow you to test the server.

Welcome to Vonage

If you're new to Vonage, you can sign up for a Vonage API account and get some free credit to get you started.

Prerequisites

  • A Vonage API account.

  • Xcode 13 and Swift 5.5 or greater.

  • The Vapor toolbox installed on your machine.

Running the project

After cloning the project to your machine change into the project directory. Add your Vonage API credentials in a .env file by running echo "APIKEY=X \nAPISECRET=Y" > .env in the terminal replacing X and Y with your API key and secret respectively.

Open it in Xcode by running vapor xcode and wait for Xcode to download the packages.

Set a custom working directory for your project. Go to Product > Scheme > Edit Scheme... and set the working directory to the root folder of your project.

Once done, build and run (CMD + R) and the server will be accessible on port 8080.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published