Messaging Service
Messages
/two-way/messages
1 min
code examples curl location globoff 'https //{domain}/core/api/v1/messaging service/two way/messages' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{"body" {"message" {},"to" {"countrycode" "string","number" "string"},"webhook" {"defaultinbound" {"url" "string\<url>"},"status" {"url" "string\<url>"},"invalidresponse" {"url" "string\<url>"}},"context" {}}}'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "body" { "message" {}, "to" { "countrycode" "string", "number" "string" }, "webhook" { "defaultinbound" { "url" "string\<url>" }, "status" { "url" "string\<url>" }, "invalidresponse" { "url" "string\<url>" } }, "context" {} } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //{domain}/core/api/v1/messaging service/two way/messages", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //{domain}/core/api/v1/messaging service/two way/messages") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "body" { "message" {}, "to" { "countrycode" "string", "number" "string" }, "webhook" { "defaultinbound" { "url" "string\<url>" }, "status" { "url" "string\<url>" }, "invalidresponse" { "url" "string\<url>" } }, "context" {} } }) response = https request(request) puts response read body import requests import json url = "https //{domain}/core/api/v1/messaging service/two way/messages" payload = json dumps({ "body" { "message" {}, "to" { "countrycode" "string", "number" "string" }, "webhook" { "defaultinbound" { "url" "string\<url>" }, "status" { "url" "string\<url>" }, "invalidresponse" { "url" "string\<url>" } }, "context" {} } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // accepted {}// bad request the server is unable to process the request due to something that is perceived to be a client error { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} } }// unauthorized the client's identity is unknown to the server verify that you are accessing the correct tenant and that your client id and client secret are valid on that tenant { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} } }// not found the server can not find the requested resource { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} } }