Go to Welcome view

Table of Contents

  1. Overview

  2. Configuration

  3. Topics:

    1. Offer created
    2. Offer Status changed
    3. Opportunity created
    4. Opportunity updated
    5. Opportunity status opened
    6. Opportunity status_closed
    7. Opportunity status_reseted
    8. Register lead
    9. Autogenerated reports
    10. Incidence status opened
    11. Incidence status_closed
    12. Incidence status_reseted
    13. Incidence created
    14. Incidence updated
    15. User created
    16. User deleted

Client integration via SQS queues

Overview

This document provides a general view of the integration with client systems through message queues. Some actions in Ezzing API will trigger messages to be enqueued, so it can be consumed by the client. The following schema describes the architecture behind this functionality.

Configuration

When a client requests this functionality we must create a user in aws for each environment with specific permissions to consume and delete messages in its queue. We must provide these keys to the client, so they can develop the logic in the message consumer. Also, they would need the queue url and the queue name.

Events that triggers a message to be queued

Offer created

When an offer is created in Ezzing api a message with following information will be queued. ####(only from platform)

{
    "uuid": "e4d15496-35e5-47c4-aa7a-ebe33e939cb5",
    "displayName": "offer_created",
    "job": "offer_created",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "opportunity_id": "19",
        "offer_type_id": "1",
        "name": "test",
        "created_by_id": 1,
        "offer_status_id": 1,
        "updated_at": "2021-03-24 15:44:38",
        "created_at": "2021-03-24 15:44:38",
        "id": 14
    }
}

Offer Status changed

This message can be triggered by different actions. When a call to change offer status is made one message with the offer and the current status would be triggered. When an offer is signed one message with the offer signed is enqueued and as many messages as offers have been rejected will be enqueued to. When an offer is accepted one message with the offer accepted is enqueued and as many messages as offers has been rejected will be enqueued to The message is quite similar to the offer created message ####(only from platform)

{
    "uuid": "3c482219-8d87-49c8-8804-03213e99959e",
    "displayName": "offer_status_changed",
    "job": "offer_status_changed",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 14,
        "opportunity_id": 19,
        "offer_type_id": 1,
        "created_by_id": 1,
        "name": "test",
        "is_locked": 0,
        "created_at": "2021-03-24 15:44:38",
        "updated_at": "2021-03-24 16:13:49",
        "offer_status": {
            "id": 4,
            "name": "Accepted",
            "slug": "accepted"
        }
    }
}

Opportunity created

When a new opportunity is created a message with following body will be enqueued. ####(platform & api rest)

current_status_id will be deprecated in next api version

{
    "uuid": "c3420aee-1ee0-4b16-a05d-0c85f66ef72d",
    "displayName": "opportunity_created",
    "job": "opportunity_created",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 13,
        "opportunity_type_id": "1",
        "client_id": "18",
        "campaign_id": 13,
        "current_status_id": 2,
        "country_id": "1",
        "name": "test",
        "address": "test",
        "zipcode": "test123",
        "city": "test",
        "province": "test",
        "latitude": 0.82,
        "longitude": 29.81,
        "notes": null,
        "external_uuid": "564",
        "folder_id": "556464",
        "created_at": "2021-01-14 11:10:48",
        "updated_at": "2021-03-24 16:23:31",
        "current_status_opened_at": "2021-12-03 07:37:57",
        "current_status": {
            "id": 2,
            "opportunity_type_id": 1,
            "depends_on": 1,
            "name": "Novo cliente",
            "slug": "novo-cliente",
            "description": "decription_test.",
            "position": 0,
            "icon": "Flagpole",
            "color": "e28d43",
            "close_opportunity": 0,
            "estimated_time": 0,
            "unit": "h",
            "created_at": "2020-10-05 09:44:41",
            "updated_at": "2021-10-07 11:42:09",
            "location_opportunity_statuses": [
                {
                    "location_name": "Client portal",
                    "location_slug": "client-portal",
                    "public_name": "Public name",
                    "public_description": "Public description",
                    "created_at": "2023-05-05 15:00:00",
                    "updated_at": "2023-05-05 15:00:00"
                }
            ]
        },
        "client": {
            "id": 3,
            "name": "test",
            "surname": "test",
            "phone": "112354487",
            "email": "test@test.com",
            "lead_id": 4
        }
    }
}

Opportunity updated

When information related with opportunity is updated a message with given information is enqueued. ####(platform & api rest)

current_status_id will be deprecated in next api version

