Receive an SMS

Configuration

Set the parameter sms_url on your Virtual Phone Number to https://yourapp.example/elks/sms (or wherever your webhook code is). We'll make an HTTP POST (application/x-www-form-urlencoded) request to this URL every time your number receives an SMS.

Request

POST https://yourapp.example/elks/sms
Example payload
direction=incoming&
id=sf8425555e5d8db61dda7a7b3f1b91bdb&
from=%2B46706861004&to=%2B46706860000&
created=2018-07-13T13%3A57%3A23.741000&
message=Hello%20how%20are%20you%3F

Request parameters

Parameter Description
id The unique id of the message in our systems.
from The sender of the SMS.
to The phone number the SMS was sent to.
message The contents of the SMS.
direction The direction of the SMS. Always ”incoming” for incoming SMS.
created The time in UTC when the SMS object was created in our systems.

Response structure

Your webhook code must respond with a HTTP status in the range 200-204. If not, the API will consider the request failed and keep trying for at least 6 hours and at least 5 times per callback.

Automatic replies

You can optionally reply to the SMS directly in your webhook response, instead of calling POST /sms again seperately. Just put the message directly in the body of your response:

The current time is 08:14.