{"_id":"5653264657978b1700df716a","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"editedParams2":true,"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","category":{"_id":"56669e857cc81e0d00253f8e","project":"54eb50e5615ffc1900305a16","__v":8,"pages":["568ceacb8a7ca5190039643a","5693a7995f1c951900644b25","5698e793d36db20d00ddba45","56a0ce7441766e0d00b28cf8","56a0d36544f3d80d00a2c242","56a0d3e0aca0730d003e3475","56a5ecf7b91d8d0d008349cc","56d595dba0b5600b000b1e75"],"version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-12-08T09:10:29.254Z","from_sync":false,"order":6,"slug":"omni-channel-messaging","title":"OMNI channel messaging"},"editedParams":true,"__v":3,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-23T14:44:22.888Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"POST /omni/1/scenarios HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n  \"name\":\"Test SMS or Viber\",\n  \"flow\": [\n    {\n      \"from\": \"InfoSMS\",\n      \"channel\": \"SMS\"\n    },\n    {\n      \"from\": \"3045\",\n      \"channel\": \"VIBER\"\n    }\n  ],\n  \"default\": false\n}","language":"json","name":""},{"code":"POST /omni/1/scenarios HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/xml\n\n<scenario>\n    <name>Test SMS or Viber</name>\n    <flow>\n        <step>\n            <from>InfoSMS</from>\n            <channel>SMS</channel>\n        </step>\n        <step>\n            <from>3045</from>\n            <channel>VIBER</channel>\n        </step>\n    </flow>\n    <default>false</default>\n</scenario>","language":"xml"},{"code":"curl -X POST \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \\\n -d '{\n  \"name\":\"Test SMS or Viber\",\n  \"flow\": [\n    {\n      \"from\": \"InfoSMS\",\n      \"channel\": \"SMS\"\n    },\n    {\n      \"from\": \"3045\",\n      \"channel\": \"VIBER\"\n    }\n  ],\n  \"default\": false\n}' https://api.infobip.com/sms/1/omni/1/scenarios","language":"curl"},{"code":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"http://api.infobip.com/omni/1/scenarios\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"{ \\\"name\\\":\\\"Test SMS or Viber\\\", \\\"flow\\\": [ { \\\"from\\\": \\\"InfoSMS\\\", \\\"channel\\\": \\\"SMS\\\" }, { \\\"from\\\": \\\"3045\\\", \\\"channel\\\": \\\"VIBER\\\" } ], \\\"default\\\": false }\",\n  CURLOPT_HTTPHEADER => array(\n    \"accept: application/json\",\n    \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}","language":"php"},{"code":"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.infobip.com/omni/1/scenarios\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"content-type\"] = 'application/json'\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"accept\"] = 'application/json'\n\nrequest.body = \"{\\n    \\\"name\\\": \\\"Test SMS or Viber\\\",\\n    \\\"flow\\\": [\\n        {\\n            \\\"channel\\\": \\\"SMS\\\",\\n            \\\"from\\\": \\\"InfoSms\\\"\\n        },\\n        {\\n            \\\"channel\\\": \\\"VIBER\\\",\\n            \\\"from\\\": \\\"3045\\\"\\n        }\\n    ],\\n    \\\"default\\\": false\\n}\"\n\nresponse = http.request(request)\nputs response.read_body","language":"ruby"},{"language":"python","code":"import http.client\n\nconn = http.client.HTTPSConnection(\"api.infobip.com\")\n\npayload = \"{\\n    \\\"name\\\": \\\"Test SMS or Viber\\\",\\n    \\\"flow\\\": [\\n        {\\n            \\\"channel\\\": \\\"SMS\\\",\\n            \\\"from\\\": \\\"InfoSms\\\"\\n        },\\n        {\\n            \\\"channel\\\": \\\"VIBER\\\",\\n            \\\"from\\\": \\\"3045\\\"\\n        }\\n    ],\\n    \\\"default\\\": false\\n}\"\n\nheaders = {\n    'content-type': \"application/json\",\n    'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    'accept': \"application/json\"\n    }\n\nconn.request(\"POST\", \"/omni/1/scenarios\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"code":"HttpResponse<String> response = Unirest.post(\"https://api.infobip.com/omni/1/scenarios\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n  .header(\"accept\", \"application/json\")\n  .body(\"{\\n    \\\"name\\\": \\\"Test SMS or Viber\\\",\\n    \\\"flow\\\": [\\n        {\\n            \\\"channel\\\": \\\"SMS\\\",\\n            \\\"from\\\": \\\"InfoSms\\\"\\n        },\\n        {\\n            \\\"channel\\\": \\\"VIBER\\\",\\n            \\\"from\\\": \\\"3045\\\"\\n        }\\n    ],\\n    \\\"default\\\": false\\n}\")\n  .asString();","language":"java"},{"code":"var client = new RestClient(\"https://api.infobip.com/omni/1/scenarios\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\n    \\\"name\\\": \\\"Test SMS or Viber\\\",\\n    \\\"flow\\\": [\\n        {\\n            \\\"channel\\\": \\\"SMS\\\",\\n            \\\"from\\\": \\\"InfoSms\\\"\\n        },\\n        {\\n            \\\"channel\\\": \\\"VIBER\\\",\\n            \\\"from\\\": \\\"3045\\\"\\n        }\\n    ],\\n    \\\"default\\\": false\\n}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);","language":"csharp"},{"code":"var data = JSON.stringify({\n  \"name\":\"Test SMS or Viber\",\n  \"flow\": [\n    {\n      \"from\": \"InfoSMS\",\n      \"channel\": \"SMS\"\n    },\n    {\n      \"from\": \"3045\",\n      \"channel\": \"VIBER\"\n    }\n  ],\n  \"default\": false\n});\n\nxhr.open(\"POST\", \"https://api.infobip.com/omni/1/scenarios\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\n\nxhr.send(data);","language":"javascript"}]},"method":"post","results":{"codes":[{"name":"OK - JSON","code":"{\n  \"key\": \"CD265875E3A6EA43478D5F37A635BE4A\",\n  \"name\":\"Test SMS or Viber\",\n  \"flow\": [\n    {\n      \"from\": \"InfoSMS\",\n      \"channel\": \"SMS\"\n    },\n    {\n      \"from\": \"3045\",\n      \"channel\": \"VIBER\"\n    }\n  ],\n  \"default\": false\n}","language":"json","status":200},{"name":"OK - XML","code":"<scenario>\n    <key>CD265875E3A6EA43478D5F37A635BE4A</key>\n    <name>Test SMS or Viber</name>\n    <flow>\n        <step>\n            <from>InfoSMS</from>\n            <channel>SMS</channel>\n        </step>\n        <step>\n            <from>3045</from>\n            <channel>VIBER</channel>\n        </step>\n    </flow>\n    <default>false</default>\n</scenario>","language":"xml","status":200},{"name":"Invalid argument","code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"INVALID_ARGUMENT\",\n      \"text\": \"Invalid argument\"\n    }\n  }\n}","language":"json","status":400}]},"settings":"554860d6d2c8410d006c215e","auth":"required","params":[{"_id":"562106bc7c515c0d008eee67","ref":"","in":"body","required":true,"desc":"OMNI scenario name.","default":"","type":"string","name":"name"},{"_id":"562107eeb244890d00186907","ref":"","in":"body","required":false,"desc":"Sender used in OMNI scenario's step for sending message.","default":"","type":"string","name":"from"},{"_id":"562107eeb244890d00186906","ref":"","in":"body","required":false,"desc":"Channel used in scenario's step for delivering message (`SMS`, `VOICE`, `VIBER`, `FACEBOOK`, `EMAIL`, `PUSH`, `LINE`)","default":"","type":"string","name":"channel"},{"_id":"565f157823fd5f0d00a12a3f","ref":"","in":"body","required":false,"desc":"Indicates if created scenario should be set as a default.","default":"","type":"boolean","name":"default"}],"url":"/omni/:version/scenarios"},"isReference":true,"order":1,"body":"# Response format \n\nIf successful, response header HTTP status code will be `200 OK` and the scenario will be created.\n\nIf you try to create the scenario without authorization, you will receive an `401 Unauthorized` error.\n\n### Scenario\n\n|Parameter|Type|Description|\n|-|-|-|\n|*key*|String|Key used to uniquely identify OMNI scenario.|\n|*name*|String|OMNI scenario name.|\n|*flow*|[Step[]](#section-step)|Sender used in OMNI scenario's step for sending message.|\n|*default*|Boolean|Whether scenario is default.\n\n### Step\n\n|Parameter|Type|Description|\n|-|-|-|\n|*from*|String|Sender used in OMNI scenario's step for sending message.|\n|*channel*|String|Channel used in scenario's step for delivering message (`\"SMS\"`, `\"VOICE\"`,`\"VIBER\"`,`\"FACEBOOK\"`,`\"EMAIL\"`,`\"PUSH\"`)|\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default scenario\",\n  \"body\": \"First scenario created on account will be marked as default scenario. Sending OMNI messages will use that scenario until some other is updated to be default.\"\n}\n[/block]","excerpt":"This method allows you to create OMNI scenario and to define the flow for sending message.","slug":"omni-create-scenario","type":"endpoint","title":"Scenario: Create"}