{
    "uuid": "c3420aee-1ee0-4b16-a05d-0c85f66ef72d",
    "displayName": "opportunity_updated",
    "job": "opportunity_updated",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 13,
        "opportunity_type_id": "1",
        "client_id": "18",
        "campaign_id": 13,
        "current_status_id": 2,
        "country_id": "1",
        "name": "test",
        "address": "test",
        "zipcode": "test123",
        "city": "test",
        "province": "test",
        "latitude": 0.82,
        "longitude": 29.81,
        "notes": null,
        "external_uuid": "564",
        "folder_id": "556464",
        "created_at": "2021-01-14 11:10:48",
        "updated_at": "2021-03-24 16:23:31",
        "current_status_opened_at": "2021-12-03 07:37:57",
        "current_status": {
            "id": 2,
            "opportunity_type_id": 1,
            "depends_on": 1,
            "name": "Novo cliente",
            "slug": "novo-cliente",
            "description": "decription_test.",
            "public_description": "description_test",
            "position": 0,
            "icon": "Flagpole",
            "color": "e28d43",
            "close_opportunity": 0,
            "estimated_time": 0,
            "unit": "h",
            "created_at": "2020-10-05 09:44:41",
            "updated_at": "2021-10-07 11:42:09",
            "location_opportunity_statuses": [
                {
                    "location_name": "Client portal",
                    "location_slug": "client-portal",
                    "public_name": "Public name",
                    "public_description": "Public description",
                    "created_at": "2023-05-05 15:00:00",
                    "updated_at": "2023-05-05 15:00:00"
                }
            ]
        },
        "client": {
            "id": 3,
            "name": "test",
            "surname": "test",
            "phone": "112354487",
            "email": "test@test.com",
            "lead_id": 4
        }
    }
}

Opportunity status opened

The message enqueued will have the following body:

{
    "uuid": "f5a48ea1-2afc-4aa6-ae57-a422e9366e56",
    "displayName": "opportunity_status_opened",
    "job": "opportunity_status_opened",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 21,
        "opportunity_type_id": 1,
        "client_id": 17,
        "campaign_id": 13,
        "current_status_id": 7,
        "country_id": 2,
        "name": "Comercial: facilis",
        "address": "79216 Kamryn Branch Apt. 247",
        "zipcode": "Ut.",
        "city": "North Donavon",
        "province": "Missouri",
        "latitude": "55.86222400",
        "longitude": "66.05362800",
        "notes": null,
        "external_uuid": null,
        "folder_id": "556464",
        "created_at": "2021-08-06 09:23:39",
        "updated_at": "2021-08-11 07:55:35",
        "current_status": {
            "id": 7,
            "name": "Generar oferta",
            "slug": "generar-oferta"
        },
        "opened_status": {
            "name": "Generar oferta",
            "slug": "generar-oferta",
            "opportunity_status_id": 7,
            "action": "opened"
        },
        "client": {
            "id": 3,
            "name": "test",
            "surname": "test",
            "phone": "112354487",
            "email": "test@test.com",
            "lead_id": 4
        }
    }
}

Opportunity status closed

The message enqueued will have the following body:

{
    "uuid": "ee2ff9b1-059d-454d-a8c9-cd9276987dfb",
    "displayName": "opportunity_status_closed",
    "job": "opportunity_status_closed",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 21,
        "opportunity_type_id": 1,
        "client_id": 17,
        "campaign_id": 13,
        "current_status_id": 7,
        "country_id": 2,
        "name": "Comercial: facilis",
        "address": "79216 Kamryn Branch Apt. 247",
        "zipcode": "Ut.",
        "city": "North Donavon",
        "province": "Missouri",
        "latitude": "55.86222400",
        "longitude": "66.05362800",
        "notes": null,
        "external_uuid": null,
        "folder_id": "556464",
        "created_at": "2021-08-06 09:23:39",
        "updated_at": "2021-08-11 07:55:35",
        "current_status": {
            "id": 7,
            "name": "Generar oferta",
            "slug": "generar-oferta"
        },
        "closed_status": {
            "name": "Generar oferta",
            "slug": "generar-oferta",
            "opportunity_status_id": 7,
            "action": "closed"
        },
        "client": {
            "id": 3,
            "name": "test",
            "surname": "test",
            "phone": "112354487",
            "email": "test@test.com",
            "lead_id": 4
        }
    }
}

Opportunity status reseted

The message enqueued will have the following body:

