Can SendGrid webhook events include custom_args from personalizations? - sendgrid

I'm using a dynamic template in SendGrid to send transactional emails that typically go to multiple recipients in the personalizations field. The message body includes custom_args that are shared among all recipients, and in personalizations, both custom_args and dynamic_template_data specific to each recipient. Webhook events return the shared custom_args, but none of the recipient-specific custom_args. Is there a way to get events together with the personalized custom_args? Here's an example request body where we add a userId custom_arg for each recipient:
{
"from": {
"email": "sender#example.com",
"name": "Example Sender"
},
"personalizations": [
{
"to": [
{
"email": "recipient1#example.com",
"custom_args": {
"userId": "63r20acm4xfv"
}
}
],
"dynamic_template_data": {
"subject": "New Article",
"description": "Read the lastest news on...",
"documentId": "624dxnpvhw8g",
"host": "https://localhost:8000",
"userId": "63r20acm4xfv"
}
}
],
"custom_args": {
"documentId": "624dxnpvhw8g"
}
}
And the webhook events we receive (the "documentId" custom arg is reported, but not the "userID" custom_arg from personalizations):
[
{
"documentId": "624dxnpvhw8g",
"email": "recipient1#example.com",
"event": "processed",
"sg_event_id": "cHJvY2Vzc2VkLTI3MTk3NzMzLUtTUEJOaVpGUXpXb05KblctVDBNRkEtMA",
"sg_message_id": "KSPBNiZFQzWoNJnW-T0MFA.filterdrecv-58c58fcb9f-44vrp-1-6312139C-1F6.0",
"sg_template_id": "d-1ebc6b474b7041c0b439d1bdb17650e4",
"sg_template_name": "DEFAULT TEMPLATE",
"smtp-id": "<redacted>",
"timestamp": 1662128000
},
{
"documentId": "624dxnpvhw8g",
"email": "recipient1#example.com",
"event": "delivered",
"ip": "<redacted>",
"response": "250 Message received",
"sg_event_id": "ZGVsaXZlcmVkLTAtMjcxOTc3MzMtS1NQQk5pWkZReldvTkpuVy1UME1GQS0w",
"sg_message_id": "KSPBNiZFQzWoNJnW-T0MFA.filterdrecv-58c58fcb9f-44vrp-1-6312139C-1F6.0",
"sg_template_id": "d-1ebc6b474b7041c0b439d1bdb17650e4",
"sg_template_name": "DEFAULT TEMPLATE",
"smtp-id": "<redacted>",
"timestamp": 1662128002,
"tls": 1
}
]

Ugh - the custom_args in personalizations was at the wrong level. After moving the custom_args up to the same level as the dynamic_template_data, it worked fine and the values are included in the webhook events.
The example from the question was changed to:
{
"from": {
"email": "sender#example.com",
"name": "Example Sender"
},
"personalizations": [
{
"to": [
{
"email": "recipient1#example.com",
}
],
"custom_args": {
"userId": "63r20acm4xfv"
}
"dynamic_template_data": {
"subject": "New Article",
"description": "Read the lastest news on...",
"documentId": "624dxnpvhw8g",
"host": "https://localhost:8000",
"userId": "63r20acm4xfv"
}
}
],
"custom_args": {
"documentId": "624dxnpvhw8g"
}
}

Related

How to send an email with variables using Mailjet API v3.1?

I just want to know why when I send variables using a template, the Mailjet API doesn't replace them, even the fakeFirstname doesn't show.
I just see {{var:FirstName:"fakeFirstName"}}
Here is my payload :
{
"Messages": [
{
"From": {
"Email": "senderEmail",
"Name": "senderName"
},
"To": [
{
"Email": "userEmail",
"Name": "userName"
}
],
"Subject": "subject",
"TextPart": "",
"HTMLPart": "",
"TemplateID": TemplateId,
"TemplateLanguage": true,
"Variables": {
"FirstName": "otherName"
}
}
]
}
Thanks for the helpers.

Send multiple emails to same user in single SendGrid request

