I understand that to use the /attachments API, an id of the event or message which has an attachment needs to be passed. Can attachment data for an event or message be obtained without this dependency? For example, when I'm making a call to /events API for a particular user, along with events data for that user, can I also get attachment data associated with the event?
I'm using client credentials flow.
This is possible by explicitly specifying that you'd like to include attachments the response body using the OData expand query option.
In your case, the request URI would look as follows: https://graph.microsoft.com/v1.0/me/events?$expand=attachments
Related
We're using MS Graph API to get the list of emails from an Outlook 365 mailbox. We have a requirement to list the attachments in every email.
When using the List Attachments endpoint of the Graph API, the contentBytes attribute value in the response contains the entire Base64 encoded attachment content. This increases the response size significantly. We have no need to access or store the attachment content.
https://learn.microsoft.com/en-us/graph/api/message-list-attachments?view=graph-rest-1.0&tabs=http#example
Is there a way in MS Graph API to just get the attachment file name(s) and IDs for one or more email messages?
Yes, you can use the same /attachments endpoint and get only the id and name of attachment using the $select query parameter.
Simply use the query
https://graph.microsoft.com/v1.0/me/messages/{messageid}/attachments?$select=id,name
Result:
You can always test graph calls in Graph Explore.
we need to fetch all mails based on the conversationId, mails are replying with the same email they received. they will not delete original message when they replied. so the replied mail has the original message.
the problem is when we fetching the mail using graph api, it will return the whole message (including the original message).
is there any way to get mail response without the original message?
As far as I know, it can't be implemented by graph api because the history email is a part of the new email's body. So we can just show all of the email's body in the graph api.
For a workaround, we can do it in code development. When we get the response data from the graph api, we can parse the json and get the body.content. Then we can substring the content string and just keep the content in front of the "From:". But if we do the substring operation on the body.content, it may cause some problem because it contains lots of html tags. So I suggest you to do the substring operation on the field bodyPreview, just substring the bodyPreview and keep the content in front of the "From:".
By the way, if you can let the users delete the history email body before sending the email, that's best(Although I know it may not be possible~).
I know in the "Settings > API Integration" I can add a URL that will receive a POST when a Case (Customer Inquiry) is created, however the contents of that POST only contains two IDs e.g. ObjectID=1234567&ObjectType=2001
Is there a way that I can send a custom POST to some URL with the actual form data? E.g. if I wanted to send the person who submitted the form a text message via a third-party SMS API
No; you'll need to respond to that POST with one that extracts the data you need from BC, then transform & forward that data to the SMS service.
This implies that you'll have a third server to handle those intermediary steps.
http://docs.businesscatalyst.com/reference/soap-apis-legacy/crm/case_retrieve.html
Another approach to do this is to write some ajax post function to post form data to the desired URL before submission.
I am using a service account and domain wide delegation to access all email accounts under client's domain with read-only scope https://www.googleapis.com/auth/gmail.readonly In the message get request I use format option "metadata" with fields='payload/headers' which returns only email headers but not the content of the message.
Is there a way to restrict my app access to metadata only and not the content of the emails? This would ensure that my application can not read sensitive email content information and have access to metadata only.
Thanks!
The Gmail API now (as of November 2016) does support a gmail.metadata scope!
C.f.
https://developers.google.com/gmail/api/auth/scopes
It allows access to email headers, including subject, without email message data. Calls to message.get() with format=METADATA and format=MINIMAL will work with that scope, but not, for example, format=FULL or format=RAW.
Set your scope to https://www.googleapis.com/auth/gmail.metadata.
See https://developers.google.com/gmail/api/auth/scopes
https://www.googleapis.com/auth/gmail.metadata
Read resources metadata including labels, history records, and email message headers, but not the message body or attachments
You can get only the specified headers via specifying 'format'=>'metadata' and 'metadataHeaders'=>array(headers you want to receive, excluding others). Check a sample get request in PHP below:
$service->users_messages->get($userId, $message->id,array('format'=>'metadata', 'metadataHeaders'=>array('From','To')));
The above code will only get From and To headers and wont show Subject header.
Hope this helps.
So a user calls a Twilio phone number. Twilio looks for a voice_url attached to that number (from their dashboard) and sees some XML with instructions on how to handle the call. The XML file also has an "action" parameter that points to a url.
Ideally, this URL should be able to retrieve parameters sent by Twilio and save them to a DB. This is where I'm stuck; how can I see which parameters are sent and how can I save them? I'm assuming the URL in the "action" parameter points to a controller?
I'm using the twilio-rb gem.
Some relevant links:
http://www.twilio.com/docs/api/twiml/dial#attributes-action
http://www.twilio.com/docs/api/twiml/twilio_request
When Twilio makes a POST to the URL mentioned by the Action parameter, it will send all of the attributes mentioned here: http://www.twilio.com/docs/api/twiml/twilio_request.
You should create your own route and controller for responding to the incoming Twilio request. When Twilio makes the request, you should be able to get the variables out of the POST request like any POST request. See for example How to access POST variables in Rails?.