send-text-message
curl --request POST \
--url https://api.notifly.tech/messages/text-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "example_project_1234567890abcdef",
"type": "sms",
"body": "Message Body",
"recipientList": [
{
"recipientNo": "01012345678"
}
]
}
'import requests
url = "https://api.notifly.tech/messages/text-message"
payload = {
"projectId": "example_project_1234567890abcdef",
"type": "sms",
"body": "Message Body",
"recipientList": [{ "recipientNo": "01012345678" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: 'example_project_1234567890abcdef',
type: 'sms',
body: JSON.stringify('Message Body'),
recipientList: [{recipientNo: '01012345678'}]
})
};
fetch('https://api.notifly.tech/messages/text-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notifly.tech/messages/text-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'projectId' => 'example_project_1234567890abcdef',
'type' => 'sms',
'body' => 'Message Body',
'recipientList' => [
[
'recipientNo' => '01012345678'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notifly.tech/messages/text-message"
payload := strings.NewReader("{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notifly.tech/messages/text-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notifly.tech/messages/text-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"data": null,
"error": "Sender info is not registered."
}{
"success": false,
"error": "Internal Server Error"
}メッセージ配信
SMS、LMS、MMSを送信する
SMS、LMS、MMSのいずれかを送信します。
POST
/
messages
/
text-message
send-text-message
curl --request POST \
--url https://api.notifly.tech/messages/text-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "example_project_1234567890abcdef",
"type": "sms",
"body": "Message Body",
"recipientList": [
{
"recipientNo": "01012345678"
}
]
}
'import requests
url = "https://api.notifly.tech/messages/text-message"
payload = {
"projectId": "example_project_1234567890abcdef",
"type": "sms",
"body": "Message Body",
"recipientList": [{ "recipientNo": "01012345678" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: 'example_project_1234567890abcdef',
type: 'sms',
body: JSON.stringify('Message Body'),
recipientList: [{recipientNo: '01012345678'}]
})
};
fetch('https://api.notifly.tech/messages/text-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notifly.tech/messages/text-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'projectId' => 'example_project_1234567890abcdef',
'type' => 'sms',
'body' => 'Message Body',
'recipientList' => [
[
'recipientNo' => '01012345678'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notifly.tech/messages/text-message"
payload := strings.NewReader("{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notifly.tech/messages/text-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notifly.tech/messages/text-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"example_project_1234567890abcdef\",\n \"type\": \"sms\",\n \"body\": \"Message Body\",\n \"recipientList\": [\n {\n \"recipientNo\": \"01012345678\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"data": null,
"error": "Sender info is not registered."
}{
"success": false,
"error": "Internal Server Error"
}- APIでテキストメッセージ(SMS、LMS、MMS)を送信するには、メッセージ送信プラットフォームでNotiflyを選び、送信元番号を登録してください。
- APIからの配信では、その設定に登録した番号を使います。
- API経由の配信統計についてはcontact@notifly.techにお問い合わせください。この統計はコンソールに表示されません。
ボディ
application/json