{
"headers": {},
"endpoint": "mail/send",
"method": "POST",
"queryParams": {},
"baseUri": "",
"body": {
"from": {
"name": "Test",
"email": "test#noreply.com"
},
"subject": "Test Send Grid Mail Service",
"personalizations": [
{
"to": [
{
"email": "user#test.com"
}
],
"subject": "Test Send Grid Mail Service",
"custom_args": {
}
},
{
"to": [
{
"email": "user#test.com"
}
],
"subject": "Test Send Grid Mail Service",
"custom_args": {
}
}
],
"content": [
{
"type": "text/html",
"value": "Hi"
}
]
}
}
I'm using this request body to send multiple emails(in this case 2 emails) to the same user but the send grid is sending only one email. Is there a way to send multiple emails to the same user multiple times(in this case 2 emails) in a single send grid request?

INTERNAL_SERVICE_ERROR on PayPal order pay

Question updated - more details added.
I get a 500 (INTERNAL_SERVICE_ERROR) error from PayPal when I try to pay for an order.
I get ok from create order, and get the orderID - order status CREATED.
The order is approved by buyer - successfully and order status become APPROVED.
Order created by https://api.sandbox.paypal.com/v1/checkout/orders
Approved using paypal https://www.paypalobjects.com/api/checkout.js
{
"id": "53T50821FM697283T",
"gross_total_amount": {
"value": "26.66",
"currency": "ILS"
},
"purchase_units": [
{
"reference_id": "20180318-64466",
"amount": {
"currency": "ILS",
"total": "26.66"
},
"payee": {
"email": "d0535318380-classeeks#gmail.com"
},
"items": [
{
"name": "Meeting",
"sku": "20180318-64466",
"description": "Meeting 1/26/2018 1:00 AM-1/26/2018 2:20 AM. aaaaa",
"price": "26.66",
"currency": "ILS",
"quantity": 1
}
],
"shipping_address": {
"recipient_name": "Andrey Dyachenko",
"line1": "ישראליס 5 דירה 4",
"city": "תל-אביב",
"country_code": "IL",
"postal_code": "61014",
"state": "",
"type": "HOME_OR_WORK"
},
"partner_fee_details": {
"receiver": {
"email": "d0535318380-reciver#gmail.com"
},
"amount": {
"value": "12.66",
"currency": "ILS"
}
}
}
],
"payer_info": {
"email": "d0535318380-buyer#gmail.com",
"first_name": "Andrey",
"last_name": "Dyachenko",
"payer_id": "BZDA9RCZXKYQY",
"country_code": "IL",
"shipping_address": {
"recipient_name": "Andrey Dyachenko",
"line1": "ישראליס 5 דירה 4",
"city": "תל-אביב",
"country_code": "IL",
"postal_code": "61014",
"state": "",
"type": "HOME_OR_WORK"
}
},
"metadata": {
"supplementary_data": [
{
"name": "risk_correlation_id",
"value": "53T50821FM697283T"
},
{
"name": "buyer_ipaddress",
"value": "109.65.134.129"
},
{
"name": "external_channel",
"value": "WEB"
}
]
},
"redirect_urls": {
"return_url": "https://classeeks.com/order/details/70368c93-90db-4a8e-bd82-6d611acc2d17",
"cancel_url": "https://classeeks.com/order/details/70368c93-90db-4a8e-bd82-6d611acc2d17"
},
"create_time": "2018-03-18T19:49:11Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T/capture",
"rel": "capture",
"method": "POST"
}
],
"status": "APPROVED"
}
Next step pay with https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T/pay
{ "disbursement_mode":"DELAYED" }
Response
{
"name": "INTERNAL_SERVICE_ERROR",
"message": "The server encountered an internal error that prevented it from fulfilling this request.",
"information_link": "https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR",
"debug_id": "be0c6976ab17a"
}
Based https://demo.paypal.com/us/demo/go?page=cart
If you have created the order successfully, then you can either capture the order directly or create the authorization which places the fund on hold and later you can capture the authorization. Check the doc for PayPal order APIs.

Domino 9.x calendar service create meeting

