### HTTP Request for Message Status Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/status.html This is an example of an HTTP GET request to the Sendblue API to retrieve the status of a specific message. It requires authentication headers and a 'handle' query parameter. ```http GET https://api.sendblue.co/api/status?handle={{message_handle}} "sb-api-key-id": <> "sb-api-secret-key": <> ``` -------------------------------- ### Get Messages using Node.js (Axios) Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/get-messages.html This example shows how to retrieve messages from the Sendblue API using Node.js with the Axios library. It configures the request with headers for authentication and parameters for filtering and pagination. The response data or any errors are logged to the console. ```javascript const axios = require("axios"); const url = "https://api.sendblue.co/accounts/messages"; axios .get(url, { headers: { "SB-API-KEY-ID": "YOUR_SB_API_KEY_ID", "SB-API-SECRET-KEY": "YOUR_SB_API_SECRET_KEY", }, params: { limit: 50, offset: 0, number: "+12345678912", from_date: "2023-06-15 12:00:00", }, }) .then((response) => { console.log(response.data); }) .catch((error) => { console.log(error); }); ``` -------------------------------- ### Initialize Theme and Data Attributes Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/404.html This JavaScript code initializes the theme based on URL parameters or local storage and sets data attributes on the document element based on URL query parameters starting with 'docusaurus-data-'. It handles potential errors during these operations. ```javascript function t(t){document.documentElement.setAttribute("data-theme",t)} var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}(); t(null!==e?e:"light") ``` ```javascript function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}() ``` -------------------------------- ### JavaScript Theme and Data Attribute Handling Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/webhooks.html This JavaScript code dynamically sets the theme of the document based on URL parameters or local storage. It also processes URL parameters starting with 'docusaurus-data-' to set corresponding data attributes on the document's root element. ```javascript function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}() ``` -------------------------------- ### Sendblue Data Attribute Initialization Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/client-packages.html This JavaScript code iterates through URL search parameters and sets corresponding 'data-' attributes on the document element if the parameter name starts with 'docusaurus-data-'. ```JavaScript function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}() ``` -------------------------------- ### Initialize Sendblue Theme and Data Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs.html This JavaScript code initializes the Sendblue theme based on URL parameters or local storage. It also processes URL parameters starting with 'docusaurus-data-' to set corresponding data attributes on the document element. ```javascript function(){ function t(t){document.documentElement.setAttribute("data-theme",t)} var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}} ()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}(); t(null!==e?e:"light") }(),function(){try{const n=new URLSearchParams(window.location.search).entries(); for(var[t,e]of n) if(t.startsWith("docusaurus-data-")){ var a=t.replace("docusaurus-data-","data-"); document.documentElement.setAttribute(a,e) }} catch(t){} }() ``` -------------------------------- ### Get Messages using cURL Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/get-messages.html This snippet demonstrates how to fetch messages from the Sendblue API using a cURL command. It includes parameters for limiting results, setting an offset, filtering by number, and specifying a date range. Authentication is handled via 'sb-api-key-id' and 'sb-api-secret-key' headers. ```bash curl --location --request GET 'https://api.sendblue.co/accounts/messages?limit=50&offset=10&number=+12345678912&from_date=2023-06-15%2012:00:00' \ --header 'sb-api-key-id: YOUR_SB_API_KEY_ID' \ --header 'sb-api-secret-key: YOUR_SB_API_SECRET_KEY' ``` -------------------------------- ### Sendblue Status Callback Example Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/outbound.html An example of the POST body sent to a status_callback URL by Sendblue when a message status changes. This JSON payload provides details about the message and its updated status, such as 'DELIVERED'. ```json { "accountEmail": "support@sendblue.com", "content": "Hello world!", "is_outbound": true, "status": "DELIVERED", "error_code": null, "error_message": null, "message_handle": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", "date_sent": "2020-09-10T06:15:05.962Z", "date_updated": "2020-09-10T06:15:14.115Z", "from_number": "+15122164639", "number": "+19998887777", "to_number": "+19998887777", "was_downgraded": false, "plan": "blue" } ``` -------------------------------- ### Create Media Object using Node.js (Axios) Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/create-media-object.html This Node.js example uses the Axios library to make a POST request to the Sendblue API for uploading a media object. It includes headers for authentication and a JSON body with the media URL. ```javascript const axios = require("axios"); const url = "https://api.sendblue.co/api/upload-media-object"; axios .post( url, { media_url: "URL_TO_YOUR_MEDIA_OBJECT", }, { headers: { "sb-api-key-id": "YOUR_SB_API_KEY_ID", "sb-api-secret-key": "YOUR_SB_API_SECRET_KEY", }, } ) .then((response) => { console.log(response.data); }) .catch((error) => { console.error(error); }); ``` -------------------------------- ### Contact Creation Success Response Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/contacts.html An example of a successful response (201 Created) when a contact is created via the Sendblue API, showing the status and the details of the created contact. ```json { "status": "OK", "contact": { "id": "contact_abc123", "number": "+1234567890", "firstName": "John", "lastName": "Doe", "companyName": "Acme Corp", "tags": ["customer", "vip"], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } } ``` -------------------------------- ### Theme Toggling Script Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/get-messages.html This JavaScript code handles theme toggling for the Sendblue documentation site. It checks for a theme parameter in the URL or local storage to set the appropriate data attribute on the document element. ```javascript function set_theme(theme) { document.documentElement.setAttribute("data-theme", theme); } var theme_from_url = function() { try { return new URLSearchParams(window.location.search).get("docusaurus-theme"); } catch (e) { // Handle potential errors, though unlikely for URLSearchParams } }(); var theme_from_local_storage = function() { try { return window.localStorage.getItem("theme"); } catch (e) { // Handle potential errors, though unlikely for localStorage } }(); set_theme(theme_from_url !== null ? theme_from_url : (theme_from_local_storage !== null ? theme_from_local_storage : "light")); ``` -------------------------------- ### Retrieve Messages via GET Request Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/get-messages.html This snippet shows the HTTP GET request to retrieve messages from the Sendblue API. It includes the base endpoint and explains the optional query parameters for filtering by conversation ID, phone number, limiting results, pagination, and date filtering. ```http GET https://api.sendblue.co/accounts/messages?cid={conversation_id}&number={phone_number}&limit={limit_count}&offset={offset_count}&from_date={YYYY-MM-DD HH:MM:SS} ``` -------------------------------- ### Lookup Service API Endpoint Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/lookup-api.html This is the GET request URL for the lookup-api endpoint, formerly known as evaluate-service. It requires your Sendblue API credentials for authentication and is available on the Sapphire plan and above. ```HTTP https://api.sendblue.co/api/evaluate-service?number=+19999999999 ``` -------------------------------- ### Docusaurus Data Attribute Script Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/get-messages.html This JavaScript code iterates through URL search parameters that start with 'docusaurus-data-' and sets corresponding data attributes on the document's root element. This is likely used by Docusaurus for dynamic content or theming. ```javascript try { const entries = new URLSearchParams(window.location.search).entries(); for (var [key, value] of entries) { if (key.startsWith("docusaurus-data-")) { var attribute_name = key.replace("docusaurus-data-", "data-"); document.documentElement.setAttribute(attribute_name, value); } } } catch (e) { // Handle potential errors, though unlikely for URLSearchParams } ``` -------------------------------- ### Send Message with Node.js (Axios) Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/outbound.html Example of sending an outbound message using Node.js and the Axios library to the Sendblue API. It demonstrates making a POST request with authentication headers and a JSON payload. ```javascript const axios = require("axios"); const url = `https://api.sendblue.co/api/send-message`; axios .post( url, { number: "+19998887777", from_number: "+16468528190", // the sendblue number you want to use content: "Hello world!", send_style: "invisible", media_url: "https://picsum.photos/200/300.jpg", status_callback: "https://example.com/message-status/1234abcd", }, { headers: { "sb-api-key-id": "YOUR_SB_API_KEY_ID", "sb-api-secret-key": "YOUR_SB_API_SECRET_KEY", "content-type": "application/json", }, } ) .then((response) => { console.log(response.data); }) .catch((error) => { console.error(error); }); ``` -------------------------------- ### Sendblue API Group Message Response Example Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/groups.html Illustrates the structure of a successful API response when sending a group message. It includes details like account email, content, status, message handle, timestamps, sender/recipient numbers, media URL, message type, and the crucial group_id. ```json { "accountEmail": "YOUR EMAIL", "content": "Hello world", "is_outbound": true, "status": "QUEUED", "error_code": null, "error_message": null, "message_handle": "073c1408-a6d9-48e2-ae8c-01f06443833", "date_sent": "2021-05-19T23:07:23.371Z", "date_updated": "2021-05-19T23:07:23.371Z", "from_number": "+19998887777", "number": ["+11112223333", "+13332221111"], "to_number": ["+11112223333", "+13332221111"], "was_downgraded": null, "plan": "blue", "media_url": "https://picsum.photos/200/300.jpg", "message_type": "group", "group_id": "66e3b90d-4447-43c6-9439-15a69408ac2" } ``` -------------------------------- ### Send Expressive Message with JSON Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/expressive-messages.html This example demonstrates how to send a message with a specific send style by including the 'send_style' field in the JSON request body. This allows for effects like 'invisible ink'. ```json { "number": "+19999999999", "content": "check it out - this message is invisible!", "send_style": "invisible" } ``` -------------------------------- ### Docusaurus Data Attribute Script Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/lookup-api.html This JavaScript code iterates through URL search parameters starting with 'docusaurus-data-' and applies them as data attributes to the document's root element. ```javascript function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}() ``` -------------------------------- ### Send Message with cURL Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/outbound.html Example of sending an outbound message using cURL to the Sendblue API. It includes the endpoint, headers for authentication and content type, and a JSON data payload with message details. ```bash curl --location --request POST 'https://api.sendblue.co/api/send-message' \ --header 'sb-api-key-id: YOUR_SB_API_KEY_ID' \ --header 'sb-api-secret-key: YOUR_SB_API_SECRET_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "number": "+19998887777", "content": "Hello world!", "send_style": "invisible", "media_url": "https://picsum.photos/200/300.jpg", "status_callback": "https://example.com/message-status/1234abcd"}' ``` -------------------------------- ### JavaScript: Docusaurus Theme and Data Attributes Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/index.html This JavaScript code handles Docusaurus theme switching and data attribute injection. It reads the theme preference from URL parameters or local storage and applies it to the document's data theme attribute. It also processes URL parameters starting with 'docusaurus-data-' to set corresponding data attributes on the document element. ```JavaScript !function(){ function t(t){ document.documentElement.setAttribute("data-theme",t) } var e=function(){ try{ return new URLSearchParams(window.location.search).get("docusaurus-theme") }catch(t){} }()||function(){ try{ return window.localStorage.getItem("theme") }catch(t){} }(); t(null!==e?e:"light") }(), function(){ try{ const n=new URLSearchParams(window.location.search).entries(); for(var [t,e]of n) if(t.startsWith("docusaurus-data-")){ var a=t.replace("docusaurus-data-","data-"); document.documentElement.setAttribute(a,e) } }catch(t){} }() ``` -------------------------------- ### Sendblue Theme Initialization Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/client-packages.html This JavaScript code initializes the Sendblue theme based on URL parameters or local storage. It sets the 'data-theme' attribute on the document element. ```JavaScript !function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}() ``` -------------------------------- ### Theme and Data Attribute Initialization Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/client-packages.html This JavaScript code initializes the website's theme based on URL parameters or local storage and sets data attributes on the document element based on URL query parameters. ```javascript function(){ function t(t){document.documentElement.setAttribute("data-theme",t)} var e=function(){ try{ return new URLSearchParams(window.location.search).get("docusaurus-theme") }catch(t){} }()||function(){ try{ return window.localStorage.getItem("theme") }catch(t){} }(); t(null!==e?e:"light") }(),function(){ try{ const n=new URLSearchParams(window.location.search).entries(); for(var[t,e]of n) if(t.startsWith("docusaurus-data-")){ var a=t.replace("docusaurus-data-","data-"); document.documentElement.setAttribute(a,e) } }catch(t){} }() ``` -------------------------------- ### Create Media Object using cURL Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/create-media-object.html This cURL command demonstrates how to upload a media object to the Sendblue API. It requires your API key ID and secret key, along with the URL of the media object. ```bash curl --location --request POST 'https://api.sendblue.co/api/upload-media-object' \ --header 'sb-api-key-id: YOUR_SB_API_KEY_ID' \ --header 'sb-api-secret-key: YOUR_SB_API_SECRET_KEY' \ --data-raw '{ "media_url": "URL_TO_YOUR_MEDIA_OBJECT"}' ``` -------------------------------- ### JavaScript for Data Attributes Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/status.html This JavaScript code iterates through URL search parameters starting with 'docusaurus-data-' and sets corresponding data attributes on the document element. ```javascript function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}() ``` -------------------------------- ### Theme and Data Attribute Initialization Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/roadmap.html This JavaScript code initializes the website's theme based on URL parameters or local storage and applies data attributes to the document element based on URL query parameters. It's used for dynamic theming and data injection. ```javascript function(){ function t(t){document.documentElement.setAttribute("data-theme",t)} var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}} ()||function(){try{return window.localStorage.getItem("theme")}catch(t){}} ;t(null!==e?e:"light") }(),function(){ try{ const n=new URLSearchParams(window.location.search).entries(); for(var[t,e]of n) if(t.startsWith("docusaurus-data-")){ var a=t.replace("docusaurus-data-","data-"); document.documentElement.setAttribute(a,e) } } catch(t){} }() ``` -------------------------------- ### Convert Audio to .caf using ffmpeg Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/voice-note.html This command demonstrates how to convert an audio file (e.g., MP3) to the .caf format required by Apple for inline voice notes, using the ffmpeg library. It specifies the input file, output codec, and output file name. ```bash ffmpeg -i input.mp3 -acodec opus -b:a 24k output.caf ``` -------------------------------- ### Sendblue API Sample Response Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/outbound.html This is a sample JSON response from the Sendblue API, illustrating the structure of data returned after a message operation. It includes details like account email, message content, status, and timestamps. ```json { "accountEmail": "YOUR EMAIL", "content": "Hello world!", "is_outbound": true, "status": "QUEUED", "error_code": null, "error_message": null, "message_handle": "dfd747ba-5600-4a8a-804a-a614a0fbc1c5", "date_sent": "2023-09-27T16:35:32.287Z", "date_updated": "2023-09-27T16:35:32.703Z", "from_number": "+16468528190", "number": "+19998887777", "to_number": "+19998887777", "was_downgraded": null, "plan": "dedicated", "media_url": "https://picsum.photos/200/300.jpg", "message_type": "message", "group_id": "", "participants": [], "send_style": "invisible", "opted_out": false, "error_detail": null } ``` -------------------------------- ### Theme Toggling Script Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/message-limits.html This JavaScript code dynamically sets the theme for the Docusaurus website based on URL parameters or local storage. It allows for theme persistence and user preference management. ```javascript function() { function t(t) { document.documentElement.setAttribute("data-theme", t) } var e = function() { try { return new URLSearchParams(window.location.search).get("docusaurus-theme") } catch (t) {} }() || function() { try { return window.localStorage.getItem("theme") } catch (t) {} }(); t(null !== e ? e : "light") }() ``` ```javascript function() { try { const n = new URLSearchParams(window.location.search).entries(); for (var [t, e] of n) if (t.startsWith("docusaurus-data-")) { var a = t.replace("docusaurus-data-", "data-"); document.documentElement.setAttribute(a, e) } } catch (t) {} }() ``` -------------------------------- ### Contact Creation Error Responses Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/contacts.html Illustrates various error responses that can occur during contact creation via the Sendblue API, including bad requests, conflicts, and internal server errors. ```json { "status": "ERROR", "message": "Missing fields" } ``` ```json { "status": "ERROR", "message": "Invalid phone number" } ``` ```json { "status": "ERROR", "message": "Contact already exists" } ``` ```json { "status": "ERROR", "message": "Internal server error message" } ``` -------------------------------- ### Send Voice Note via Node.js (Axios) Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/voice-note.html This snippet shows how to send an Apple voice note using the Sendblue API in a Node.js environment with the Axios library. It includes the necessary headers for authentication and the request body with the recipient's number and the voice note's media URL. ```javascript const axios = require("axios"); const url = `https://api.sendblue.co/api/send-message`; axios.post( url, { number: "+19998887777", media_url: "https://storage.googleapis.com/inbound-file-store/AudioMessage.caf", status_callback: "https://example.com/message-status/1234abcd", }, { headers: { "sb-api-key-id": "YOUR_SB_API_KEY_ID", "sb-api-secret-key": "YOUR_SB_API_SECRET_KEY", "content-type": "application/json", }, } ); ``` -------------------------------- ### Sendblue API: Message Deliverability Fallback Mechanism Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/faq.html Explains Sendblue's multi-level retry mechanism to ensure high message deliverability. It details the fallback from iMessage to SMS via an upstream carrier, and retries via providers like Twilio if SMS fails. It also notes the requirement for a Twilio account and an A2p 10DLC application for sending A2P 10DLC messages. ```javascript function example() { // Fallback from iMessage to SMS via upstream carrier // Retry SMS via Twilio if upstream carrier fails // Requires Twilio account and A2p 10DLC application for A2P 10DLC messages console.log("Message deliverability mechanism explained."); } ``` -------------------------------- ### JavaScript for Theme Toggling Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/status.html This JavaScript code handles theme toggling based on URL parameters or local storage. It sets the 'data-theme' attribute on the document element. ```javascript function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")} ``` -------------------------------- ### Create Contact Request Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/contacts.html This snippet demonstrates how to create a new contact using the Sendblue API via a cURL request. It includes the necessary POST method, endpoint, authentication headers, and a JSON payload with contact details. ```bash curl -X POST https://api.sendblue.co/api/contacts \ -H "Content-Type: application/json" \ -H "sb-api-key-id: your_api_key" \ -H "sb-api-secret-key: your_api_secret" \ -d '{ "number": "+1234567890", "firstName": "John", "lastName": "Doe", "companyName": "Acme Corp", "tags": ["customer", "vip"] }' ``` -------------------------------- ### JavaScript: Docusaurus Base URL Issue Banner Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/index.html This JavaScript code dynamically inserts a banner into the Docusaurus site to alert users about potential base URL configuration issues. It checks for a missing base URL and suggests a correct configuration based on the current path. ```JavaScript function insertBanner(){ var n=document.createElement("div"); n.id="__docusaurus-base-url-issue-banner-container"; n.innerHTML='\n
\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = / (default value)

