Validate Integration

Validate Integration

POST https://api.ocamba.com/v1/hood/integrations/validate
Validates the Integration settings input by sending the provided credentials to the provider’s service.

Rate limits:

  • Burst: 10/s
  • Steady: 150/m

Request schema

body

Response schemas

204
No Content
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example Twilio",
  "provider_id": "1000",
  "settings": {
    "account_sid": "AC7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "auth_token": "464XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "default_phone_number": "+121XXXXXXXXX"
  },
  "status": "active"
}'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Example Twilio",
      "provider_id": "1000",
      "settings": {
        "account_sid": "AC7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "auth_token": "464XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "default_phone_number": "+121XXXXXXXXX"
      },
      "status": "active"
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Example Twilio",
    "provider_id" => "1000",
    "settings" => [
      "account_sid" => "AC7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "auth_token" => "464XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "default_phone_number" => "+121XXXXXXXXX"
    ],
    "status" => "active"
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '"{\n  \"name\": \"Example Mitto\",\n  \"provider_id\": \"1004\",\n  \"settings\": {\n    \"api_key\": \"AScs8XXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n    \"sender_name\": \"Example Name\",\n  },\n  \"status\": \"active\"\n}"'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    "{\n  \"name\": \"Example Mitto\",\n  \"provider_id\": \"1004\",\n  \"settings\": {\n    \"api_key\": \"AScs8XXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n    \"sender_name\": \"Example Name\",\n  },\n  \"status\": \"active\"\n}"
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  "[\n  \"name\" => \"Example Mitto\",\n  \"provider_id\" => \"1004\",\n  \"settings\" => [\n    \"api_key\" => \"AScs8XXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n    \"sender_name\" => \"Example Name\",\n  ],\n  \"status\" => \"active\"\n]"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example Custom",
  "provider_id": "1001",
  "settings": {
    "default_sender_email": "[email protected]",
    "default_sender_name": "John Doe",
    "sending_domain": "ex.example.com",
    "port": "587",
    "username": "[email protected]",
    "password": "yourPassword123"
  },
  "status": "active"
}'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Example Custom",
      "provider_id": "1001",
      "settings": {
        "default_sender_email": "[email protected]",
        "default_sender_name": "John Doe",
        "sending_domain": "ex.example.com",
        "port": "587",
        "username": "[email protected]",
        "password": "yourPassword123"
      },
      "status": "active"
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Example Custom",
    "provider_id" => "1001",
    "settings" => [
      "default_sender_email" => "[email protected]",
      "default_sender_name" => "John Doe",
      "sending_domain" => "ex.example.com",
      "port" => "587",
      "username" => "[email protected]",
      "password" => "yourPassword123"
    ],
    "status" => "active"
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example Mailchimp",
  "provider_id": "1002",
  "settings": {
    "api_key": "md-c8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "default_sender_name": "Example Name",
    "default_sender_email": "[email protected]",
    "default_reply_to_email": "[email protected]"
  },
  "status": "active"
}'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Example Mailchimp",
      "provider_id": "1002",
      "settings": {
        "api_key": "md-c8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "default_sender_name": "Example Name",
        "default_sender_email": "[email protected]",
        "default_reply_to_email": "[email protected]"
      },
      "status": "active"
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Example Mailchimp",
    "provider_id" => "1002",
    "settings" => [
      "api_key" => "md-c8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "default_sender_name" => "Example Name",
      "default_sender_email" => "[email protected]",
      "default_reply_to_email" => "[email protected]"
    ],
    "status" => "active"
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example SendGrid",
  "provider_id": "1003",
  "settings": {
    "api_key": "SG.EKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "default_sender_name": "Example Name",
    "default_sender_email": "[email protected]",
    "default_reply_to_email": "[email protected]"
  },
  "status": "active"
}'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Example SendGrid",
      "provider_id": "1003",
      "settings": {
        "api_key": "SG.EKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "default_sender_name": "Example Name",
        "default_sender_email": "[email protected]",
        "default_reply_to_email": "[email protected]"
      },
      "status": "active"
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Example SendGrid",
    "provider_id" => "1003",
    "settings" => [
      "api_key" => "SG.EKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "default_sender_name" => "Example Name",
      "default_sender_email" => "[email protected]",
      "default_reply_to_email" => "[email protected]"
    ],
    "status" => "active"
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/integrations/validate" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '"{\n  \"name\": \"Example Mailgun\",\n  \"provider_id\": \"1005\",\n  \"settings\": {\n    \"api_key\": \"568cXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXX-XXXXXXXX\",\n    \"domain\":\"sandboxXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.mailgun.org\"\n    \"sender_email\": \"[email protected]\",\n    \"sender_name\": \"John Doe\",\n  },\n  \"status\": \"active\"\n}"'
const url = 'https://api.ocamba.com/v1/hood/integrations/validate';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    "{\n  \"name\": \"Example Mailgun\",\n  \"provider_id\": \"1005\",\n  \"settings\": {\n    \"api_key\": \"568cXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXX-XXXXXXXX\",\n    \"domain\":\"sandboxXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.mailgun.org\"\n    \"sender_email\": \"[email protected]\",\n    \"sender_name\": \"John Doe\",\n  },\n  \"status\": \"active\"\n}"
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/integrations/validate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  "[\n  \"name\" => \"Example Mailgun\",\n  \"provider_id\" => \"1005\",\n  \"settings\" => [\n    \"api_key\" => \"568cXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXX-XXXXXXXX\",\n    \"domain\" =>\"sandboxXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.mailgun.org\"\n    \"sender_email\" => \"[email protected]\",\n    \"sender_name\" => \"John Doe\",\n  ],\n  \"status\" => \"active\"\n]"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

200 OK

[
  {
    "incoming_phone_number": "+1218XXXXXXX"
  }
]

204 No Content

400 Bad Request

{
  "code": 400,
  "title": "Bad request.",
  "message": "The request body is not valid.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}

500 Internal Server Error

{
  "code": 500,
  "title": "Internal server error.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses

Note
Validate the settings based on the provider_id. Through the provider id, the service knows which fields are required as credentials in the integrations settings. In this case you don’t need to provide the default phone number field in the Integration settings if the provider_id is the id of the Twilio SMS provider.
Warining
The response may differ based on the provider_id. For example, if you provide the Twilio SMS provider_id, generated by Ocamba, You should recieve a 200 status response, along side with an array of the accounts incoming phone numbers. I.E. if the provided credentials are valid.