> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.conversive.ai/api-sdk-docs/send-messages/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conversive.ai/_mcp/server. # Send Messages POST https://api.beconversive.com/api/v2/message/send Content-Type: application/json Reference: https://docs.conversive.ai/api-sdk-docs/send-messages ## Authentication - `apiKey` header (required) — API Key authentication via header ## Servers - `https://api.beconversive.com` (US Data Center, default) - `https://eu-api.beconversive.com` (EU Data Center) - `https://aus-api.beconversive.com` (Australia Data Center) ## Request ### Body (application/json) This endpoint expects a SendMessageRequest. - `userPayload` (SendMessageRequestUserPayload, required) - `messageDetails` (list of MessageDetails, required) ## Response ### 200 Messages queued - `response` (SendMessageResponseResponse, optional) ## Errors ### 400 Bad Request Error Invalid request - `response` (ErrorResponseResponse, optional) ### 401 Unauthorized Error Invalid or missing API key - `response` (ErrorResponseResponse, optional) ## Types ### SendMessageRequestUserPayload - `type` (string, required) - `apiKey` (string, required) ### MessageDetails - `recipient` (list of ChannelParty, optional) - `sender` (ChannelParty, optional) - `source` (integer, optional) - `messageId` (string, optional) - `message` (MessageContent, optional) ### SendMessageResponseResponse - `vstatus` (string, optional) - `responseText` (string, optional) ### ErrorResponseResponse - `vstatus` (string, optional) - `responseText` (string, optional) ### ChannelParty - `channelType` (string, optional) - `phone` (string, optional) ### MessageContent - `type` (string, optional) - `content` (MessageContentContent, optional) ### MessageContentContent ## Examples ### Bulk SMS **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } }, { "recipient": [ { "channelType": "sms", "phone": "756384934" } ], "source": 8001, "messageId": "sms-002", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python Bulk SMS import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } }, { "recipient": [ { "channelType": "sms", "phone": "756384934" } ], "source": 8001, "messageId": "sms-002", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Bulk SMS const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"sms","phone":"756384933"}],"source":8001,"messageId":"sms-001","message":{"type":"text","content":{"messageText":"Text message"}}},{"recipient":[{"channelType":"sms","phone":"756384934"}],"source":8001,"messageId":"sms-002","message":{"type":"text","content":{"messageText":"Text message"}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Bulk SMS package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n },\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384934\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-002\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Bulk SMS require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n },\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384934\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-002\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java Bulk SMS import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n },\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384934\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-002\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}") .asString(); ``` ```php Bulk SMS request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } }, { "recipient": [ { "channelType": "sms", "phone": "756384934" } ], "source": 8001, "messageId": "sms-002", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp Bulk SMS using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n },\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384934\"\n }\n ],\n \"source\": 8001,\n \"messageId\": \"sms-002\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Bulk SMS import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "sms", "phone": "756384933" ] ], "source": 8001, "messageId": "sms-001", "message": [ "type": "text", "content": ["messageText": "Text message"] ] ], [ "recipient": [ [ "channelType": "sms", "phone": "756384934" ] ], "source": 8001, "messageId": "sms-002", "message": [ "type": "text", "content": ["messageText": "Text message"] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### WhatsApp Text **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-001", "message": { "type": "text", "content": { "messageText": "WhatsApp text message" } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python WhatsApp Text import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-001", "message": { "type": "text", "content": { "messageText": "WhatsApp text message" } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript WhatsApp Text const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"whatsapp","phone":"74785939"}],"sender":{"channelType":"whatsapp","phone":"858493494"},"source":8001,"messageId":"wa-001","message":{"type":"text","content":{"messageText":"WhatsApp text message"}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go WhatsApp Text package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"WhatsApp text message\"\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby WhatsApp Text require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"WhatsApp text message\"\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java WhatsApp Text import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"WhatsApp text message\"\n }\n }\n }\n ]\n}") .asString(); ``` ```php WhatsApp Text request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-001", "message": { "type": "text", "content": { "messageText": "WhatsApp text message" } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp WhatsApp Text using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"WhatsApp text message\"\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift WhatsApp Text import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "whatsapp", "phone": "74785939" ] ], "sender": [ "channelType": "whatsapp", "phone": "858493494" ], "source": 8001, "messageId": "wa-001", "message": [ "type": "text", "content": ["messageText": "WhatsApp text message"] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### WhatsApp Media with Caption **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "8485930" } ], "sender": { "channelType": "whatsapp", "phone": "48595930" }, "source": 8001, "messageId": "wa-media-001", "message": { "type": "image", "content": { "url": "https://example.com/image.png", "caption": "Caption with image" } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python WhatsApp Media with Caption import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "8485930" } ], "sender": { "channelType": "whatsapp", "phone": "48595930" }, "source": 8001, "messageId": "wa-media-001", "message": { "type": "image", "content": { "url": "https://example.com/image.png", "caption": "Caption with image" } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript WhatsApp Media with Caption const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"whatsapp","phone":"8485930"}],"sender":{"channelType":"whatsapp","phone":"48595930"},"source":8001,"messageId":"wa-media-001","message":{"type":"image","content":{"url":"https://example.com/image.png","caption":"Caption with image"}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go WhatsApp Media with Caption package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"8485930\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"48595930\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-001\",\n \"message\": {\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/image.png\",\n \"caption\": \"Caption with image\"\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby WhatsApp Media with Caption require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"8485930\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"48595930\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-001\",\n \"message\": {\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/image.png\",\n \"caption\": \"Caption with image\"\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java WhatsApp Media with Caption import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"8485930\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"48595930\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-001\",\n \"message\": {\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/image.png\",\n \"caption\": \"Caption with image\"\n }\n }\n }\n ]\n}") .asString(); ``` ```php WhatsApp Media with Caption request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "8485930" } ], "sender": { "channelType": "whatsapp", "phone": "48595930" }, "source": 8001, "messageId": "wa-media-001", "message": { "type": "image", "content": { "url": "https://example.com/image.png", "caption": "Caption with image" } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp WhatsApp Media with Caption using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"8485930\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"48595930\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-001\",\n \"message\": {\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/image.png\",\n \"caption\": \"Caption with image\"\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift WhatsApp Media with Caption import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "whatsapp", "phone": "8485930" ] ], "sender": [ "channelType": "whatsapp", "phone": "48595930" ], "source": 8001, "messageId": "wa-media-001", "message": [ "type": "image", "content": [ "url": "https://example.com/image.png", "caption": "Caption with image" ] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### WhatsApp Template Message **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-template-001", "message": { "type": "template", "content": { "name": "mtm_test", "parameters": [ { "type": "text", "value": "Hi" }, { "type": "text", "value": "User" } ], "language_config": { "policy": "deterministic", "locale": "en-GB" } } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python WhatsApp Template Message import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-template-001", "message": { "type": "template", "content": { "name": "mtm_test", "parameters": [ { "type": "text", "value": "Hi" }, { "type": "text", "value": "User" } ], "language_config": { "policy": "deterministic", "locale": "en-GB" } } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript WhatsApp Template Message const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"whatsapp","phone":"74785939"}],"sender":{"channelType":"whatsapp","phone":"858493494"},"source":8001,"messageId":"wa-template-001","message":{"type":"template","content":{"name":"mtm_test","parameters":[{"type":"text","value":"Hi"},{"type":"text","value":"User"}],"language_config":{"policy":"deterministic","locale":"en-GB"}}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go WhatsApp Template Message package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-template-001\",\n \"message\": {\n \"type\": \"template\",\n \"content\": {\n \"name\": \"mtm_test\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"value\": \"Hi\"\n },\n {\n \"type\": \"text\",\n \"value\": \"User\"\n }\n ],\n \"language_config\": {\n \"policy\": \"deterministic\",\n \"locale\": \"en-GB\"\n }\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby WhatsApp Template Message require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-template-001\",\n \"message\": {\n \"type\": \"template\",\n \"content\": {\n \"name\": \"mtm_test\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"value\": \"Hi\"\n },\n {\n \"type\": \"text\",\n \"value\": \"User\"\n }\n ],\n \"language_config\": {\n \"policy\": \"deterministic\",\n \"locale\": \"en-GB\"\n }\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java WhatsApp Template Message import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-template-001\",\n \"message\": {\n \"type\": \"template\",\n \"content\": {\n \"name\": \"mtm_test\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"value\": \"Hi\"\n },\n {\n \"type\": \"text\",\n \"value\": \"User\"\n }\n ],\n \"language_config\": {\n \"policy\": \"deterministic\",\n \"locale\": \"en-GB\"\n }\n }\n }\n }\n ]\n}") .asString(); ``` ```php WhatsApp Template Message request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "74785939" } ], "sender": { "channelType": "whatsapp", "phone": "858493494" }, "source": 8001, "messageId": "wa-template-001", "message": { "type": "template", "content": { "name": "mtm_test", "parameters": [ { "type": "text", "value": "Hi" }, { "type": "text", "value": "User" } ], "language_config": { "policy": "deterministic", "locale": "en-GB" } } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp WhatsApp Template Message using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"74785939\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"858493494\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-template-001\",\n \"message\": {\n \"type\": \"template\",\n \"content\": {\n \"name\": \"mtm_test\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"value\": \"Hi\"\n },\n {\n \"type\": \"text\",\n \"value\": \"User\"\n }\n ],\n \"language_config\": {\n \"policy\": \"deterministic\",\n \"locale\": \"en-GB\"\n }\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift WhatsApp Template Message import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "whatsapp", "phone": "74785939" ] ], "sender": [ "channelType": "whatsapp", "phone": "858493494" ], "source": 8001, "messageId": "wa-template-001", "message": [ "type": "template", "content": [ "name": "mtm_test", "parameters": [ [ "type": "text", "value": "Hi" ], [ "type": "text", "value": "User" ] ], "language_config": [ "policy": "deterministic", "locale": "en-GB" ] ] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### WhatsApp Media Template **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "3848940" } ], "sender": { "channelType": "whatsapp", "phone": "484940" }, "source": 8001, "messageId": "wa-media-template-001", "message": { "type": "custom", "content": { "messageText": "media template whatsapp1" } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python WhatsApp Media Template import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "3848940" } ], "sender": { "channelType": "whatsapp", "phone": "484940" }, "source": 8001, "messageId": "wa-media-template-001", "message": { "type": "custom", "content": { "messageText": "media template whatsapp1" } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript WhatsApp Media Template const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"whatsapp","phone":"3848940"}],"sender":{"channelType":"whatsapp","phone":"484940"},"source":8001,"messageId":"wa-media-template-001","message":{"type":"custom","content":{"messageText":"media template whatsapp1"}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go WhatsApp Media Template package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"3848940\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"484940\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-template-001\",\n \"message\": {\n \"type\": \"custom\",\n \"content\": {\n \"messageText\": \"media template whatsapp1\"\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby WhatsApp Media Template require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"3848940\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"484940\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-template-001\",\n \"message\": {\n \"type\": \"custom\",\n \"content\": {\n \"messageText\": \"media template whatsapp1\"\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java WhatsApp Media Template import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"3848940\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"484940\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-template-001\",\n \"message\": {\n \"type\": \"custom\",\n \"content\": {\n \"messageText\": \"media template whatsapp1\"\n }\n }\n }\n ]\n}") .asString(); ``` ```php WhatsApp Media Template request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "whatsapp", "phone": "3848940" } ], "sender": { "channelType": "whatsapp", "phone": "484940" }, "source": 8001, "messageId": "wa-media-template-001", "message": { "type": "custom", "content": { "messageText": "media template whatsapp1" } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp WhatsApp Media Template using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"whatsapp\",\n \"phone\": \"3848940\"\n }\n ],\n \"sender\": {\n \"channelType\": \"whatsapp\",\n \"phone\": \"484940\"\n },\n \"source\": 8001,\n \"messageId\": \"wa-media-template-001\",\n \"message\": {\n \"type\": \"custom\",\n \"content\": {\n \"messageText\": \"media template whatsapp1\"\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift WhatsApp Media Template import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "whatsapp", "phone": "3848940" ] ], "sender": [ "channelType": "whatsapp", "phone": "484940" ], "source": 8001, "messageId": "wa-media-template-001", "message": [ "type": "custom", "content": ["messageText": "media template whatsapp1"] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Example 6 **Request** ```json { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "sender": { "channelType": "sms", "phone": "56894033" }, "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] } ``` **Response** ```json { "response": { "vstatus": "string", "responseText": "string" } } ``` **SDK Code** ```python import requests url = "https://api.beconversive.com/api/v2/message/send" payload = { "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "sender": { "channelType": "sms", "phone": "56894033" }, "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] } headers = { "apiKey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.beconversive.com/api/v2/message/send'; const options = { method: 'POST', headers: {apiKey: '', 'Content-Type': 'application/json'}, body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"sms","phone":"756384933"}],"sender":{"channelType":"sms","phone":"56894033"},"source":8001,"messageId":"sms-001","message":{"type":"text","content":{"messageText":"Text message"}}}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.beconversive.com/api/v2/message/send" payload := strings.NewReader("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"sender\": {\n \"channelType\": \"sms\",\n \"phone\": \"56894033\"\n },\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apiKey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.beconversive.com/api/v2/message/send") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apiKey"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"sender\": {\n \"channelType\": \"sms\",\n \"phone\": \"56894033\"\n },\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.beconversive.com/api/v2/message/send") .header("apiKey", "") .header("Content-Type", "application/json") .body("{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"sender\": {\n \"channelType\": \"sms\",\n \"phone\": \"56894033\"\n },\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}") .asString(); ``` ```php request('POST', 'https://api.beconversive.com/api/v2/message/send', [ 'body' => '{ "userPayload": { "type": "api", "apiKey": "YOUR_API_KEY" }, "messageDetails": [ { "recipient": [ { "channelType": "sms", "phone": "756384933" } ], "sender": { "channelType": "sms", "phone": "56894033" }, "source": 8001, "messageId": "sms-001", "message": { "type": "text", "content": { "messageText": "Text message" } } } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'apiKey' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.beconversive.com/api/v2/message/send"); var request = new RestRequest(Method.POST); request.AddHeader("apiKey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"userPayload\": {\n \"type\": \"api\",\n \"apiKey\": \"YOUR_API_KEY\"\n },\n \"messageDetails\": [\n {\n \"recipient\": [\n {\n \"channelType\": \"sms\",\n \"phone\": \"756384933\"\n }\n ],\n \"sender\": {\n \"channelType\": \"sms\",\n \"phone\": \"56894033\"\n },\n \"source\": 8001,\n \"messageId\": \"sms-001\",\n \"message\": {\n \"type\": \"text\",\n \"content\": {\n \"messageText\": \"Text message\"\n }\n }\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "apiKey": "", "Content-Type": "application/json" ] let parameters = [ "userPayload": [ "type": "api", "apiKey": "YOUR_API_KEY" ], "messageDetails": [ [ "recipient": [ [ "channelType": "sms", "phone": "756384933" ] ], "sender": [ "channelType": "sms", "phone": "56894033" ], "source": 8001, "messageId": "sms-001", "message": [ "type": "text", "content": ["messageText": "Text message"] ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```