Receive Inbound SMS With Go
In a previous post, we showed you how to send an SMS with Go. This post will show you how to receive SMS messages with your Vonage virtual number. A publically accessible webhook is required and configured with your Vonage account to receive an inbound SMS. To complete this tutorial, you need a Vonage API account and a virtual phone number. You can find the code used in this tutorial on our Go Code Snippets Repository. The tutorial covers the process of setting up a publically accessible webhook, and the functionality to receive inbound SMS messages. Ngrok is used to expose the project to the internet. To test the setup, you need to purchase a Vonage virtual phone number, configure your Vonage account, and run the code in a new Terminal window. The code listens for any request sent to the /webhooks/inbound-sms endpoint and outputs the msisdn and text part of the body of the request. With Ngrok already running, you can test the webhook by sending an SMS to your virtual number. The webhook receives more fields than are displayed above, including the API key, message ID, and timestamp.
Company
Vonage
Date published
Nov. 3, 2020
Author(s)
Greg Holmes
Word count
880
Language
English
Hacker News points
None found.