After reading this article, you’ll know how to set up SMS messaging using MessageBird’s API.
Before we start, we’ll need to create a model in our data model for our text messages. If you don’t know how to do this, you can find out here: HowTo create models?
In any case, your model will need a message property, as well as an originator property and a recipients property. Once you’ve created your model, you can start by going to the Webservices page by going to Tools > Webservices.
Press the blue + New button to create a new Webservice.
Here you can configure your webservice. MessageBird requires you to use the HTTPS protocol, so set your protocol to HTTPS. You’ll also need to set your host to “rest.messagebird.com” and Response Content-Type and Request Content-Type to JSON. Last, but certainly not least, we’ll need to provide our authorization code. We can do this by creating a new header called Authorization. Set its value to “AccessKey APIkey”, replacing APIkey with your API key. You can find out how to find your API key on MessageBird's Docs. Save it and we’re halfway done with our webservice!
In order for our Webservice to work, it needs an Endpoint. Let's make one! You can create one by clicking on the plus button next to the endpoints button in the top right of your webservice or by clicking on endpoints and pressing + New.
Let’s configure our endpoint! Start by giving it a good name and changing its method to Post. You can leave everything else here to its default, apart from the body variables. You’ll need to create 3 variables here: body, originator and recipients. Make sure to spell them correctly, as they won’t work if you make a typo!
We’re almost done! All we need now is an Action, and somewhere to send it from. Let's start with the action. Once you’re on the Actions page, you can create a new action by pressing the blue + New button in the top left.
Give it a name and make sure to set it to manual (For now! You can automate text messages by changing this to your needs later.) and unchecking the “Background” box. This will make it easier to fix any mistakes you make. Save your action and you’ll now be able to define what the action will do. Press the + button to create a new action event.
Set your action event to be an HTTP request. If you don’t have any other webservices, it should automatically set itself to your MessageBird service. If not, you’ll have to manually select them under the Webservice and Webservice Endpoint fields. In your body, you’ll see the body variables you’ve previously created. Set them to your model’s variables, and you’re done! Save your action, and let’s start using it!
In order to send an SMS, we’ll have to create a grid of SMS messages in our Back Office. You can go there by clicking its icon on the builder bar.
Press E to head into builder mode when you’re in the Back Office. You can add a grid on the left of the page.
Select your SMS model and press save. Press E to get out of builder mode again. You’ll have to create your first SMS so that you’ve got something to send.
Once you’re done, re-enter builder mode (E) and click on your newly created message. You can now add your action on the right! Do so, and press E to exit builder mode again. You can now send your SMS message by clicking on that button!