Sending Message
Before sending a message retrieve a token.
Token should be provided in headers as an Authorization header with following format:
Basic <your_token_here>
To send a message provide a POST
request with a JSON payload for the endpoint:
https://webapi.inboxroad.com/api/v1/messages/
The payload should be the following format:
{ "from_email": "user@example.com", "from_name": "string", "to_email": "user@example.com", "to_name": "string", "reply_to_email": "user@example.com", "reply_to_name": "string", "subject": "string", "text": "string", "headers": {}, "html": "string", "attachments": [ { "filename": "string", "mime_type": "string", "file_data": "base64_string" } ]}
Required fields
Field name | Type | Description |
---|---|---|
from_email | string | A valid email that represents from whom this email was sent from |
to_email | string | A valid email that is presenting a person who would receive an email |
text | string | A text field that contains a body of the message. If html is empty this field is required |
html | string | An html formatted string field that contains html template for the email. If text is empty this field is required |
For more details and interactive behaviour please visit this link
Examples
curl --location --request POST 'https://webapi.inboxroad.com/api/v1/messages' \--header 'Authorization: Basic <example_token_here>' \--header 'Content-Type: application/json' \--data-raw '{"from_email": "example@example.com","from_name": "Example","to_email": "example@example.com","to_name": "Example","reply_to_email": "example@example.com","reply_to_name": "Example","subject": "Example","text": "Example","html": "<h1>example@example.com</h1>"}'
import requests
url = "https://webapi.inboxroad.com/api/v1/messages"
payload={"from_email": "example@example.com","from_name": "Example","to_email": "example@example.com","to_name": "Example","reply_to_email": "example@example.com","reply_to_name": "Example","subject": "Example","text": "Example","html": "<h1>example@example.com</h1>"}headers = {'Authorization': 'Basic <example_token_here>','Content-Type': 'application/json'}
response = requests.post(url, headers=headers, json=payload)
print(response.text)
<?php$client = new http\Client;$request = new http\Client\Request;$request->setRequestUrl('https://webapi.inboxroad.com/api/v1/messages');$request->setRequestMethod('POST');$body = new http\Message\Body;$body->append('{"from_email": "example@example.com","from_name": "Example","to_email": "example@example.com","to_name": "Example","reply_to_email": "example@example.com","reply_to_name": "Example","subject": "Example","text": "Example","html": "<h1>example@example.com</h1>"}');$request->setBody($body);$request->setOptions(array());$request->setHeaders(array('Authorization' => 'Basic <example_token_here>','Content-Type' => 'application/json'));$client->enqueue($request)->send();$response = $client->getResponse();echo $response->getBody();>
require "uri"require "net/http"
url = URI("https://webapi.inboxroad.com/api/v1/messages")
http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["Authorization"] = "Basic <example_token_here>"request["Content-Type"] = "application/json"request.body = "{\n \"from_email\": \"example@example.com\",\n \"from_name\": \"Example\",\n \"to_email\": \"example@example.com\",\n \"to_name\": \"Example\",\n \"reply_to_email\": \"example@example.com\",\n \"reply_to_name\": \"Example\",\n \"subject\": \"Example\",\n \"text\": \"Example\",\n \"html\": \"<h1>example@example.com</h1>\"\n}"
response = http.request(request)puts response.read_body