Integrations
You can integrate Elastic Path Commerce Cloud with your external systems like enterprise resource planning, order management, fulfilment, and other systems, ensuring that buying is quick and easy for your shoppers.
With integrations, you can trigger custom code, which performs actions outside of the Elastic Path Commerce Cloud ecosystem, from observable events. Events can be delivered in a number of ways, such as a webhook or a message queuing service like Amazon SQS. For example, you can send a discount code or a Net Promoter Score (NPS) survey email a few days after an order is fulfilled. You can do this through a webhook that sends event data to your custom function, or by sending a message that is delivered to your message queue.
Events are processed concurrently. This means that events may not be delivered in the order they are created. For example, if the status of an order is updated multiple times, the events may not be delivered in the same sequence they were updated. Integration events operate on an "at least once" delivery policy. We aim to deliver messages within 30 minutes or less. Ensure that you design your receiving code accordingly.
Integration Object
Attribute | Type | Description |
---|---|---|
id | string | Specifies the unique identifier for the integration. |
type | string | Represents the type of object being returned. |
name | string | Specifies the name of the integration. |
description | string | Specifies a description for the integration. |
integration_type | string | Specifies how the integration is delivered, either webhook , aws_sqs , or stomp |
enabled | boolean | Specifies whether the integration is enabled. |
observes | array[string] | Specifies an array of observable events. |
configuration | object | Specifies a configuration object. |
Types of Integration
Using webhooks, you can have Elastic Path Commerce Cloud deliver events to a configured HTTP endpoint.
warning
Webhooks that return anything other than a 2XX status code, or take more than 30 seconds to respond, are considered failed.
Using message queuing services, you can deliver Elastic Path Commerce Cloud events to a message queue. The advantages of using message queuing services over webhooks are:
- A temporary failure of a webhook endpoint can result in lost events. However, if messages are on your own queue, you can leave the event on the queue to retry later.
- If events take a long time to process, a webhook can timeout, but delivery to a queue is always going to take the same amount of time.
Webhooks
An integration with an integration_type
of webhook
delivers its events to a configured HTTP endpoint.
Response example
{
"data": {
"id": "328b4e0b-4032-48d0-8c85-04cc4c0a331d",
"type": "integration",
"name": "Order shipping notification",
"description": "Send a shipping notification via email with discount code.",
"integration_type": "webhook",
"enabled": true,
"observes": ["order.fulfilled"],
"configuration": {
"url": "https://ilovelamp.now.sh/send-shipped-email",
"secret_key": "SOME_SECRET_KEY"
}
}
}
Message Queuing Services
Elastic Path allows you to integrate with the following message queuing services:
- Amazon Simple Message Queuing Service (SQS).
- Message queuing services that use Simple Text Orientated Messaging Protocol (STOMP), for example, Amazon MQ.
Amazon Simple Message Queuing Service (SQS)
An integration with an integration_type
of aws_sqs
delivers its events directly into the configured AWS SQS queue. These messages can be processed in any appropriate means, such as a Lambda function.
For more information about creating Simple Queue Service (SQS) queues, see the Simple Queue Service (SQS) and SQS Events with CloudFormation sections.
Request example
{
"data": {
"type": "integration",
"name": "Cart updated notifications",
"description": "Send an SQS message when a cart is updated",
"enabled": true,
"observes": ["cart.updated"],
"integration_type": "aws_sqs",
"configuration": {
"url": "https://sqs.eu-west-1.amazonaws.com/123456789/epcc-external-queue",
"aws_access_key_id": "ASIAJLVYNHUWCPKOPSYQ",
"aws_secret_access_key": "mgJteE7dZgSLC2eo2vKsAUWRSnchrWzCRnoDpUSJ",
"region": "eu-west-1"
}
}
}
Response example
201 Created
{
"data": {
"id": "74dcfb94-a294-45f2-b3e5-93e55b6f4240",
"type": "integration",
"integration_type": "aws_sqs",
"name": "Cart updated notifications",
"description": "Send an SQS message when a cart is updated",
"enabled": true,
"configuration": {
"url": "https://sqs.eu-west-1.amazonaws.com/123456789/epcc-external-queue",
"aws_access_key_id": "****************PSYQ",
"aws_secret_access_key": "************************************pUSJ",
"region": "eu-west-1"
},
"observes": ["cart.updated"],
"links": {
"self": "https://api.moltin.com/v2/integrations/74dcfb94-a294-45f2-b3e5-93e55b6f4240"
},
"meta": {
"timestamps": {
"created_at": "2021-08-27T08:41:23.621Z",
"updated_at": "2021-08-27T08:41:23.621Z"
}
}
}
}
Simple Text Orientated Messaging Protocol (STOMP)
An integration with the stomp
integration type delivers its events directly into a configured queue. Any message queuing service that uses STOMP, such as Amazon MQ, can process these messages.
For more information, see the documentation provided with the message queuing service you are using.
Request example
{
"data": {
"type": "integration",
"integration_type": "stomp",
"name": "Customer address updated",
"configuration": {
"addresses": ["stomp://api.moltin.com"],
"destination": "/queue/queue1",
"username": "user1",
"password": "*******d123"
},
"observes": ["address.updated"],
"links": {
"self": "http://api.moltin.com/v2/integrations/4dfa2c76-7d2e-4dda-8875-2b983c691976"
},
"meta": {
"timestamps": {
"created_at": "2021-11-11T10:45:04.688Z",
"updated_at": "2021-11-11T10:45:04.688Z"
}
}
}
}
Response example
201 Created
{
"data": {
"id": "4dfa2c76-7d2e-4dda-8875-2b983c691976",
"type": "integration",
"integration_type": "stomp",
"name": "Customer address updated",
"configuration": {
"addresses": ["stomp://api.moltin.com"],
"destination": "/queue/queue1",
"username": "user1",
"password": "*******d123"
},
"observes": ["address.updated"],
"links": {
"self": "http://api.moltin.com/v2/integrations/4dfa2c76-7d2e-4dda-8875-2b983c691976"
},
"meta": {
"timestamps": {
"created_at": "2021-11-11T10:45:04.688Z",
"updated_at": "2021-11-11T10:45:04.688Z"
}
}
}
}
Related Resources
Concepts
APIs
How-to guides
- [Integration Examples](/commerce-cloud/docs/developer/get-started/integration examples.html)