Skip to content

Commit d99d1f8

Browse files
author
Chris Wilson
committed
Adding sample that decodes webhook events
1 parent 98b720c commit d99d1f8

25 files changed

+2543
-2876
lines changed

apps/sparkpost-javamail-app/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<version>1.5.3</version>
3030
</dependency>
3131
<dependency>
32-
<groupId>org.apache.commons</groupId>
32+
<groupId>commons-io</groupId>
3333
<artifactId>commons-io</artifactId>
3434
<version>1.3.2</version>
3535
</dependency>

apps/sparkpost-samples-app/pom.xml

+12-2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,22 @@
5454
<scope>provided</scope>
5555
</dependency>
5656
<dependency>
57-
<groupId>org.apache.commons</groupId>
57+
<groupId>commons-io</groupId>
5858
<artifactId>commons-io</artifactId>
5959
<version>1.3.2</version>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.json</groupId>
63+
<artifactId>json</artifactId>
64+
<version>20170516</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>com.google.code.gson</groupId>
68+
<artifactId>gson</artifactId>
69+
<version>2.3.1</version>
70+
</dependency>
6171
</dependencies>
62-
72+
6373
<build>
6474
<plugins>
6575
<plugin>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
[
2+
{
3+
"msys": {
4+
"message_event": {
5+
"template_id": "template_120632847835523516",
6+
"routing_domain": "example.com",
7+
"num_retries": "0",
8+
"event_id": "120632847947746861",
9+
"customer_id": "1521",
10+
"rcpt_meta": {},
11+
"timestamp": "1496154610",
12+
"ip_pool": "shared",
13+
"friendly_from": "[email protected]",
14+
"ip_address": "74.125.28.27",
15+
"rcpt_to": "[email protected]",
16+
"msg_size": "2911",
17+
"rcpt_tags": [],
18+
"msg_from": "[email protected]",
19+
"type": "delivery",
20+
"sending_ip": "52.39.182.248",
21+
"campaign_id": "test",
22+
"queue_time": "366",
23+
"template_version": "0",
24+
"delv_method": "esmtp",
25+
"subject": "My Subject Value",
26+
"message_id": "0006f2812d59b5a6a1dc",
27+
"transmission_id": "120632847835523516",
28+
"raw_rcpt_to": "[email protected]"
29+
}
30+
}
31+
},
32+
{
33+
"msys": {
34+
"track_event": {
35+
"customer_id": "1521",
36+
"user_agent": "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
37+
"template_id": "template_120632847835523516",
38+
"rcpt_to": "[email protected]",
39+
"type": "open",
40+
"ip_address": "66.102.6.159",
41+
"ip_pool": "shared",
42+
"timestamp": "1496154625",
43+
"sending_ip": "52.39.26.144",
44+
"message_id": "0006f2812d59b5a69edc",
45+
"template_version": "0",
46+
"rcpt_tags": [],
47+
"rcpt_meta": {},
48+
"campaign_id": "test",
49+
"transmission_id": "120632847835523516",
50+
"delv_method": "esmtp",
51+
"event_id": "30565043016610442",
52+
"friendly_from": "[email protected]",
53+
"routing_domain": "example.com",
54+
"msg_from": "[email protected]",
55+
"msg_size": "2903",
56+
"subject": "My Subject Value",
57+
"geo_ip": {
58+
"country": "US",
59+
"region": "CA",
60+
"city": "Mountain View",
61+
"latitude": 37.4192,
62+
"longitude": -122.0574
63+
},
64+
"raw_rcpt_to": "[email protected]"
65+
}
66+
}
67+
},
68+
{
69+
"msys": {
70+
"message_event": {
71+
"ip_address": "173.194.219.27",
72+
"sending_ip": "52.39.26.144",
73+
"template_id": "template_120632847835523516",
74+
"ip_pool": "shared",
75+
"routing_domain": "example.com",
76+
"timestamp": "1496154611",
77+
"num_retries": "0",
78+
"customer_id": "1521",
79+
"message_id": "0006f2812d59b5a69edc",
80+
"queue_time": "1282",
81+
"template_version": "0",
82+
"rcpt_to": "[email protected]",
83+
"event_id": "120632847947747682",
84+
"delv_method": "esmtp",
85+
"subject": "My Subject Value",
86+
"msg_from": "[email protected]",
87+
"campaign_id": "test",
88+
"rcpt_tags": [],
89+
"rcpt_meta": {},
90+
"type": "delivery",
91+
"friendly_from": "[email protected]",
92+
"msg_size": "2903",
93+
"transmission_id": "120632847835523516",
94+
"raw_rcpt_to": "[email protected]"
95+
}
96+
}
97+
},
98+
{
99+
"msys": {
100+
"track_event": {
101+
"message_id": "0006f2812d59b5a6a1dc",
102+
"customer_id": "1521",
103+
"user_agent": "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
104+
"template_id": "template_120632847835523516",
105+
"template_version": "0",
106+
"type": "open",
107+
"ip_pool": "shared",
108+
"rcpt_to": "[email protected]",
109+
"event_id": "120632847947757453",
110+
"rcpt_meta": {},
111+
"transmission_id": "120632847835523516",
112+
"rcpt_tags": [],
113+
"delv_method": "esmtp",
114+
"sending_ip": "52.39.182.248",
115+
"timestamp": "1496154625",
116+
"campaign_id": "test",
117+
"ip_address": "127.0.0.1",
118+
"routing_domain": "example.com",
119+
"msg_from": "[email protected]",
120+
"subject": "My Subject Value",
121+
"msg_size": "2911",
122+
"friendly_from": "[email protected]",
123+
"geo_ip": {
124+
"country": "US",
125+
"region": "CA",
126+
"city": "Mountain View",
127+
"latitude": 37.4192,
128+
"longitude": -122.0574
129+
},
130+
"raw_rcpt_to": "[email protected]"
131+
}
132+
}
133+
},
134+
{
135+
"msys": {
136+
"message_event": {
137+
"friendly_from": "[email protected]",
138+
"routing_domain": "example.com",
139+
"event_id": "120632847947746465",
140+
"template_id": "template_120632847835523516",
141+
"msg_from": "[email protected]",
142+
"sending_ip": "52.39.26.144",
143+
"customer_id": "1521",
144+
"message_id": "0006f2812d59b5a69edc",
145+
"rcpt_to": "[email protected]",
146+
"campaign_id": "test",
147+
"rcpt_tags": [],
148+
"msg_size": "2903",
149+
"subject": "My Subject Value",
150+
"rcpt_meta": {},
151+
"type": "injection",
152+
"transmission_id": "120632847835523516",
153+
"ip_pool": "shared",
154+
"timestamp": "1496154610",
155+
"template_version": "0",
156+
"raw_rcpt_to": "[email protected]"
157+
}
158+
}
159+
},
160+
{
161+
"msys": {
162+
"message_event": {
163+
"ip_pool": "shared",
164+
"event_id": "120632847947746472",
165+
"rcpt_to": "[email protected]",
166+
"routing_domain": "example.com",
167+
"sending_ip": "52.39.182.248",
168+
"rcpt_tags": [],
169+
"msg_from": "[email protected]",
170+
"message_id": "0006f2812d59b5a6a1dc",
171+
"customer_id": "1521",
172+
"rcpt_meta": {},
173+
"campaign_id": "test",
174+
"subject": "My Subject Value",
175+
"template_id": "template_120632847835523516",
176+
"transmission_id": "120632847835523516",
177+
"type": "injection",
178+
"msg_size": "2911",
179+
"template_version": "0",
180+
"friendly_from": "[email protected]",
181+
"timestamp": "1496154610",
182+
"raw_rcpt_to": "[email protected]"
183+
}
184+
}
185+
},
186+
{
187+
"msys": {
188+
"track_event": {
189+
"delv_method": "esmtp",
190+
"transmission_id": "102618457580291306",
191+
"rcpt_to": "[email protected]",
192+
"ip_address": "73.208.71.254",
193+
"accept_language": "en-US,en;q=0.8",
194+
"template_id": "template_102618457580291306",
195+
"template_version": "0",
196+
"event_id": "120632847947644777",
197+
"sending_ip": "52.39.182.248",
198+
"target_link_url": "http://example.com/yourUri",
199+
"customer_id": "1521",
200+
"ip_pool": "shared",
201+
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
202+
"rcpt_tags": [],
203+
"message_id": "000541812d59f83f9db8",
204+
"rcpt_meta": {
205+
"myKey": "myVal"
206+
},
207+
"campaign_id": "test",
208+
"type": "click",
209+
"timestamp": "1496154493",
210+
"msg_size": "3100",
211+
"subject": "My Sample Subject",
212+
"msg_from": "[email protected]",
213+
"friendly_from": "[email protected]",
214+
"routing_domain": "google.com",
215+
"geo_ip": {
216+
"country": "US",
217+
"region": "IL",
218+
"city": "Lake In The Hills",
219+
"latitude": 42.187,
220+
"longitude": -88.3465
221+
},
222+
"raw_rcpt_to": "[email protected]"
223+
}
224+
}
225+
},
226+
{
227+
"msys": {
228+
"track_event": {
229+
"ip_address": "66.102.6.151",
230+
"rcpt_tags": [],
231+
"rcpt_to": "[email protected]",
232+
"ip_pool": "shared",
233+
"timestamp": "1496154491",
234+
"message_id": "000541812d59f83f9db8",
235+
"delv_method": "esmtp",
236+
"user_agent": "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
237+
"type": "open",
238+
"campaign_id": "test",
239+
"event_id": "120632847947642968",
240+
"sending_ip": "52.39.182.248",
241+
"transmission_id": "102618457580291306",
242+
"template_version": "0",
243+
"template_id": "template_102618457580291306",
244+
"customer_id": "1521",
245+
"rcpt_meta": {
246+
"myKey": "myVal"
247+
},
248+
"msg_size": "3100",
249+
"subject": "My Sample Subject",
250+
"msg_from": "[email protected]",
251+
"friendly_from": "[email protected]",
252+
"routing_domain": "google.com",
253+
"geo_ip": {
254+
"country": "US",
255+
"region": "CA",
256+
"city": "Mountain View",
257+
"latitude": 37.4192,
258+
"longitude": -122.0574
259+
},
260+
"raw_rcpt_to": "[email protected]"
261+
}
262+
}
263+
},
264+
{
265+
"msys": {
266+
"message_event": {
267+
"routing_domain": "example.com",
268+
"type": "bounce",
269+
"bounce_class": "10",
270+
"friendly_from": "[email protected]",
271+
"error_code": "550",
272+
"timestamp": "1496154451",
273+
"rcpt_to": "[email protected]",
274+
"template_version": "0",
275+
"transmission_id": "48575267445821468",
276+
"rcpt_meta": {
277+
"myKey": "myVal"
278+
},
279+
"num_retries": "0",
280+
"msg_from": "[email protected]",
281+
"message_id": "000253812d59ed483127",
282+
"ip_address": "74.125.28.26",
283+
"msg_size": "3328",
284+
"rcpt_tags": [],
285+
"queue_time": "379",
286+
"event_id": "48575267555968293",
287+
"subject": "My Sample Subject",
288+
"sending_ip": "35.160.182.156",
289+
"ip_pool": "shared",
290+
"template_id": "template_48575267445821468",
291+
"raw_reason": "550-5.1.1 The email account that you tried to reach does not exist. Please try\r\n550-5.1.1 double-checking the recipient's email address for typos or\r\n550-5.1.1 unnecessary spaces. Learn more at\r\n550 5.1.1 https://support.google.com/mail/?p=NoSuchUser h7si13242232pgc.400 - gsmtp",
292+
"campaign_id": "test",
293+
"reason": "550-5.1.1 The email account that you tried to reach does not exist. Please try\r\n550-5.1.1 double-checking the recipient's email address for typos or\r\n550-5.1.1 unnecessary spaces. Learn more at\r\n550 5.1.1 https://support.google.com/mail/?p=NoSuch... - gsmtp",
294+
"customer_id": "1521",
295+
"raw_rcpt_to": "[email protected]"
296+
}
297+
}
298+
},
299+
{
300+
"msys": {
301+
"message_event": {
302+
"ip_pool": "shared",
303+
"rcpt_to": "[email protected]",
304+
"message_id": "000253812d59ed483127",
305+
"template_version": "0",
306+
"campaign_id": "test",
307+
"transmission_id": "48575267445821468",
308+
"sending_ip": "35.160.182.156",
309+
"rcpt_tags": [],
310+
"msg_from": "[email protected]",
311+
"type": "injection",
312+
"customer_id": "1521",
313+
"rcpt_meta": {
314+
"myKey": "myVal"
315+
},
316+
"subject": "My Sample Subject",
317+
"event_id": "48575267555967899",
318+
"template_id": "template_48575267445821468",
319+
"friendly_from": "[email protected]",
320+
"timestamp": "1496154451",
321+
"routing_domain": "example.com",
322+
"msg_size": "3328",
323+
"raw_rcpt_to": "[email protected]"
324+
}
325+
}
326+
},
327+
{
328+
"msys": {
329+
"message_event": {
330+
"customer_id": "1521",
331+
"rcpt_meta": {
332+
"myKey": "myVal"
333+
},
334+
"sending_ip": "52.39.182.248",
335+
"rcpt_tags": [],
336+
"subject": "My Sample Subject",
337+
"timestamp": "1496154433",
338+
"msg_from": "[email protected]",
339+
"routing_domain": "google.com",
340+
"type": "delivery",
341+
"ip_address": "74.125.28.26",
342+
"queue_time": "424",
343+
"event_id": "102618457692014774",
344+
"friendly_from": "[email protected]",
345+
"ip_pool": "shared",
346+
"campaign_id": "test",
347+
"transmission_id": "102618457580291306",
348+
"template_id": "template_102618457580291306",
349+
"rcpt_to": "[email protected]",
350+
"msg_size": "3100",
351+
"num_retries": "0",
352+
"delv_method": "esmtp",
353+
"message_id": "000541812d59f83f9db8",
354+
"template_version": "0",
355+
"raw_rcpt_to": "[email protected]"
356+
}
357+
}
358+
}
359+
]

0 commit comments

Comments
 (0)