JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const trigger = await client.workflows.triggers.create({ activation: 'event', name: 'x' });
console.log(trigger.data);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
trigger = client.workflows.triggers.create(
activation="event",
name="x",
)
print(trigger.data)curl --request POST \
--url https://api.mobilerun.ai/v1/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"conditions": {
"all": [
{}
],
"any": [
{}
]
},
"customPayloadSchema": {},
"description": "<string>",
"eventType": "<string>",
"timezone": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/triggers",
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([
'name' => '<string>',
'conditions' => [
'all' => [
[
]
],
'any' => [
[
]
]
],
'customPayloadSchema' => [
],
'description' => '<string>',
'eventType' => '<string>',
'timezone' => '<string>'
]),
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.mobilerun.ai/v1/triggers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\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.mobilerun.ai/v1/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/triggers")
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 \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"activation": "event",
"createdAt": "<string>",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customPayloadSchema": {},
"description": "<string>",
"eventType": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduleRule": {
"type": "once",
"dateTime": "<string>",
"expression": "<string>",
"jitter": {
"afterMinutes": 0,
"beforeMinutes": 0
},
"rrule": "<string>"
},
"timezone": "<string>",
"updatedAt": "<string>",
"userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conditions": "<unknown>",
"nextFireTime": "<string>"
}
}Triggers
Create a trigger
Create a trigger with an activation type of event, schedule, or custom. Each type requires its own fields (e.g. eventType and optional conditions for events, scheduleRule and timezone for schedules, customPayloadSchema for custom triggers); mismatched fields are rejected.
POST
/
triggers
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const trigger = await client.workflows.triggers.create({ activation: 'event', name: 'x' });
console.log(trigger.data);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
trigger = client.workflows.triggers.create(
activation="event",
name="x",
)
print(trigger.data)curl --request POST \
--url https://api.mobilerun.ai/v1/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"conditions": {
"all": [
{}
],
"any": [
{}
]
},
"customPayloadSchema": {},
"description": "<string>",
"eventType": "<string>",
"timezone": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/triggers",
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([
'name' => '<string>',
'conditions' => [
'all' => [
[
]
],
'any' => [
[
]
]
],
'customPayloadSchema' => [
],
'description' => '<string>',
'eventType' => '<string>',
'timezone' => '<string>'
]),
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.mobilerun.ai/v1/triggers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\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.mobilerun.ai/v1/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/triggers")
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 \"name\": \"<string>\",\n \"conditions\": {\n \"all\": [\n {}\n ],\n \"any\": [\n {}\n ]\n },\n \"customPayloadSchema\": {},\n \"description\": \"<string>\",\n \"eventType\": \"<string>\",\n \"timezone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"activation": "event",
"createdAt": "<string>",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customPayloadSchema": {},
"description": "<string>",
"eventType": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduleRule": {
"type": "once",
"dateTime": "<string>",
"expression": "<string>",
"jitter": {
"afterMinutes": 0,
"beforeMinutes": 0
},
"rrule": "<string>"
},
"timezone": "<string>",
"updatedAt": "<string>",
"userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conditions": "<unknown>",
"nextFireTime": "<string>"
}
}Authorizations
Bearer token via Authorization header
Body
application/json
Available options:
event, schedule, custom Required string length:
1 - 256Show child attributes
Show child attributes
Optional JSON Schema for validating payloads sent to this custom trigger
Maximum string length:
2048Maximum string length:
256Show child attributes
Show child attributes
Response
201 - application/json
Trigger created
Show child attributes
Show child attributes
Was this page helpful?
⌘I