\n

We suggest trying baseUrl =

\n
\n'; document.body.prepend(n); var e=document.getElementById("__docusaurus-base-url-issue-banner-suggestion-container"); var s=window.location.pathname; var o="/"===s.substr(-1)?s:s+"/"; e.innerHTML=o; } document.addEventListener("DOMContentLoaded",(function(){ void 0===window.docusaurus&&insertBanner() })) ``` -------------------------------- ### Sendblue API Authentication Headers Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/credentials.html When making requests to the Sendblue API, include your API keys in the request headers for authentication. The server expects two specific headers: `SB-API-KEY-ID` for your API Key and `SB-API-SECRET-KEY` for your API Secret. ```HTTP SB-API-KEY-ID: YOUR_API_KEY_ID SB-API-SECRET-KEY: YOUR_API_SECRET_KEY ``` -------------------------------- ### Send Contact Card via Sendblue API Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/contact-card.html This snippet demonstrates how to send a contact card to a specified phone number using the Sendblue API. It requires the recipient's phone number and the URL of the contact card hosted on a CDN. ```json { "number": "+1234567890", "media_url": "https://storage.googleapis.com/inbound-file-store/bettervcard.vcf" } ``` -------------------------------- ### Sendblue API Authentication Headers Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/contacts.html Specifies the required headers for authenticating with the Sendblue API, including the API key ID and secret key. ```http "sb-api-key-id": <>"sb-api-secret-key": <> ``` -------------------------------- ### Send Typing Indicator using cURL Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/typing-indicator.html This snippet demonstrates how to send a typing indicator to a recipient using a cURL command. It includes the necessary headers for authentication and the JSON payload specifying the recipient's number. ```bash curl --location --request POST 'https://api.sendblue.co/api/send-typing-indicator' \ --header 'sb-api-key-id: YOUR_SB_API_KEY_ID' \ --header 'sb-api-secret-key: YOUR_SB_API_SECRET_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "number": "+19998887777" }' ``` -------------------------------- ### Send Group Message API Request Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/groups.html This snippet demonstrates how to send a group message using the Sendblue API. It requires a JSON content type header and specifies the endpoint for group message requests. The API automatically creates the group if it doesn't already exist. ```HTTP POST https://api.sendblue.co/api/send-group-message ``` -------------------------------- ### Lookup Service API Response Structure Source: https://github.com/sendblue-api/sendblue-api.github.io/blob/master/docs/lookup-api.html The API returns a JSON object containing the evaluated phone number and the service it supports, which can be 'iMessage' or 'SMS'. ```JSON { "number": "+19999999999", "service": "iMessage" } ```