Send message to target.
Request
POST https://mapi.moreify.com/api/v1/sendSms
parameter | type | info | description |
---|---|---|---|
project | string | required | Project identifier of the project you would like to send a message for. The value of the identifier is configurable in your project settings. |
password | string | required | The related password/token for the project. You can find it in your project settings. |
phonenumber | string | required | Recipient phone number the message shall be sent to. This must be in international format, example +43 or 0043 for Austria or +1 for USA. |
message | string | required | Text which will be sent to the recipient. If the message exceeds the maximum SMS text length of 160 characters, it will be split in several parts. Each part is sent separately. UTF-8 encoding is allowed but may also result in splitting the message into parts. |
verifycode | string | optional 4 characters | The 4 digit code used for verification. |
tag | string | optional max. 50 characters | String which allows you to tag this specific message. E.g. an unique identifier from your side or some sort of grouping information, like a specific promotion id, name ... It gets returned in the response. |
group | string | optional | Group identifier of the address book group. If provided, the message will be sent to all recipients of the group. |
Response
The response will be in a JSON format!parameter | type | info | description |
---|---|---|---|
success | boolean | true|false Whether the message was processed successfully or not | |
message-identifier | string | 40 characters | Uniquely identifies the message on our gateway. |
tag | string | optional | If you provided the tag in the send request, we will send it back to you. |
messages | array | optional | If you sent the message to a group, you will receive a message identifier and a result string for each single recipient in this parameter. |
Examples
<?php
$apiUrl = "https://mapi.moreify.com/api/v1/sendSms";
$postParams = array(
'project' => 'your_project_identifier',
'password' => 'your_token',
'phonenumber' => '00436641234567',
'message' => 'Your message text comes here',
'tag' => 'MyTag'
);
$curl = curl_init($apiUrl);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postParams);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
$response = curl_exec($curl);
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $url = "https://mapi.moreify.com/api/v1/sendSms";
my $response = $ua->post( $url, [
"project" => "your_project_identifier",
"password" => "your_token",
"phonenumber" => "00436641234567",
"message" => "Your message text comes here",
"tag" => "MyTag"
] );
String data = String.format("project=%s&"
+ "password=%s&"
+ "phonenumber=%s&"
+ "message=%s&"
+ "tag=%s",
URLEncoder.encode("your_project_identifier", "UTF-8"),
URLEncoder.encode("your_token", "UTF-8"),
URLEncoder.encode("00436641234567", "UTF-8"),
URLEncoder.encode("Your message text comes here", "UTF-8"),
URLEncoder.encode("MyTag", "UTF-8")
);
URL url = new URL("https://mapi.moreify.com/api/v1/sendSms");
HttpURLConnection connection = HttpURLConnection.class.cast(url.openConnection());
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
DataOutputStream os = new DataOutputStream(connection.getOutputStream());
os.writeBytes(data);
os.close();
InputStream in = connection.getInputStream();
// read response...
require 'uri'
require 'net/http'
uri = URI("https://mapi.moreify.com/api/v1/sendSms")
response = Net::HTTP.post_form(uri,
'project' => 'your_project_identifier',
'password' => 'your_token',
'phonenumber' => '00436641234567',
'message' => 'Your message text comes here',
'tag' => 'MyTag'
)
# first make sure you have the "requests" package installed (see python-requests.org)
import requests
postParams = {
'project': 'your_project_identifier',
'password': 'your_token',
'phonenumber': '00436641234567',
'message': 'Your message text comes here',
'tag': 'MyTag'
}
response = requests.post("https://mapi.moreify.com/api/v1/sendSms", data=postParams)
define command {
command_name notify-service-by-moreify
command_line /usr/bin/curl -X POST https://mapi.moreify.com/api/v1/sendSms \
-d project=your_project_identifier \
-d password=your_token \
-d phonenumber=$CONTACTPAGER$ \
-d message="Service: $SERVICEDESC$%0aHost: $HOSTALIAS$%0aState: $SERVICESTATE$%0a%0a$SERVICEOUTPUT$"
}
define command {
command_name notify-host-by-moreify
command_line /usr/bin/curl -X POST https://mapi.moreify.com/api/v1/sendSms \
-d project=your_project_identifier \
-d password=your_token \
-d phonenumber=$CONTACTPAGER$ \
-d message="Host: $HOSTNAME$%0aState: $HOSTSTATE$%0a%0a$HOSTOUTPUT$"
}
define contact {
contact_name moreify-template
name moreify-template
alias Moreify contact template
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-moreify
host_notification_commands notify-host-by-moreify
register 0
}
define contact {
use moreify-template
contact_name cpt_uptime
pager +436641234567
}
define contactgroup {
contactgroup_name oncall
members cpt_uptime
}
define service {
name important_service
contact_groups oncall
}
Call target with a 4 digit verification code.
Request
POST https://mapi.moreify.com/api/v1/sendCall
parameter | type | info | description |
---|---|---|---|
project | string | required | Project identifier of the project you would like to use. The value of the identifier is configurable in your project settings. |
password | string | required | The related password/token for the project. You can find it in your project settings. |
phonenumber | string | required | Recipient phone number the call should be established to. This must be in international format, example +43 or 0043 for Austria or +1 for USA. |
language | string | required 2 characters | The language in which the verification should be spoken. Available: de (German), en (English), fr (French), tr (Turkish), nl (Dutch), es (Spanish), hu (Hungarian). |
verifycode | string | required 4 characters | The 4 digit code used for verification. |
tag | string | optional max. 50 characters | String which allows you to tag this specific message. E.g. an unique identifier from your side or some sort of grouping information, like a specific promotion id,name ... It will be returned in the response. |
Response
The response will be in a JSON format!parameter | type | info | description |
---|---|---|---|
success | boolean | true|false Whether the message was processed successfully or not | |
message-identifier | string | 40 characters | Uniquely identifies the message on our gateway. |
tag | string | optional | If you provided the tag on the send request, we will send it back to you. |
Examples
<?php
$apiUrl = "https://mapi.moreify.com/api/v1/sendCall";
$postParams = array(
'project' => 'your_project_identifier',
'password' => 'your_token',
'phonenumber' => '00436641234567',
'language' => 'en',
'verifycode' => '1234',
'tag' => 'MyTag'
);
$curl = curl_init($apiUrl);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postParams);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
$response = curl_exec($curl);
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $url = "https://mapi.moreify.com/api/v1/sendCall";
my $response = $ua->post( $url, [
"project" => "your_project_identifier",
"password" => "your_token",
"phonenumber" => "00436641234567",
"language" => "en",
"verifycode" => "1234",
"tag" => "MyTag"
] );
String data = String.format("project=%s&"
+ "password=%s&"
+ "phonenumber=%s&"
+ "language=%s&"
+ "verifycode=%s&"
+ "tag=%s",
URLEncoder.encode("your_project_identifier", "UTF-8"),
URLEncoder.encode("your_token", "UTF-8"),
URLEncoder.encode("00436641234567", "UTF-8"),
URLEncoder.encode("de", "UTF-8"),
URLEncoder.encode("1234", "UTF-8"),
URLEncoder.encode("MyTag", "UTF-8")
);
URL url = new URL("https://mapi.moreify.com/api/v1/sendCall");
HttpURLConnection connection = HttpURLConnection.class.cast(url.openConnection());
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
DataOutputStream os = new DataOutputStream(connection.getOutputStream());
os.writeBytes(data);
os.close();
InputStream in = connection.getInputStream();
// read response...
require 'uri'
require 'net/http'
uri = URI("https://mapi.moreify.com/api/v1/sendCall")
response = Net::HTTP.post_form(uri,
'project' => 'your_project_identifier',
'password' => 'your_token',
'phonenumber' => '00436641234567',
'language' => 'en',
'verifycode' => '1234',
'tag' => 'MyTag'
)
# first make sure you have the "requests" package installed (see python-requests.org)
import requests
postParams = {
'project': 'your_project_identifier',
'password': 'your_token',
'phonenumber': '00436641234567',
'language': 'en',
'verifycode': '1234',
'tag': 'MyTag'
}
response = requests.post("https://mapi.moreify.com/api/v1/sendCall", data=postParams)
Exceptions.
A list of all available exceptions
Error Code | Error Message | Status Code | description |
---|---|---|---|
1000 | Internal error | 500 | An internal error in moreify occured, please try again later or contact our support. |
1001 | Internal error | 500 | An internal error in moreify occured, please try again later or contact our support. |
1002 | Internal error | 500 | An internal error in moreify occured, please try again later or contact our support. |
1100 | Insufficient balance on the user account | 400 | There is not enough balance on your account. Please login and topup your account. |
1101 | Invalid/Unknown authentication token | 400 | Your project/password is wrong. Please verify the authentication data with your project settings. |
1102 | User is disabled | 400 | User is disabled. Please contact our support for further information. |
1103 | Missing Permission | 400 | Your account is not permitted to execute this operation. |
1201 | The message body is empty | 400 | The transmitted message body is empty. |
1202 | No phone number given | 400 | The transmitted request does not include a phone number. |
1203 | Given phone number is invalid | 400 | The transmitted phone number is invalid. |
1204 | The passed language is invalid | 400 | You passed an invalid or not existing language code. |
1205 | The passed verification code is invalid | 400 | You passed an invalid verification code. Verification codes need to be 4 digits long and numeric. |
1206 | The message was invalid or to long. | 400 | Die übermittelte Nachricht enthält ungültige Zeichen oder ist zu lange. |
1207 | The group identifier was not found. | 400 | Der group Parameter Wert ist ungültig. |
1208 | The send-at timestamp is invalid | 400 | Ungültiger UNIX Zeitstampel übergeben! |
1209 | URLs within the message are not approved for your account yet | 400 | The delivery of URLs within SMS messages has not been approved yet! |