{
    "uuid": "92940e71-1981-40c0-bd49-81744b262f77",
    "displayName": "opportunity_status_reseted",
    "job": "opportunity_status_reseted",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 21,
        "opportunity_type_id": 1,
        "client_id": 17,
        "current_status_id": 7,
        "country_id": 2,
        "name": "Comercial: facilis",
        "address": "79216 Kamryn Branch Apt. 247",
        "zipcode": "Ut.",
        "city": "North Donavon",
        "province": "Missouri",
        "latitude": "55.86222400",
        "longitude": "66.05362800",
        "notes": null,
        "external_uuid": null,
        "folder_id": "556464",
        "created_at": "2021-08-06 09:23:39",
        "updated_at": "2021-08-11 07:55:35",
        "current_status": {
            "id": 7,
            "name": "Generar oferta",
            "slug": "generar-oferta"
        },
        "reset_status": {
            "name": "Generar oferta",
            "slug": "generar-oferta",
            "opportunity_status_id": 7,
            "action": "reset"
        },
        "client": {
            "id": 3,
            "name": "test",
            "surname": "test",
            "phone": "112354487",
            "email": "test@test.com",
            "lead_id": 4
        }
    }
}

Register lead

When a lead is registered in Ezzing api a message with following information will be queued.

{
    "uuid": "e4d15496-35e5-47c4-aa7a-ebe33e939cb5",
    "displayName": "lead_has_been_registered",
    "job": "lead_has_been_registered",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "name": "maria",
        "surname": "lopez",
        "address": "calle juan gris 1",
        "zipcode": "28100",
        "city": "madrid",
        "province": "madrid",
        "phone": "123456",
        "email": "m.lopez@hm.com",
        "latitude": 20.284494,
        "longitude": 9.027065,
        "updated_at": "2021-03-24 15:44:38",
        "created_at": "2021-03-24 15:44:38",
        "id": 14
    }

}

Autogenerated reports

Messages with following information will be queued when given some report tags, generate all the reports associated to those tags, already with the variables filled in Ezzing api.

{
    "uuid": "2e391e1b-2d46-43c1-ae7e-7463eb5b5df5",
    "displayName": "generated_reports",
    "job": "generated_reports",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "report_tag_slug": "a-given-rt",
        "opportunity_id": 469,
        "files": [
            {
                "file_id": 89239,
                "file_name": "CTE Mon Dec 20 11:12:00 2021.pdf"
            },
            {
                "file_id": 89240,
                "file_name": "CTE Mon Dec 20 12:41:35 2021.pdf"
            }
        ],
        "failed_reports": [
            {
                "report_id": 67,
                "report_name": "CTE"
            }
        ]
    }
}

Incidence status opened

The message enqueued will have the following body:

{
    "uuid": "a87ba6da-dc85-4d81-9079-63eed3c47a06",
    "displayName": "incidence_status_opened",
    "job": "incidence_status_opened",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 2,
        "created_by": 102,
        "created_by_user_id": 3,
        "created_by_client_id": null,
        "opportunity_id": 1,
        "incidence_type_id": 5,
        "incidence_status_id": 7,
        "title": "my incidence 2",
        "description": "sdf",
        "closed_at": null,
        "created_at": "2022-05-05 15:05:21",
        "updated_at": "2022-05-05 15:05:21",
        "alarm_id": null,
        "incidence_type": {
            "id": 1,
            "name": "COMERCIALIZACIÓN PRE VENTA",
            "slug": "gestion-ayudas"
        },
        "incidence_status": {
            "id": 7,
            "name": "Open",
            "slug": "open",
            "color": "000000"
        },
        "opened_status": {
            "name": "Open",
            "slug": "open",
            "incidence_status_id": 7,
            "action": "opened"
        }
    }
}

Incidence status closed

The message enqueued will have the following body:

{
    "uuid": "0bdb814b-6770-4d02-8f96-e06ac17f2192",
    "displayName": "incidence_status_closed",
    "job": "incidence_status_closed",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 1,
        "created_by": 102,
        "created_by_user_id": 3,
        "created_by_client_id": null,
        "opportunity_id": 1,
        "incidence_type_id": 3,
        "incidence_status_id": 7,
        "title": "my incidence 1",
        "description": "sdf",
        "closed_at": null,
        "created_at": "2022-05-05 10:01:03",
        "updated_at": "2022-05-05 10:01:03",
        "alarm_id": null,
        "incidence_type": {
            "id": 1,
            "name": "COMERCIALIZACIÓN PRE VENTA",
            "slug": "gestion-ayudas"
        },
        "incidence_status": {
            "id": 7,
            "name": "Open",
            "slug": "open",
            "color": "000000"
        },
        "closed_status": {
            "name": "Open",
            "slug": "open",
            "incidence_status_id": 7,
            "action": "closed"
        }
    }
}

Incidence status reseted

The message enqueued will have the following body:

