download attachments from yahoo mail api - yahoo-api

How should I construct and combine the oauth token to download the attachment from Yahoo Mail API? Any java example or link will be a great help.
For other command like List Messages, I can construct as JSON though.
{
"method": "ListMessages",
"params":
[
{
"fid": "Inbox",
"startMid": 0,
"numMid": 10,
"startInfo": 0,
"numInfo": 1
}
],
"id": 1234567890
}

Related

WhatsApp Business API - Edit Template

I'm trying to send a POST request to edit a template message of WhatsApp:
POST /{whatsapp_template_id}
{
"name": "my_template",
"language": "en_US",
"category": "transactional",
"components": [
{
"type": "BODY",
"text": "whatsapp buddy?"
}
]
}
Receiving (#3) Application does not have the capability to make this API call.
Currently, there is no edit template API, as per the documentation it will Available from September 7, 2022.

WSO2 email connector - Issue with sending attachments

I'm working on an email connector that is sending emails successfully.
But I want to send emails with an attachment.
I am using email connector 1.0.2 that support the attachments in its payload.
<email.send configKey="EMAIL_CONNECTION_SMTP">
<from>{json-eval($.from)}</from>
<to>{json-eval($.to)}</to>
<subject>{json-eval($.subject)}</subject>
<content>{$ctx:DecodedBodyTemplate}</content>
<contentType>{$ctx:contentType}</contentType>
<attachments>{json-eval($.attachments)}</attachments>
</email.send>
And the payload has:
"attachments": [
{
"name": "sampleimagefile.txt",
"content": "This is a text file"
}
]
I tried using base64encoded string in content too.
Yet I'm still receiving emails without any attachment.
I also use email connector 1.0.2 and I don't have any issue sending attachments.
Look here for more info.
So, your payload should look like this:
{
"from": "user1#gmail.com",
"to": "user2#gmail.com",
"subject": "This is the subject",
"content": "This is the body",
"contentType": "text/plain",
"attachments": [
{
"name": "sampleimagefile.png",
"content": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
}
]
}

Recipient detail in SendGrid Dynamic Template

I need to send a payload to multiple recipients in SendGrid. I use the Dynamic Templates to construct the email body, and all is working fine.
I would like to add a 'Hi {{recipientName}}' line to the email but I cannot find any documentation on it, is it possible?
I cannot include the recipient detail in the payload as a single payload goes out to many recipients
Use personalizations.
Personalizations allow you to override these various metadata for each email in an API request.
Your request will look like this:
{
"from": "gilbert#techmail.com",
"template_id": "YOUR TEMPLATE ID",
"personalizations": [
{
"to": [
{
"email": "john#example.com"
}
],
"substitutions": {
"%fname%": "John",
"%CustomerID%": "C001"
},
},
{
"to": [
{
"email": "peter#example.com"
}
],
"substitutions": {
"%fname%": "Peter",
"%CustomerID%": "C005"
},
"send_at": 1629723541
}
]
}
and it will go as a single request.
Also look at this github comment.

Facebook webhook, how to get conversation id from mid id

Hello everyone i'm building a chat bot, i'm having a problem that is, when a user sends a message to my app, i don't get the conversation id like "t_31231231231231", instead I get "mid", I don't know how to get the conversation from "mid", i tried to find the document but maybe I haven't found it yet. :(
{
"object": "page",
"entry": [
{
"id": "553014938133297",
"time": 1567149324484,
"messaging": [
{
"sender": {
"id": "2112675102192095"
},
"recipient": {
"id": "553014938133297"
},
"timestamp": 1567149323879,
"message": {
"mid": "n89QDNpjbh7UUZjDj7mkfk-Mqd_vry00MlXChtxjo-ZLokFwJAtZ6udnPZibQjzAZpuqsN64UVjTly5cTCEKTQ",
"text": "dasddsad",
"nlp": {
"entities": {},
"detected_locales": [
{
"locale": "vi_VN",
"confidence": 0.8299
}
]
}
}
}
]
}
]
}
This might not be the ideal solution, but can serve as an improvisation. Since, you have the message_id you can fetch message to determine who the participants are, then you can match them with the participants in the conversations.participants.
What I did was to fetch all the conversations with their participants field.
i.e
curl -i -X GET \
"https://graph.facebook.com/v8.0/me/conversations?fields=participants&access_token=your-access-token-goes-here"
Which returns
{"data"=>
[{"participants"=>
{"data"=>
[{"name"=>"Masroor Hussain",
"email"=>"3275685679217538#facebook.com",
"id"=>"4275685679217538"},
{"name"=>"Testpage",
"email"=>"115083020351552#facebook.com",
"id"=>"115083020351552"}]},
"id"=>"t_781422919067688"}],
"paging"=>
{"cursors"=>
{"before"=>
"QVFIUlRKd1RBYmtvVXlicm95QUNZAbjVKUW5LbU5lYzhQM24ycmY1aTBXM1NTbnRSLURhc2xnSlBnOWE3OTJ4ZAy1KbS1LLVhUUEdqYmM0MmVzZAXZAZAX2xRdzJCbXpJSEowMmxzUHc0NlBXQ0FTVEdRSEZAZASmI2SGxsNlNOdC1XOWNSZADl0",
"after"=>
"QVFIUkdEUjNPek5jbE9RNUhzZAXpJTm9hWERvQVdGYVV5cHlfcDl6cEJyZAG5NaGpjR1NkUHI4R0JDd1VkWEU0RUh2ZADFOQUVzN0RwQ2tyYmpXcThEV0hjUDM2QXAxbFRLWDVzUGoyNmFjbkcyUzl3X0Myc1AtanRYUndjMDBSdVZAJZAnI0"
}
}
}
In the participants.data one participant is the page and the other is page_scoped_user. You can parse the response to match your participants and get the conversation id e.g here the conversation id would be "t_781422919067688"
A little late here but I had the same problem and actually found the solution in the Instagram API documentation. I tried it in the facebook graph api and it worked perfectly.
In the webhook event, you have the message ID and the sender ID. Using the sender ID, you can make a call to the Graph API (yes, still an additional API call) using the following endpoint:
/{page_id}/conversations?access_token={access_token}&user_id={user_id}
this will return only the conversation between your page and the specified user.

Facebook Workplace Account Management API - Update user

I have a workplace application,
I wish to change emailIds of the user via API,
I found that Account Management API
can be used to modify user details via API calls.
My use-case is to modify user email via the Account Management API, which comes under urn:scim:schemas:core:1.0 schema extension,
I wish to overwrite the existing email with the one I would specify in the requestBody,
From the documentation, I've come up with the following request -
Url endpoint -
https://someCompanyName.facebook.com/scim/v1/Users/ HTTP/1.1
Method type -
POST
Request body-
{
"schemas": [
"urn:scim:schemas:core:1.0",
"urn:scim:schemas:extension:facebook:auth_method:1.0"
],
"userName": "abc",
"name": {
"formatted": "Julius Caesar"
},
"emails": ["abc#gmail.com"],
"urn:scim:schemas:extension:facebook:auth_method:1.0": {
"auth_method": "password"
}
}
Is it correct? What modifications do I need to make to the request?
in order to change the emails of a user you have to do a PUT request to the address https://www.facebook.com/scim/v1/Users/{userId}
and you have to change in your payload the email address:
{
"schemas": [
"urn:scim:schemas:core:1.0",
"urn:scim:schemas:extension:facebook:auth_method:1.0"
],
"userName": "abc",
"name": {
"formatted": "Julius Caesar"
},
"emails": [
{
"primary": true,
"type": "work",
"value": "newemail#gmail.com"
}
],
"urn:scim:schemas:extension:facebook:auth_method:1.0": {
"auth_method": "password"
}
}
Hope it helps