Sipgate API: Send SMS via simple Webhook

Anyone who wants to test their systems for availability cannot avoid a type of monitoring. healthchecks.io, for example, is ideal for this use case. Unfortunately Healthchecks.io does not offer a service for Sipgate here, but a possibility to set up a webhook.

Only with this webhook it is possible to send an SMS using the Sipgate API. How to do that, I'll explain in this small blog post.

Sipgate API

Method:

  1. Apply for a personal access token at: https://app.sipgate.com/w0/personal-access-token
  2. Oauth-2 Scope: sessions:sms:write
  3. Personal Access Token of the form: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  4. Token ID in the overview of the form: token-XXXXXX

Screenshot sipgate.de (Source: Screenshot 2.11.2021)
Assign an Name for your token. 
Oauth2-Scope: sessions:sms:write

he authentication to the API works with Basic-Auth. The Basic-Auth String is just a concatenation of username and password, delimted by :  This token can be generated from password and user name like below in any sophisticated OS:

echo -n "token-0A0AAA:12345678-1234-1234-1234-1234567890ab" | openssl base64

you'll get something like this: dG9rZW4tMEEwQUFBOjEyMzQ1Njc4LTEyMzQtMTIzNC0xMjM0LTEyMzQ1Njc4OTBhYg== as the Basic-Auth String. This string has to be built in into the header of your request.

Accept: application/json
Authorization: Basic dG9rZW4tMEEwQUFBOjEyMzQ1Njc4LTEyMzQtMTIzNC0xMjM0LTEyMzQ1Njc4OTBhYg==
Content-Type: application/json

Pay attention to the new lines. Always a new line for one header type.

At Healthchecks.io it should look like this:

Webhook healthchecks.io

{
  "smsId": "s0",
  "recipient": "+49123456789",
  "message": "$NAME went $STATUS at $NOW",
  "sendAt": -1
}