{
    "uuid": "c47486e6-2f8d-4fea-a81c-c03b8d3b473c",
    "displayName": "incidence_status_reseted",
    "job": "incidence_status_reseted",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 1,
        "created_by": 102,
        "assigned_to": null,
        "opportunity_id": 1,
        "incidence_type_id": 3,
        "created_by_user_id": 3,
        "created_by_client_id": null,
        "incidence_status_id": 7,
        "title": "my incidence 1",
        "description": "sdf",
        "closed_at": null,
        "created_at": "2022-05-05 10:01:03",
        "updated_at": "2022-05-05 10:01:03",
        "alarm_id": null,
        "incidence_type": {
            "id": 1,
            "name": "COMERCIALIZACIÓN PRE VENTA",
            "slug": "gestion-ayudas"
        },
        "incidence_status": {
            "id": 7,
            "name": "Open",
            "slug": "open",
            "color": "000000"
        },
        "reset_status": {
            "name": "Open",
            "slug": "open",
            "incidence_status_id": 7,
            "action": "reset"
        }
    }
}

Incidence created

Messages with following information will be queued when an incidence is created in Ezzing api.

{
    "uuid": "2e391e1b-2d46-43c1-ae7e-7463eb5b5df6",
    "displayName": "incidence_created",
    "job": "incidence_created",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 324,
        "created_by_user_id": 3,
        "created_by_client_id": null,
        "opportunity_id": 1587,
        "incidence_type_id": 7,
        "incidence_status_id": 210,
        "title": "Incidence H",
        "description": "Lorem ipsum",
        "closed_at": "2022-11-15T12:54:51.000000Z",
        "created_at": "2022-11-12T12:54:51.000000Z",
        "updated_at": "2022-11-12T12:54:51.000000Z",
        "alarm_id": null,
        "current_status": {
            "id": 287,
            "incidence_type_id": 7,
            "depends_on": 24,
            "name": "Abierta",
            "slug": "abierta",
            "description": "Incidencia abierta",
            "public_description": null,
            "position": 1,
            "icon": "Flagpole",
            "color": "e28d43",
            "close_incidence": "2022-11-15T12:54:51.000000Z",
            "estimated_time": null,
            "unit": "h",
            "created_at": "2020-10-05 09:44:41",
            "updated_at": "2021-10-07 11:42:09"
        }
    }
}

Incidence updated

Messages with following information will be queued when an incidence is updated in Ezzing api.

{
    "uuid": "2e391e1b-2d46-43c1-ae7e-7463eb5b5df7",
    "displayName": "incidence_updated",
    "job": "incidence_updated",
    "maxTries": 5,
    "maxExceptions": null,
    "failOnTimeout": true,
    "backoff": null,
    "timeout": 60,
    "data": {
        "id": 324,
        "created_by_user_id": 3,
        "created_by_client_id": null,
        "opportunity_id": 1587,
        "incidence_type_id": 7,
        "incidence_status_id": 210,
        "title": "Incidence H",
        "description": "Lorem ipsum",
        "closed_at": "2022-11-15T12:54:51.000000Z",
        "created_at": "2022-11-12T12:54:51.000000Z",
        "updated_at": "2022-11-12T12:54:51.000000Z",
        "alarm_id": null,
        "current_status": {
            "id": 287,
            "incidence_type_id": 7,
            "depends_on": 24,
            "name": "Abierta",
            "slug": "abierta",
            "description": "Incidencia abierta",
            "public_description": null,
            "position": 1,
            "icon": "Flagpole",
            "color": "e28d43",
            "close_incidence": "2022-11-15T12:54:51.000000Z",
            "estimated_time": null,
            "unit": "h",
            "created_at": "2020-10-05 09:44:41",
            "updated_at": "2021-10-07 11:42:09"
        }
    }
}

User Created

Messages with following information will be queued when an user is created in Ezzing api.

{
  "uuid": "19ee5546-a52a-410c-b834-32165c0280b7",
  "displayName": "user_created",
  "job": "user_created",
  "maxTries": 5,
  "maxExceptions": null,
  "failOnTimeout": false,
  "backoff": null,
  "timeout": 60,
  "data": {
    "name": "Name",
    "surname": "Surname",
    "email": "test@test.com",
    "company_name": "Company Name"
  }
}

User Deleted

Messages with following information will be queued when an user is deleted in Ezzing api.

{
  "uuid": "19ee5546-a52a-410c-b834-32165c0280b7",
  "displayName": "user_deleted",
  "job": "user_deleted",
  "maxTries": 5,
  "maxExceptions": null,
  "failOnTimeout": false,
  "backoff": null,
  "timeout": 60,
  "data": {
    "name": "Name",
    "surname": "Surname",
    "email": "test@test.com",
    "company_name": "Company Name"
  }
}