I have been following this guide to work on Domino 9.0.1
Domino Calendar services
I am using JSON and the POST command works but creates an appointment, what I want to do is create a meeting. I have tried setting other fields like event['x-lotus-appttype'].data or event.AppointmentType = 3 but I still get an appointment.
JSON I am sending
{
"events": [
{
"summary":"Meeting 1",
"location":"Location 1",
"start": {
"date":"2013-12-01",
"time":"13:00:00",
"utc":true
},
"end": {
"date":"2013-12-01",
"time":"14:00:00",
"utc":true
}
}
]
}
What is the correct JSON format to create a meeting ?
Take a look at the following documentation: Event with attendees represented in JSON format
EXAMPLE 4. Event with attendees and time zone array:
{
"x-lotus-charset": {
"data": "UTF-8"
},
"timezones": [
{
"tzid": "Eastern",
"standard": {
"start": {
"date": "1950-11-05",
"time": "02:00:00"
},
"offsetFrom": "-0400",
"offsetTo": "-0500",
"recurrenceRule": "FREQ=YEARLY;BYMONTH=11;BYDAY=1SU;BYHOUR=2;BYMINUTE=0"
},
"daylight": {
"start": {
"date": "1950-03-12",
"time": "02:00:00"
},
"offsetFrom": "-0500",
"offsetTo": "-0400",
"recurrenceRule": "FREQ=YEARLY;BYMONTH=3;BYDAY=2SU;BYHOUR=2;BYMINUTE=0"
}
}
],
"events": [
{
"href": "/mail/dlawson.nsf/api/calendar/events/DB7E0BAC21EC322A85257BD200756E26-Lotus_Notes_Generated",
"id": "DB7E0BAC21EC322A85257BD200756E26-Lotus_Notes_Generated",
"summary": "Staff meeting",
"location": "Ray's office",
"description": "Please email your status update 24 hours before the meeting.",
"start": {
"date": "2013-09-12",
"time": "09:00:00",
"tzid": "Eastern"
},
"end": {
"date": "2013-09-12",
"time": "10:00:00",
"tzid": "Eastern"
},
"class": "public",
"transparency": "opaque",
"sequence": 0,
"last-modified": "20130825T212457Z",
"attendees": [
{
"role": "chair",
"status": "accepted",
"rsvp": false,
"displayName": "Duke Lawson/Peaks",
"email": "DukeLawson#swg.usma.ibm.com"
},
{
"role": "req-participant",
"status": "needs-action",
"rsvp": true,
"displayName": "Dean Melnyk/Peaks",
"email": "DeanMelnyk#swg.usma.ibm.com"
},
{
"role": "req-participant",
"status": "needs-action",
"rsvp": true,
"displayName": "Raymond Chan/Peaks",
"email": "RaymondChan#swg.usma.ibm.com"
}
],
"organizer": {
"displayName": "Duke Lawson/Peaks",
"email": "DukeLawson#swg.usma.ibm.com"
},
"x-lotus-broadcast": {
"data": "FALSE"
},
"x-lotus-notesversion": {
"data": "2"
},
"x-lotus-appttype": {
"data": "3"
}
}
]
}
I hope this can help :)

How to get the facebook fan page private messages through fql or graph

I have tried Page Messages
with the all the required permission i.e read_mailbox, read_page_mailboxes, etc (all the extended permission)
at length I get tried as
https://graph.facebook.com/456330641095467/conversations?access_token=BAAGgcfpJgfUBAHdKaE6KxMWo4rU6VU7psX7Ip4cLbG1yIvX80fkkTXm3ZApdYHmcISmqfnns1gPYZAHXWD2cXX7nMBcj4AK31uptfqJUjNAGXan1ftOK4Tw3sY1WsZD
but i get response as
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210
}
}
I am unable to find out the issue. Please help.
Just use the access_token of page and you are done
yours output would be like this
{
"data": [
{
"id": "t_id.615971188431960",
"snippet": "ok fine reply on test 5:15",
"updated_time": "2013-04-16T12:15:12+0000",
"message_count": 8,
"tags": {
"data": [
{
"name": "inbox"
},
{
"name": "read"
},
{
"name": "seen"
},
{
"name": "sent"
},
{
"name": "source:web"
}
]
},
"participants": {
"data": [
{
"name": "Pragati Singh",
"email": "100000441901858\u0040facebook.com",
"id": "100000441901858"
},
{
"name": "Devdemo",
"email": "456330641095467\u0040facebook.com",
"id": "456330641095467"
}
]
},
"senders": {
"data": [
{
"name": "Devdemo",
"email": "456330641095467\u0040facebook.com",
"id": "456330641095467"
},
{
"name": "Pragati Singh",
"email": "100000441901858\u0040facebook.com",
"id": "100000441901858"
}
]
},