postScenario: Create

This method allows you to create OMNI scenario and to define the flow for sending message.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

name:
required
string
OMNI scenario name.
from:
string
Sender used in OMNI scenario's step for sending message.
channel:
string
Channel used in scenario's step for delivering message (`SMS`, `VOICE`, `VIBER`, `FACEBOOK`, `EMAIL`, `PUSH`, `LINE`)
default:
boolean
Indicates if created scenario should be set as a default.

Examples


Result Format


Documentation

# Response format If successful, response header HTTP status code will be `200 OK` and the scenario will be created. If you try to create the scenario without authorization, you will receive an `401 Unauthorized` error. ### Scenario |Parameter|Type|Description| |-|-|-| |*key*|String|Key used to uniquely identify OMNI scenario.| |*name*|String|OMNI scenario name.| |*flow*|[Step[]](#section-step)|Sender used in OMNI scenario's step for sending message.| |*default*|Boolean|Whether scenario is default. ### Step |Parameter|Type|Description| |-|-|-| |*from*|String|Sender used in OMNI scenario's step for sending message.| |*channel*|String|Channel used in scenario's step for delivering message (`"SMS"`, `"VOICE"`,`"VIBER"`,`"FACEBOOK"`,`"EMAIL"`,`"PUSH"`)| [block:callout] { "type": "info", "title": "Default scenario", "body": "First scenario created on account will be marked as default scenario. Sending OMNI messages will use that scenario until some other is updated to be default." } [/block]