Skip to content

Widget

The widget route lets a trusted client (typically a server backing your website embed) open a customer-side conversation with a business in your organization and send an initial message.

Endpoint: POST https://me.instaply.com/api/widget/send-message-to-business

HeaderValue
tokenAPI token (same as the Instaply API token header)
Content-Typeapplication/json

Start a conversation directed at a business and send an initial customer message. On success the response includes the customer thread id you can use with other APIs if needed.

{
"businessId": "12345",
"message": "Hello, I need help with my order.",
"user": {
"email": "customer@example.com",
"phoneNumber": "+15551234567",
"locale": "en"
}
}
FieldRequiredDescription
businessIdyesInstaply business (store) id the customer is messaging. Must belong to the same organization as your API token.
messageyesFirst message text.
useryesIdentifies the end customer.
user.emailconditionalValid email format when present.
user.phoneNumberconditionalOptional when present.
user.localenoOptional locale string for the invited user.

user constraint: at least one of email or phoneNumber must be present (both may be sent).

HTTP 200

{
"result": "ok",
"customerThreadId": ""
}

customerThreadId is the conversation identifier returned by the underlying conversations API.

HTTPMeaning
400Validation failed (headers or body). Details follow the shared validator shape for this service.
401Missing or invalid API token (or invalid token header).
403developerMessage: Business does not belong to this organizationbusinessId is not allowed for this API token.
Terminal window
curl -X POST "https://me.instaply.com/api/widget/send-message-to-business" \
-H "token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"businessId": "12345",
"message": "Hello, I need help with my order.",
"user": {
"email": "customer@example.com",
"locale": "en"
}
}'