Testing example

To proceed with this section you need the AWS credentials key pair, which are provided by DataTalks. Also, you need to inform DataTalks that you wish to send test events so we can configure our API. To test the authentication and sending contacts/events you can use a REST client software such as Postman or Insomnia (Insomnia is used in this example).

For this example we assume very simple customer mappings. For contacts we assume the fields “customeremail” and “customername” exist, these will be mapped to the Salesmanago fields “email” and “name”, respectively. For events we assume the fields “customeremail” and “type” are mapped to “email” and “contactExtEventType”, respectively.

Testing the authentication

  1. Create a new GET-request (left bar in Insomnia).

  2. As the endpoint (top field in Insomnia), enter https://htpfdjhk3h.execute-api.eu-west-1.amazonaws.com/Staging.

  3. Under “Auth” (top bar), select “AWS IAM v4”. Enter the AWS credentials key pair sent to you and set “Region” to “eu-west-1”.

  4. Under “Body” (top bar), select “JSON”. This is where the payload is entered.

  5. Enter and send the following test payload:

 

{ "data": { "customeremail" : "customeremail@test.se", "customername" : "customer name" }, "group_key" : "main_group" }

If the authentication is correct you should receive a 404 error like {“message”: “No method found matching route / for http method GET.”}. If the authentication fails you should receive an error message like one of the following: {“message“: “The security token included in the request is invalid.”} or {“message”: “The security token included in the request is invalid.”}

Test sending contacts and events

To test sending contacts and events, you need to create two new requests in Insomnia (one for contacts and one for events). We explain the steps for adding contacts, the steps are similar for events.

  1. Create a new POST-request (left bar in Insomnia).

  2. As the endpoint (top field in Insomnia), enter the endpoint https://htpfdjhk3h.execute-api.eu-west-1.amazonaws.com/Production/contacts

  3. Configure “Auth” as done when testing the authentication.

  4. Under “Body”, select “JSON”. Then enter and send the following test payload.

{ "data": { "customeremail" : "customeremail@test.se", "customername" : "customer name" }, "group_key" : "main_group" }

5. The payload should successfully be sent in Insomnia. To double check, the Salesmanago account owner (can be DataTalks or the customer) should log in to Salesmanago and verify that the contact has been added to the contact list.

To send a test event, the steps are very similar.

  1. Create a new POST-request (left bar in Insomnia).

  2. As the endpoint (top field in Insomnia), enter the endpoint https://htpfdjhk3h.execute-api.eu-west-1.amazonaws.com/Production/events

  3. Configure “Auth” as done when testing the authentication.

  4. Under “Body”, select “JSON”. Then enter and send the following test payload.

{ "data": { "customeremail" : "customeremail@test.se", "type" : "PURCHASE" }, "group_key" : "main_group" }

5. The payload should successfully be sent in Insomnia. To double check, the Salesmanago account owner (can be DataTalks or the customer) should log in to Salesmanago and verify that the contact has been added to the contact list.

Setting up the correct mapping

The examples above are only meant to verify that you can send events and contacts. To progress, a field mapping from customer data to Salesmanago must be agreed upon before we can send test events and/or contacts.