I am trying to send an email through customer.io service and I need to attach a PDF to it. Ive seen little documentation about attachments, so I dont know if it is possible.
I am trying this approach
{
name: 'myCampaign',
data: {
foo: 'bar',
},
attachments: {
'file.pdf': pdfInB64
}
}
As the example here: https://gist.github.com/jrallison/3e43c58cb208841caf11
Thank you !!
It is possible to send PDF's as attachments via customer.io. I think one of your issues is that your attachments object needs to be nested inside of your data object. Ex.
{
"name": "foo_bar",
"data": {
"foo": "bar",
"attachments": {
"helloworld.pdf": "some base64 encoded pdf here"
}
}
}
However, one caveat here is that there's a limit to the size of attachments.
Well, apparently is not possible the way I was thinking about it. For PDF is better to have a link to a host you own
<img src="LINK TO THE DOWNLOAD PDF IMAGE" alt="Download your PDF file">
Related
I want to display the data of an article using gatsby-source-facebook.
But I don't know how to write a query.
I can't find the best query at http://localhost:8000/___graphql
I make a simple website with gatsby.js.
I want to get facebook article data (posting date and text) and display it on the site.
I installed gatsby-source-facebook for that.
And changed gatsby-config.js.
→ https://www.gatsbyjs.org/packages/gatsby-source-facebook/
//`gatsby-config.js`
plugins: [
{
resolve: `gatsby-source-facebook`,
options: {
places: [`${facebookPageID}`], // Can be either a numeric ID or the URL ID
params: {
fields: 'hours, posts { message, created_time }', // See Facebooks API to see what you can query for
},
key: process.env.FACEBOOK_GRAPH_TOKEN, // You will need to create a Facebook application and go through review in order to get an API token.
},
},
],
I don't know how to write a query, so I can't get the data. (Can not be displayed.)
For example, http://localhost:8000/___graphql
query {
site {
siteMetadata {
title
description
}
}
}
If you enter and execute}, the title and description of the site set in gatsby-config.js enter code here will be displayed. This is normal. So how do you write a query to display facebook article data?
I searched a lot to solve this problem, but I didn't find a solution.
I only found a similar question (How to add facebook comment plugin in Gatsby?) but it could not be resolved. This question was the same as what I wrote here (https://www.gatsbyjs.org/packages/gatsby-source-facebook/).
tl;dr:
Try this:
query {
allFacebookArticles {
edges {
node {
title,
description
}
}
}
}
Explanation
That plugin stores its data into types matching the format Facebook${type} where $type is the type of thing you're pulling (in your case, articles, so it'd be FacebookArticle).
From GraphiQL, though, you should be able to see that on the sidebar on the left.
Here's an example from my current project (with some other options open):
On the Google Sheet API Documentation, I see you can update Sheet name but not the Spreadsheet name. Does anyone know if it is possible to rename a Google Spreadsheet?
You want to change the Spreadsheet name.
If my understanding is correct, how about this answer?
You can change the Spreadsheet name using Sheets API. When the Spreadsheet name is changed, the method of spreadsheets.batchUpdate of Sheets API is used. The endpoint and request body are as follows.
Endpoint:
POST https://sheets.googleapis.com/v4/spreadsheets/### spreadsheetId ###:batchUpdate
Request body:
{
"requests": [
{
"updateSpreadsheetProperties": {
"properties": {
"title": "### please set the Spreadsheet name ###"
},
"fields": "title"
}
}
]
}
Note:
Also you can change the Spreadsheet name using the method of Files: update Drive API.
References:
spreadsheets.batchUpdate
UpdateSpreadsheetPropertiesRequest
SpreadsheetProperties
If I misunderstood your question and this was not the result you want, I apologize.
I apologize if this is a stupid question. I have been spending quite a while trying to get daily updates for my google assistant app to work (found at https://developers.google.com/actions/assistant/updates/daily).
I get the prompt on my phone to initiate the daily updates because my server gets the configure updates event. However, I think I am not sending the correct response back because I just get the error "UnparseableJsonResponse: API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find the field."
Usually, my server just responds with a JSON in the structure:
return{
"speech": 'sample text',
"DisplayText": 'sample text',
"source": "sample"
}
However, according to the Google documentation, I need to return the JSON
{
"conversationToken":"",
"expectUserResponse":true,
"expectedInputs":[
{
"inputPrompt":{
"initialPrompts":[
{
"textToSpeech":"PLACEHOLDER_FOR_REGISTER_UPDATE"
}
],
"noInputPrompts":[
]
},
"possibleIntents":[
{
"intent":"actions.intent.REGISTER_UPDATE",
"inputValueData":{
"":"",
"intent":"tell.tip",
"triggerContext":{
"timeContext":{
"frequency":"DAILY"
}
},
}
}
]
}
]
}
I tried returning this exact JSON but as I suspected it's not that simple. I'm not sure how to adapt this format to one that dialogflow expects. Any help would be much appreciated. Note that I'm looking at the response structure at https://dialogflow.com/docs/fulfillment. I also considered the actions on google structure too at https://developers.google.com/actions/reference/rest/Shared.Types/AppResponse. I'm just very confused on how to do this since the guide is mostly suited for people using node js and the SDK.
I need to make auto furigana view for my Japanese website content. For that I just tried many possible solutions.
In Yahoo's API there is a way of doing it.
<?php
$appid = 'My api Key';
$sentence1="日本";
$sentence = mb_convert_encoding($sentence1, 'utf-8', 'auto');
echo $request = "http://jlp.yahooapis.jp/FuriganaService/V1/furigana?appid=".$appid."&sentence=".urlencode($sentence);
But In this Yahoo API, we need to include all content into a variable and split into separate. It makes more time because my content is dynamics.
I need a auto furigana solution like IPA Furigana Google Extension.
Thanks in advance.
https://www.furiousgana.com/api/
Adding this here for anyone who might be interested in furigana generation.
You can generate furigana by sending a post request to this 'https://api.furiousgana.com' and setting the body of the data to an object or array.
The English tag is optional.
const query = [
{
japanese:'気を付けて',
english:'Take care!'
},
{
japanese:'お元気ですか?',
english:'Are you ok?'
}
]
axios({
method: 'post',
url: 'https://api.furiousgana.com',
data: query
})
.then(({data})=>{
console.log(data) // here is you data
});
The final step would be to parse the generated furigana so that it wraps the content in & tags
This github will help full for furigana.
Just pass the variable to the kuroshiro.convert('variable') and then you will get the data with furigana also with ruby tag.
https://github.com/hexenq/kuroshiro.js
I'm trying to use the postmark api to send an html email that has images in it. I know postmark supports inline image attachments but i don't know how to go about it. I've gone through the documentation but the example given there seems vague and i quite understand it.
How do i go about this?
Your API call would basically look like this:
{
"From": "signature#yourdomain.com",
"To": "someone#example.com",
"Subject": "Regular API Test",
"Tag": "inline",
"HtmlBody": "<html><body><strong>hello bacon!</strong<br /><img src=\"cid:myimagecid\"/></body></html>",
"TextBody": "Hello",
"Attachments": [
{
"Name": "bacon.jpg",
"Content": "/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERA...gDgBAA9GT/APrP/9k=",
"ContentType": "image/jpeg",
"ContentID": "cid:myimagecid"
}
]
}
You compose your html with references to the image by way of a ContentID (CID) instead of specifying a link to the source. Then, you embed the base64 converted string of your image as the Content part of the attachment. The ContentID field lets the html know where to find the image data in the email.
You can use the framework of whatever platform your using to encode the images as base64. To practice, try a site like http://www.base64-image.de/step-1.php which will give you the base64 string of an uploaded image.