Open a ticket for a customer
const url = 'https://api.motenya.app/v1/products/example/tickets';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"channelAddress":"example","customer":{"email":"example","name":"example"},"subject":"example","message":"example","reply":{"body":"example","solve":true},"priority":"LOW","assigneeUserId":"example","tags":["example"],"notify":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.motenya.app/v1/products/example/tickets \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "channelAddress": "example", "customer": { "email": "example", "name": "example" }, "subject": "example", "message": "example", "reply": { "body": "example", "solve": true }, "priority": "LOW", "assigneeUserId": "example", "tags": [ "example" ], "notify": true }'For a request that reached you another way (a call, your own form, an AI agent’s hand-off), on one of the product’s email channels. message records what the customer asked; reply is this key’s first answer and leaves the ticket PENDING (or SOLVED with solve). Nothing is sent unless notify is true, which emails reply. The customer’s answers thread back onto the ticket.
Requires tickets:write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The inbound address of one of the product’s email channels; replies go out from it.
object
The customer; replies are emailed here.
What the customer asked (Markdown), recorded as their message. Nothing is sent for it.
A first reply from this key. Give message, reply or both.
object
Markdown; emailed to the customer from the channel only when notify is true.
Mark the ticket solved with this reply.
A teammate with ticket write access.
Email reply to the customer. Default false: the ticket and its reply are recorded, nothing is sent. Without reply there is nothing to send.
Responses
Section titled “Responses”Success
object
object
object
Null for someone the site signed in to the widget by user id alone: replies reach them in the widget, not by email.
The tenant’s own user id, from the widget’s JWT sign-in.
The CRM contact; null for a lead.
Where an imported ticket came from: intercom:<integration id, lowercase> or api:<source, lowercase>.
REPLY adds sendState and sendError; EVENT adds change, merge and automatedReason.
object
The teammate, or apikey:<id> for a key.
object
object
object
Example
{ "ticket": { "status": "OPEN", "priority": "LOW", "source": "EMAIL" }, "messages": [ { "kind": "CUSTOMER" } ]}Invalid request
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Missing, invalid, revoked or expired API key
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Missing scope, API turned off, published article without publish scope, or account suspended
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Not found, or outside the knowledge bases this key may use
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Slug or translation already exists
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Rejected by validation (e.g. unknown language or category)
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Rate limited; see Retry-After
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Internal error