### Quick Start: Initialize and Use SDK Source: https://developers.respond.io/docs/respond-io-sdk/03bc451ef3f90-overview Initialize the SDK with your API token and perform basic operations like getting a contact or sending a message. ```typescript import { RespondIO } from '@respond-io/typescript-sdk'; const client = new RespondIO({ apiToken: 'your-api-token', }); // Get a contact const contact = await client.contacts.get('id:123'); console.log(contact.firstName, contact.email); // Send a message await client.messaging.send('email:user@example.com', { message: { type: 'text', text: 'Hello from the SDK!', }, }); ``` -------------------------------- ### Run Example Projects Source: https://developers.respond.io/docs/respond-io-sdk/03bc451ef3f90-overview Instructions to run the provided Node.js and TypeScript example projects from the SDK repository. ```bash # Run Node.js example cd examples/nodejs-example npm install npm start # Run TypeScript example cd examples/typescript-example npm install npm start ``` -------------------------------- ### Install Respond.io TypeScript SDK Source: https://developers.respond.io/docs/respond-io-sdk/03bc451ef3f90-overview Install the SDK using npm, yarn, or pnpm. ```bash npm install @respond-io/typescript-sdk ``` ```bash yarn add @respond-io/typescript-sdk ``` ```bash pnpm add @respond-io/typescript-sdk ``` -------------------------------- ### Install Respond.io MCP Server Source: https://developers.respond.io/docs/respond-io-mcp/f18d9ea3ad235-overview Clone the repository, install dependencies, and build the project using Node.js 18+. ```bash # Clone the repository git clone https://github.com/respond-io/mcp-server.git cd mcp-server # Install dependencies npm install # Build the project npm run build ``` -------------------------------- ### Get a Message Response Example Source: https://developers.respond.io/docs/api/8fcf4206c2503-get-a-message This is an example of a successful response when retrieving a message. It includes details such as message ID, contact information, message content, and delivery status. ```json { "messageId": 1262965213, "channelMessageId": "string", "contactId": 123, "channelId": 123, "traffic": "outgoing", "message": { "type": "text", "text": "Message text", "messageTag": "ACCOUNT_UPDATE" }, "status": [ { "value": "pending", "timestamp": 1662965213, "message": "Failed reason" } ], "sender": { "source": "user", "userId": 123456789, "teamId": 123456789 } } ``` -------------------------------- ### List Channels Response Example Source: https://developers.respond.io/docs/api/57c6923fef9e9-list-channels Example of a successful response when listing channels, including channel details and pagination information. ```json { "items": [ { "id": 12345, "name": "string", "source": "facebook", "created_at": 0 } ], "pagination": { "next": "https://api.respond.io/space/channel?limit=10&cursorId=10", "previous": "https://api.respond.io/space/channellimit=10&cursorId=-10" } } ``` -------------------------------- ### API Response Example Source: https://developers.respond.io/docs/api/a748f5bfb1bb5-send-a-message This is an example of a successful response when a message is sent, indicating the message ID. ```json { "messageId": 0 } ``` -------------------------------- ### List Message Templates Response Example Source: https://developers.respond.io/docs/api/muu3hz7hbgnxi-list-message-templates This is an example of a successful response when listing message templates. It includes an array of message templates and pagination details. ```json { "items": [ { "id": 12345, "name": "conversation_follow_up", "components": [ { "type": "header", "format": "text", "text": "Header text", "parameters": [ { "type": "text", "text": "respond.io" } ] } ], "bundle": {}, "channelId": 1234, "botId": 123, "languageCode": "en", "namespace": null, "category": "MARKETING", "status": "approved", "statusDetail": "string", "templateId": "1234" } ], "pagination": { "next": "https://api.respond.io/space/channel/{id}/template?limit=10&cursorId=10", "previous": "https://api.respond.io/space/channel/{id}/template?limit=10&cursorId=-10" } } ``` -------------------------------- ### List Messages Response Example Source: https://developers.respond.io/docs/api/m4ay6be8n8ckc-list-messages This is an example of a successful response when listing messages for a contact. It includes message details, sender information, and pagination controls. ```json { "items": [ { "messageId": 1262965213, "channelMessageId": "string", "contactId": 123, "channelId": 123, "traffic": "outgoing", "message": { "type": "text", "text": "Message text", "messageTag": "ACCOUNT_UPDATE" }, "status": [ { "value": "pending", "timestamp": 1662965213, "message": "Failed reason" } ], "sender": { "source": "user", "userId": 123456789, "teamId": 123456789 } } ], "pagination": { "next": "https://api.respond.io/contact/{identifier}/message/list?limit=10&cursorId=10", "previous": "https://api.respond.io/contact/{identifier}/message/list?limit=10&cursorId=-10" } } ``` -------------------------------- ### List Closing Notes Response Example Source: https://developers.respond.io/docs/api/eb54aa2025ac9-list-closing-notes This is an example of a successful JSON response when listing closing notes. It includes an array of closing note items and pagination details. ```json { "items": [ { "category": "Order Issue", "description": "Conversation dealt with issues related to a specific order." } ], "pagination": { "next": "https://api.respond.io/space/closing_notes?limit=10&cursorId=10", "previous": "https://api.respond.io/space/closing_notes?limit=10&cursorId=-10" } } ``` -------------------------------- ### List Users Response Example Source: https://developers.respond.io/docs/api/96d00b7396970-list-users This is an example of a successful JSON response when listing users. It includes an array of user objects, each containing details like ID, name, email, role, team, and restrictions, along with pagination information. ```json { "items": [ { "id": 123, "firstName": "John", "lastName": "Wick", "email": "test@example.com", "role": "agent", "team": { "id": 123, "name": "Customer Support" }, "restrictions": [ "restrict_data_export" ] } ], "pagination": { "next": "https://api.respond.io/space/user?limit=10&cursorId=10", "previous": "https://api.respond.io/space/user?limit=10&cursorId=-10" } } ``` -------------------------------- ### List Custom Fields Response Example Source: https://developers.respond.io/docs/api/172e05dbb955d-list-custom-fields This is an example of a successful JSON response when listing custom fields. It includes an array of custom field objects and pagination details. ```json { "items": [ { "id": 123, "name": "customer_id", "description": "Customer ID", "dataType": "text", "allowedValues": [ "string" ] } ], "pagination": { "next": "https://api.respond.io/space/contact_field?limit=10&cursorId=10", "previous": "https://api.respond.io/space/contact_field?limit=10&cursorId=-10" } } ``` -------------------------------- ### Create Custom Field Response Example Source: https://developers.respond.io/docs/api/97d54b6d2d240-create-custom-field This is an example of a successful response when creating a custom field. It includes the ID, name, description, data type, and allowed values (if applicable). ```json { "id": 123, "name": "customer_id", "description": "Customer ID", "dataType": "text", "allowedValues": [ "string" ] } ``` -------------------------------- ### Call Ended Webhook Payload Example Source: https://developers.respond.io/docs/webhooks/fa3c070643283-call-ended This example shows the structure of the payload received when a call ends. It includes details for a completed call with recording, transcript, and summary. ```json { "call": { "id": "abcde", "direction": "inbound", "channel": "WhatsApp", "language": "en", "status": "completed", "durationSeconds": 37, "end_time": "1764216241", "start_time": "1764216235", "recordingURL": "https://cdn.respond.io/call/recording/123/abcd1234.mp3", "transcript": [ { "start": 0.079, "end": 27.919, "text": "Hello, ths is John from Smash and Serve, how may I help you?", "speaker": "John" }, { "start": 0.459, "end": 8.019, "text": "Hello, my name is Charles, may I know what is the available color for the Victory racket?", "speaker": "Charles" }, { "start": 8.019, "end": 13.739, "text": "Hello Charles, please give me a moment to check on the available colors.", "speaker": "John" }, { "start": 13.739, "end": 19.76, "text": "Right now the available colors are Crimson Red, Royal Blue, and Oak Green.", "speaker": "John" }, { "start": 19.76, "end": 22.78, "text": "Nice, what time do you guys close today?", "speaker": "Charles" }, { "start": 22.78, "end": 25.6, "text": "We will be opened until 9pm tonight", "speaker": "John" }, { "start": 25.6, "end": 28.619, "text": "Nice, can you reserve a Crimson Red one for me? I can pick it up later around 8.", "speaker": "Charles" }, { "start": 28.619, "end": 30.919, "text": "Sure, can I get your full name and number sir?", "speaker": "John" }, { "start": 30.919, "end": 33.719, "text": "Okay, my full name is Charles Hamilton and my number is 0118889988.", "speaker": "Charles" }, { "start": 33.719, "end": 35.623, "text": "Thank you sir, we have reserved the racket for you, see you later.", "speaker": "John" }, { "start": 35.623, "end": 36.901, "text": "Thank you, see you later", "speaker": "Charles" } ], "callSummary": { "title": "Customer Inquiry and Reservation for Victory Racket", "summary": [ "Charles contacted Smash and Serve to inquire about the available colors for the Victory racket.", "John confirmed the available colors as Crimson Red, Royal Blue, and Oak Green.", "Charles asked about store closing time and was informed it closes at 9 pm.", "Charles requested to reserve a Crimson Red racket for pickup around 8 pm.", "John took Charles’s details and confirmed the reservation." ], "actionItems": [ "John at Smash and Serve will hold the Crimson Red Victory racket reserved for Charles Hamilton.", "Charles Hamilton will pick up the reserved racket around 8 pm today." ] } }, "contact": { "id": "87654321", "firstName": "Charles", "lastName": "Hamilton", "phone": "0118889988" }, "user": { "id": "12345", "firstName": "John", "lastName": "Doe", "email": "john.doe@smashandserve.com", "role": "agent" } } ``` -------------------------------- ### Run Respond.io MCP Server in HTTP Mode Source: https://developers.respond.io/docs/respond-io-mcp/f18d9ea3ad235-overview Set the API key and mode, then start the server. It defaults to port 3000 and is suitable for remote or self-hosted integrations. ```bash # Set your API key and mode export RESPONDIO_API_KEY="your_api_key_here" export MCP_SERVER_MODE=http # Run the server (it will default to port 3000) npm run start:http ``` -------------------------------- ### User Response Example Source: https://developers.respond.io/docs/api/4a9a1b96ad406-get-a-user This is a sample JSON response when successfully retrieving user details. It includes the user's ID, name, email, role, team information, and any assigned restrictions. ```json { "id": 123, "firstName": "John", "lastName": "Wick", "email": "test@example.com", "role": "agent", "team": { "id": 123, "name": "Customer Support" }, "restrictions": [ "restrict_data_export" ] } ``` -------------------------------- ### Get a User (cURL) Source: https://developers.respond.io/docs/api/4a9a1b96ad406-get-a-user Use this cURL command to make a GET request to the API endpoint for retrieving user information. Replace `{id}` with the actual User ID and `123` with your Bearer token. ```curl curl --request GET \ --url https://api.respond.io/v2/space/user/{id} \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### Open Conversation using cURL Source: https://developers.respond.io/docs/api/b9638c61a72ac-open-close-conversation Example of how to open a conversation using a cURL command. Replace {identifier} with the contact's ID, email, or phone number, and '123' with your actual Bearer token. ```shell curl --request POST \ --url https://api.respond.io/v2/contact/{identifier}/conversation/status \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' \ --header 'Content-Type: application/json' \ --data '{ \ "status": "open" \ }' ``` -------------------------------- ### Get a user Source: https://developers.respond.io/docs/api/86480b0024063-space Retrieve a specific user's profile. ```APIDOC ## GET /users/{userId} ### Description Retrieves a specific user's profile. ### Method GET ### Endpoint /users/{userId} ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user to retrieve. ### Response #### Success Response (200) - **user** (object) - The user object. ``` -------------------------------- ### New Contact Event Payload Source: https://developers.respond.io/docs/webhooks/7481022f5f1e2-new-contact This is an example of the JSON payload received when the 'contact.created' webhook is triggered. It includes details about the newly created contact and the event itself. ```APIDOC ## New Contact Webhook ### Description This webhook is triggered when a new contact is created in the system. It provides details about the contact and the event that occurred. ### Event Type `contact.created` ### Request Body Example ```json { "contact": { "id": 1, "firstName": "John", "lastName": "Doe", "phone": "+60123456789", "email": "johndoe@sample.com", "language": "en", "profilePic": "https://cdn.chatapi.com/johndoe.png", "countryCode": "MY", "status": "open", "tags": [ "sampleTag1", "sampleTag2" ], "assignee": { "id": 2, "firstName": "John", "lastName": "Doe", "email": "johndoe@sample.com" }, "created_at": 1663274081 }, "event_type": "contact.created", "event_id": "a96bbd0e-7463-4bdc-a49e-24ca9f183bfb" } ``` ### Contact Object Fields - **id** (integer) - Unique identifier for the contact. - **firstName** (string) - The first name of the contact. - **lastName** (string) - The last name of the contact. - **phone** (string) - The primary phone number of the contact. - **email** (string) - The email address of the contact. - **language** (string) - The preferred language of the contact. - **profilePic** (string) - URL to the contact's profile picture. - **countryCode** (string) - The country code associated with the contact's phone number. - **status** (string) - The current status of the contact. - **tags** (array[string]) - A list of tags associated with the contact. - **assignee** (object) - Information about the user assigned to the contact. - **id** (integer) - Unique identifier for the assignee. - **firstName** (string) - The first name of the assignee. - **lastName** (string) - The last name of the assignee. - **email** (string) - The email address of the assignee. - **created_at** (integer) - Timestamp indicating when the contact was created. *Note: The provided example includes additional fields like `birthday`, `website`, `company_name`, etc., which are documented as `null` in the schema but may be present with actual values in different scenarios.* ``` -------------------------------- ### Verify Webhook Signature in Node.js Source: https://developers.respond.io/docs/webhooks/lwocem4sq812x-overview This example demonstrates how to verify the authenticity of an incoming webhook request using the X-Webhook-Signature header in a Node.js Express application. Ensure the signing key matches the one configured in respond.io. ```javascript const express = require('express'); const bodyParser = require('body-parser'); const { createHmac } = require('crypto'); const app = express() app.use(express.json()); app.use(bodyParser.urlencoded({ extended: true })); app.post('/', (req, res) => { const signature = req.get('X-Webhook-Signature'); const signingKey = 'my-signing-key'; const expectedSignature = createHmac('sha256', signingKey) .update(JSON.stringify(req.body)) .digest('base64') if (signature !== expectedSignature) { return res.status(400).json({ message: 'Invalid signature' }); } res.json({ message: 'ok' }); }); app.listen(3000, () => console.log('Listening on port 3000')); ``` -------------------------------- ### Create Space Tag cURL Request Source: https://developers.respond.io/docs/api/elo4k0lvha55g-create-space-tag Example of how to create a space tag using cURL. Ensure you replace '123' with your actual Bearer token. ```shell curl --request POST \ --url https://api.respond.io/v2/space/tag \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' \ --header 'Content-Type: application/json' \ --data '{ \ "name": "string", \ "description": "string", \ "colorCode": "string", \ "emoji": "string" \ }' ``` -------------------------------- ### API Response Example Source: https://developers.respond.io/docs/api/c923c5127e8b2-assign-unassign-conversation A successful unassignment request returns a JSON object containing the 'contactId' of the affected contact. ```json { "contactId": 0 } ``` -------------------------------- ### List Closing Notes (cURL) Source: https://developers.respond.io/docs/api/eb54aa2025ac9-list-closing-notes Use this cURL command to make a GET request to the API endpoint for listing closing notes. Ensure you replace '123' with your actual Bearer token. ```curl curl --request GET \ --url https://api.respond.io/v2/space/closing_notes \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### Get a User Source: https://developers.respond.io/docs/api/4a9a1b96ad406-get-a-user Retrieves detailed information about a user by their unique ID. This includes their name, email, role, associated team, and workspace restrictions. ```APIDOC ## GET /v2/space/user/{id} ### Description Retrieve information about a user. ### Method GET ### Endpoint https://api.respond.io/v2/space/user/{id} ### Parameters #### Path Parameters - **id** (string) - Required - User ID. ### Request Example ```curl curl --request GET \ --url https://api.respond.io/v2/space/user/{id} \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` ### Response #### Success Response (200) - **id** (integer) - Required - User ID. - **firstName** (string) - Required - User's first name. - **lastName** (string) - Required - User's last name. - **email** (string) - Required - User's email address. - **role** (string) - Required - User role in the workspace. Allowed values: agent, manager, owner. - **team** (object or null) - Required - Information about the user's team. - **id** (integer) - ID of the team. - **name** (string) - Name of the team. - **restrictions** (array[string]) - Required - Constants representing user restrictions at the workspace-level. Allowed values: restrict_data_export, restrict_contact_deletion, restrict_space_settings, show_team_contacts, show_only_mine, restrict_space_integration, restrict_shortcuts. #### Response Example ```json { "id": 123, "firstName": "John", "lastName": "Wick", "email": "test@example.com", "role": "owner", "team": { "id": 123, "name": "Customer Support" }, "restrictions": [ "restrict_data_export" ] } ``` ``` -------------------------------- ### Send a Message using cURL Source: https://developers.respond.io/docs/api/a748f5bfb1bb5-send-a-message This example demonstrates how to send a text message using cURL. Ensure you replace `{identifier}` with the actual contact identifier and `123` with your Bearer token. ```shell curl --request POST \ --url https://api.respond.io/v2/contact/{identifier}/message \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' \ --header 'Content-Type: application/json' \ --data '{ \ "channelId": 0, \ "message": { \ "type": "text", \ "text": "There has been an update in your account..." \ } \ }' ``` -------------------------------- ### Update Space Tag Response Body Source: https://developers.respond.io/docs/api/q2q5hqo96b2wr-update-space-tag This is an example of a successful response when updating a space tag. It includes the updated tag's details. ```json { "id": 0, "name": "string", "description": "string", "emoji": "string", "colorCode": "string" } ``` -------------------------------- ### List Users (cURL) Source: https://developers.respond.io/docs/api/96d00b7396970-list-users Use this cURL command to make a GET request to the List Users API endpoint. Ensure you replace '123' with your actual Bearer token for authentication. This request retrieves a list of users in your workspace. ```shell curl --request GET \ --url https://api.respond.io/v2/space/user \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### List Custom Fields (cURL) Source: https://developers.respond.io/docs/api/172e05dbb955d-list-custom-fields Use this cURL command to make a GET request to the API endpoint for listing custom fields. Ensure you replace '123' with your actual Bearer token. ```curl curl --request GET \ --url https://api.respond.io/v2/space/custom_field \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### Initialize SDK with Options Source: https://developers.respond.io/docs/respond-io-sdk/03bc451ef3f90-overview Initialize the SDK with an API token and optional configuration like baseUrl, maxRetries, and timeout. ```typescript const client = new RespondIO({ apiToken: 'your-api-token-here', baseUrl: 'https://api.respond.io/v2', // optional maxRetries: 3, // optional timeout: 30000, // optional }); ``` -------------------------------- ### SDK Development Commands Source: https://developers.respond.io/docs/respond-io-sdk/03bc451ef3f90-overview Commands for testing, building, linting, formatting, and type checking the SDK. ```bash # Run tests npm test # Build project npm run build # Lint and format npm run lint npm run format # Type check npm run typecheck ``` -------------------------------- ### Get a Message Source: https://developers.respond.io/docs/api/8fcf4206c2503-get-a-message Retrieves a message based on the message ID. You can get the message ID that was returned upon sending through the Send a message endpoint. ```APIDOC ## GET /v2/contact/{identifier}/message/{messageId} ### Description Retrieves a message based on the message ID. You can get the message ID that was returned upon sending through Send a message endpoint. ### Method GET ### Endpoint https://api.respond.io/v2/contact/{identifier}/message/{messageId} ### Parameters #### Path Parameters - **identifier** (string) - Required - Identifier of the contact that can either be a phone number, email or contact ID. Examples: `id:123` , `email:abdc@gmail.com` , `phone:+60121233112` - **messageId** (integer) - Required - 1662965880 ### Responses #### Success Response (200) - **messageId** (integer) - Required - Unique ID of the message - **channelMessageId** (string) - - **contactId** (integer) - Required - ID of the contact to which the message was sent. - **channelId** (integer) - Required - **traffic** (string) - Required - Defines if the message was received or sent. Allowed values: `outgoing`, `incoming` - **message** (object) - - **type** (any) - Required - Allowed value: `text` - **text** (string) - Required - Example: Message text - **messageTag** (string) - Required if the channel is `facebook` or `instagram` and the message is being sent outsde the standard 24 hour messaging window. Reference. Allowed values: `ACCOUNT_UPDATE`, `POST_PURCHASE_UPDATE`, `CONFIRMED_EVENT_UPDATE` - **status** (array[object]) - The delivery statuses of the message - **value** (string) - Required - Allowed values: `pending`, `sent`, `delivered`, `read`, `failed` - **timestamp** (integer) - Required - Unix timestamp in seconds - **message** (string) - Reason of the failure. - **sender** (object) - - **source** (string) - Example: `user` - **userId** (string) - Example: `123456789` - **teamId** (string) - Example: `123456789` ### Request Example ```json { "example": "request body" } ``` ### Response Example ```json { "messageId": 1262965213, "channelMessageId": "string", "contactId": 123, "channelId": 123, "traffic": "outgoing", "message": { "type": "text", "text": "Message text", "messageTag": "ACCOUNT_UPDATE" }, "status": [ { "value": "pending", "timestamp": 1662965213, "message": "Failed reason" } ], "sender": { "source": "user", "userId": "123456789", "teamId": "123456789" } } ``` ``` -------------------------------- ### Run Respond.io MCP Server in STDIO Mode Source: https://developers.respond.io/docs/respond-io-mcp/f18d9ea3ad235-overview Configure an AI client like Claude Desktop to use the MCP server via STDIO mode using npx. This mode is recommended for local development. ```json { "command": "npx", "args": [ "@respond-io/mcp-server" ], "env": { "RESPONDIO_API_KEY": "your_api_key_here", "MCP_SERVER_MODE": "stdio" } } ``` -------------------------------- ### Get a Custom Field (cURL) Source: https://developers.respond.io/docs/api/39674868df3f2-get-a-custom-field Use this cURL command to make a GET request to retrieve a specific custom field. Replace `{id}` with the actual custom field ID and `123` with your Bearer token. ```curl curl --request GET \ --url https://api.respond.io/v2/space/custom_field/{id} \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### Get a message Source: https://developers.respond.io/docs/api/42fc125b57906-messaging Retrieve a specific message by its ID. ```APIDOC ## GET /messages/{id} ### Description Retrieve a specific message by its ID. ### Method GET ### Endpoint /messages/{id} ### Response #### Success Response (200) - **message_id** (string) - The ID of the message. - **conversation_id** (string) - The ID of the conversation. - **content** (string) - The message content. - **sent_at** (string) - The timestamp when the message was sent. - **sender** (object) - Information about the sender. ``` -------------------------------- ### Open Website Chat Widget Source: https://developers.respond.io/docs/website-chat-widget/iobv5j9au5o6w-website-chat Use this command to open the chat widget. It can be called directly or via the window object. ```javascript $respond.do("chat:open") ``` ```javascript window.$respond.do("chat:open") ``` -------------------------------- ### Get a custom field Source: https://developers.respond.io/docs/api/86480b0024063-space Retrieve details of a specific custom field. ```APIDOC ## GET /custom-fields/{fieldId} ### Description Retrieves details of a specific custom field. ### Method GET ### Endpoint /custom-fields/{fieldId} ### Parameters #### Path Parameters - **fieldId** (string) - Required - The ID of the custom field to retrieve. ### Response #### Success Response (200) - **customField** (object) - The custom field object. ``` -------------------------------- ### List Users Source: https://developers.respond.io/docs/api/96d00b7396970-list-users Fetches a list of users in your workspace. Users with pending invitations are not included. Supports pagination via cursorId and limit. ```APIDOC ## GET /v2/space/user ### Description Get a list of users in your workspace. Users with pending invitations are not included in the response. ### Method GET ### Endpoint https://api.respond.io/v2/space/user ### Parameters #### Query Parameters - **cursorId** (integer) - Optional - Pointer to the contact `id` from where the next batch of records should start from. - **limit** (integer) - Optional - Number of items to return i.e. page size. Must be between 1 and 100. Defaults to 10. ### Request Example ```curl curl --request GET \ --url https://api.respond.io/v2/space/user \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` ### Response #### Success Response (200) - **items** (array[object]) - Required - List of user objects. - **id** (integer) - Required - User ID. - **firstName** (string) - Required - User's first name. - **lastName** (string) - Required - User's last name. - **email** (string) - Required - User's email address. - **role** (string) - Required - User role in the workspace. Allowed values: agent, manager, owner. - **team** (object or null) - Required - User's team information. - **restrictions** (array[string]) - Required - Constants representing user restrictions at the workspace-level. Allowed values: restrict_data_export, restrict_contact_deletion, restrict_space_settings, show_only_mine, show_team_contacts, restrict_space_integration, restrict_shortcuts. - **pagination** (object) - Required - Pagination details. - **next** (string) - Required - URL for the next page of results. - **previous** (string) - Required - URL for the previous page of results. #### Response Example ```json { "items": [ { "id": 123, "firstName": "John", "lastName": "Wick", "email": "test@example.com", "role": "agent", "team": { "id": 123, "name": "Customer Support" }, "restrictions": [ "restrict_data_export" ] } ], "pagination": { "next": "https://api.respond.io/space/user?limit=10&cursorId=10", "previous": "https://api.respond.io/space/user?limit=10&cursorId=-10" } } ``` ``` -------------------------------- ### Open Chat Source: https://developers.respond.io/docs/website-chat-widget/iobv5j9au5o6w-website-chat Handles the chat widget opened event (triggers your `callback` function). Use this to programmatically open the chat widget. ```APIDOC ## Open Chat ### Description Handles the chat widget opened event (triggers your `callback` function). ### Method JavaScript ### Endpoint N/A (JavaScript method) ### Code Example ```javascript window.$respond.do("chat:open"); ``` ``` -------------------------------- ### List Message Templates (cURL) Source: https://developers.respond.io/docs/api/muu3hz7hbgnxi-list-message-templates Use this cURL command to fetch all message templates for a given channel ID. Ensure you replace `{id}` with the actual channel ID and `123` with your Bearer token. ```curl curl --request GET \ --url https://api.respond.io/v2/space/channel/{id}/template \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### List Channels Source: https://developers.respond.io/docs/api/57c6923fef9e9-list-channels Fetches all messaging channels connected in the workspace. Supports pagination using cursorId and limit parameters. ```curl curl --request GET \ --url https://api.respond.io/v2/space/channel \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` -------------------------------- ### Conversation Closed Webhook Payload Source: https://developers.respond.io/docs/webhooks/4d24adaa88d90-conversation-closed This is an example of the JSON payload received when the conversation.closed webhook is triggered. It includes information about the contact, conversation details, and event metadata. ```APIDOC ## Conversation Closed Webhook ### Description This webhook is triggered when a conversation is closed. It provides details about the contact, the conversation, and the event that caused it to close. ### Event Type `conversation.closed` ### Payload Structure #### contact - **id** (integer) - The unique identifier for the contact. - **firstName** (string) - The first name of the contact. - **lastName** (string) - The last name of the contact. - **phone** (string) - The phone number of the contact. - **email** (string) - The email address of the contact. - **language** (string) - The preferred language of the contact. - **profilePic** (string) - URL to the contact's profile picture. - **countryCode** (string) - The country code associated with the contact. - **status** (string) - The current status of the contact. - **assignee** (object) - Information about the assigned agent. - **id** (integer) - The unique identifier for the assignee. - **firstName** (string) - The first name of the assignee. - **lastName** (string) - The last name of the assignee. - **email** (string) - The email address of the assignee. - **created_at** (integer) - Timestamp when the contact was created. #### conversation - **category** (string) - The category assigned to the conversation. - **summary** (string) - A brief summary of the conversation. - **openedTime** (integer) - Timestamp when the conversation was opened. - **openedBySource** (string) - The source through which the conversation was opened (e.g., 'user', 'api'). - **closedTime** (integer) - Timestamp when the conversation was closed. - **closedBy** (object) - Information about who closed the conversation. - **id** (null) - The unique identifier for the user who closed the conversation (null if closed by API). - **firstName** (null) - The first name of the user who closed the conversation. - **lastName** (null) - The last name of the user who closed the conversation. - **email** (null) - The email address of the user who closed the conversation. - **closedBySource** (string) - The source through which the conversation was closed (e.g., 'api'). - **firstResponseTime** (integer) - Timestamp of the first response. - **resolutionTime** (integer) - Timestamp when the conversation was resolved. - **incomingMessageCount** (integer) - The total number of incoming messages. - **outgoingMessageCount** (integer) - The total number of outgoing messages. - **assigneeTeam** (string) - The team assigned to the conversation. - **lastAssignmentTime** (integer) - Timestamp of the last assignment. #### event_type - **event_type** (string) - Always `conversation.closed` for this webhook. #### event_id - **event_id** (string) - A unique identifier for this specific event. ### Example ```json { "contact": { "id": 1, "firstName": "John", "lastName": "Doe", "phone": "+60123456789", "email": "johndoe@sample.com", "language": "en", "profilePic": "https://cdn.chatapi.com/johndoe.png", "countryCode": "MY", "status": "open", "assignee": { "id": 2, "firstName": "John", "lastName": "Doe", "email": "johndoe@sample.com" }, "created_at": 1663274081 }, "conversation": { "category": "sampleCategory", "summary": "sample summary", "openedTime": 1663274081, "openedBySource": "user", "closedTime": 1663274081, "closedBy": { "id": null, "firstName": null, "lastName": null, "email": null }, "closedBySource": "api", "firstResponseTime": 1663274081, "resolutionTime": 1663274081, "incomingMessageCount": 10, "outgoingMessageCount": 5, "assigneeTeam": "My team", "lastAssignmentTime": 1663274081 }, "event_type": "conversation.closed", "event_id": "563eddae-a807-48b8-9a8a-f02dc3bc25cc" } ``` ``` -------------------------------- ### Create a comment Source: https://developers.respond.io/docs/api/d238b5b76eaaa-comment Utilize the Comment API to create a comment in a workspace. ```APIDOC ## POST /comment ### Description Creates a new comment within a workspace. ### Method POST ### Endpoint /comment ### Request Body - **content** (string) - Required - The text content of the comment. - **contact_id** (string) - Required - The ID of the contact to associate the comment with. - **user_id** (string) - Optional - The ID of the user creating the comment. If not provided, the system may use the authenticated user. ### Request Example ```json { "content": "This is a test comment.", "contact_id": "con_abc123", "user_id": "usr_xyz789" } ``` ### Response #### Success Response (201 Created) - **id** (string) - The unique identifier for the created comment. - **content** (string) - The content of the comment. - **contact_id** (string) - The ID of the contact the comment is associated with. - **user_id** (string) - The ID of the user who created the comment. - **created_at** (string) - The timestamp when the comment was created. #### Response Example ```json { "id": "cmt_def456", "content": "This is a test comment.", "contact_id": "con_abc123", "user_id": "usr_xyz789", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get a Custom Field by ID Source: https://developers.respond.io/docs/api/39674868df3f2-get-a-custom-field This endpoint retrieves all information about a custom field, identified by its unique ID. You must provide the custom field's ID in the path. ```APIDOC ## GET /v2/space/custom_field/{id} ### Description Get more information about a custom field. You would need to provide the unique custom field ID. ### Method GET ### Endpoint https://api.respond.io/v2/space/custom_field/{id} ### Parameters #### Path Parameters - **id** (string) - Required - ID of the custom field ### Responses #### Success Response (200) - **id** (integer) - Required - Custom field ID. - **name** (string) - Required - Name of the custom field. - **description** (string) - Required - Description of the custom field. - **dataType** (string) - Required - Type of the data stored in this custom field. Allowed values: text, list, checkbox, email, number, url, datetime - **allowedValues** (array[string]) - List of enum values allowed to be stored in this field. This property is applicable only if the `dataType` is `list`. ### Request Example ```curl curl --request GET \ --url https://api.respond.io/v2/space/custom_field/{id} \ --header 'Accept: application/json' \ --header 'Authorization: Bearer 123' ``` ### Response Example ```json { "id": 123, "name": "customer_id", "description": "Customer ID", "dataType": "text", "allowedValues": [ "string" ] } ``` ``` -------------------------------- ### Create Space Tag Source: https://developers.respond.io/docs/api/86480b0024063-space Create a new tag within the space. ```APIDOC ## POST /space-tags ### Description Creates a new tag. ### Method POST ### Endpoint /space-tags ### Request Body - **name** (string) - Required - The name of the tag. ### Response #### Success Response (200) - **spaceTag** (object) - The created space tag object. ``` -------------------------------- ### Call Ended Webhook Payload Example Source: https://developers.respond.io/docs/webhooks/fa3c070643283-call-ended This JSON object represents the payload structure for the Call Ended webhook. It contains details about the phone number and the user associated with the call. ```json { "phone": { "phone": "+60123456789" }, "user": { "id": "12345678", "firstName": "John", "lastName": "Doe", "email": "john.doe@respond.io", "role": "owner" } } ``` -------------------------------- ### Listen for Chatbox Opened Event Source: https://developers.respond.io/docs/website-chat-widget/iobv5j9au5o6w-website-chat Attaches a callback function to be executed when the chat widget is opened. ```javascript window.$respond.on("chat:opened", callback) ``` -------------------------------- ### List channels Source: https://developers.respond.io/docs/api/86480b0024063-space Retrieve a list of available channels. ```APIDOC ## GET /channels ### Description Retrieves a list of available channels. ### Method GET ### Endpoint /channels ### Response #### Success Response (200) - **channels** (array) - A list of channel objects. ``` -------------------------------- ### Contact Updated Webhook Payload Source: https://developers.respond.io/docs/webhooks/9e48d366dbf7c-contact-updated This is an example of the JSON payload received when the Contact Updated webhook is triggered. It includes the updated contact object, the event type, and a unique event ID. ```APIDOC ## Contact Updated Webhook ### Description This webhook is triggered when a contact's information is updated. The payload contains the full updated contact object. ### Event Type `contact.updated` ### Payload Structure #### contact (object) - **id** (integer) - The unique identifier for the contact. - **firstName** (string) - The first name of the contact. - **lastName** (string) - The last name of the contact. - **phone** (string) - The primary phone number of the contact. - **email** (string) - The primary email address of the contact. - **language** (string) - The preferred language of the contact. - **profilePic** (string) - URL to the contact's profile picture. - **countryCode** (string) - The country code associated with the contact's phone number. - **status** (string) - The current status of the contact (e.g., 'open'). - **tags** (array[string]) - A list of tags associated with the contact. - **assignee** (object) - Information about the assignee. - **id** (integer) - The unique identifier for the assignee. - **firstName** (string) - The first name of the assignee. - **lastName** (string) - The last name of the assignee. - **email** (string) - The email address of the assignee. - **created_at** (integer) - Timestamp indicating when the contact was created. *Note: Other fields like `birthday`, `website`, `company_name`, etc., may be present but are marked as null in this example or are optional.* #### event_type (string) Indicates the type of event, which is `contact.updated` for this webhook. #### event_id (string) A unique identifier for this specific event. ### Request Example ```json { "contact": { "id": 1, "firstName": "John", "lastName": "Doe", "phone": "+60123456789", "email": "johndoe@sample.com", "language": "en", "profilePic": "https://cdn.chatapi.com/johndoe.png", "countryCode": "MY", "status": "open", "tags": [ "sampleTag1", "sampleTag2" ], "assignee": { "id": 2, "firstName": "John", "lastName": "Doe", "email": "johndoe@sample.com" }, "created_at": 1663274081 }, "event_type": "contact.updated", "event_id": "5733378c-ec01-4bef-87a0-023edcda63f2" } ``` ```