Skip to content

Connect a shop, a SmartBill account or an Intercom workspace

POST
/products/{productId}/integrations
curl --request POST \
--url https://api.motenya.app/v1/products/example/integrations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "type": "magento2", "name": "example", "baseUrl": "example", "credentials": { "additionalProperty": "example" }, "replyChannelAddress": "example", "historyMode": "none", "historyMonths": 1 }'

The shop is checked first. Its websites become stores, and the first sync starts: the catalog, customers and orders changed within the history chosen, then every 15 minutes. A SmartBill account’s company becomes a store; its invoices are imported (POST …/integrations/{id}/invoices) and checked for payment daily. An Intercom workspace brings its contacts into the CRM and its conversations in as tickets, with their whole thread, then keeps them up to date every 15 minutes until you switch over; give the email channel they reply from as replyChannelAddress.

Requires crm:configure.

productId
required
string
>= 1 characters <= 64 characters
Media typeapplication/json
object
type
required
string
Allowed values: magento2 magento1 smartbill intercom
name
required
string
>= 1 characters <= 200 characters
baseUrl

The shop’s https address. Not needed for smartbill. intercom: the workspace’s API region, https://api.intercom.io (default), https://api.eu.intercom.io or https://api.au.intercom.io.

string | null
<= 500 characters
credentials
required

Magento2: { "accessToken" }. magento1: { "apiUser", "apiKey", "currency" } (the shop’s ISO 4217 currency, which its API cannot tell). smartbill: { "username", "token", "cif" } (the SmartBill login email, its API token, and the company’s CIF). intercom: { "accessToken" } (one that can read conversations, contacts and admins).

object
key
additional properties
string
<= 500 characters
replyChannelAddress

Intercom, and required there: the inbound address of the product’s email channel that imported tickets reply from.

string | null
<= 254 characters
historyMode

Shops and help desks. How far back the first sync reaches: none (changes from now on), months (the last historyMonths), full. none when omitted.

string | null
Allowed values: none months full
historyMonths

With months: 1–120, 12 when omitted.

integer | null
>= 1 <= 120

Success

Media typeapplication/json
object
id
required
string
>= 1 characters <= 64 characters
type
required
string
Allowed values: magento2 magento1 smartbill intercom
name
required
string
baseUrl
required
string
status
required

error stops syncing until the address or credentials are fixed.

string
Allowed values: active paused error
historyMode
required
string
Allowed values: none months full
historyMonths
required
integer | null
credentialsHint
required

Which credentials are stored, e.g. “accessToken …a1b2”. They are never returned.

string
source
required

The source its records sync under; look them up with GET /sync/{type}/{source}/{externalId}.

string
replyChannelAddress

Intercom: the email channel imported tickets reply from.

string | null
shop
required
object
name
required
string
websites
required
Array<object>
object
externalId
required
string
name
required
string
currency
required
string
invoiceSeries
required
Array<string>
phase
required
string
Allowed values: history live
runningEntity
required
string | null
Allowed values: catalog_item customer order conversation
counts
required
Array<object>
object
entity
required
string
Allowed values: catalog_item customer order conversation
synced
required
integer
failed
required
integer
lastRecordError
required
object
entity
required
string
Allowed values: catalog_item customer order conversation
externalId
required
string
message
required
string
paymentCheck
required

Smartbill only: the daily check of the imported invoices still unpaid or partly paid.

object
running
required
boolean
current
required
object
checked
required

Invoices asked about.

integer
changed
required

Whose payment status changed.

integer
notFound
required

SmartBill had no such invoice.

integer
last
required
object
checked
required

Invoices asked about.

integer
changed
required

Whose payment status changed.

integer
notFound
required

SmartBill had no such invoice.

integer
at
required
string
syncedUntil
required
string | null
lastRunAt
required
string | null
lastSuccessAt
required
string | null
lastError
required
string | null
nextRunAt
required
string | null
createdAt
required
string
updatedAt
required
string
key
additional properties

Example

{
"type": "magento2",
"status": "active",
"historyMode": "none",
"phase": "history",
"runningEntity": "catalog_item",
"counts": [
{
"entity": "catalog_item"
}
],
"lastRecordError": {
"entity": "catalog_item"
}
}

Invalid request

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Missing, invalid, revoked or expired API key

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Missing scope, API turned off, published article without publish scope, or account suspended

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Not found, or outside the knowledge bases this key may use

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Slug or translation already exists

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Rejected by validation (e.g. unknown language or category)

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Rate limited; see Retry-After

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
field
string
details
Array<object>
object
code
required
string
message
required
string
field
string

Example

{
"error": {
"code": "SLUG_TAKEN"
}
}

Internal error