How can I make creator properties and recipients not "swap" correctly? - google-mirror-api

Hi there I am trying to replicate the functionality of stock SMS messages. The issue I'm having is that when I reply to a card that I "created" and sent to another person it puts my image as the recipient.
Heres the timeline items json:
"text":message,
"notification": {
"level": "DEFAULT"
},
"creator": {
"displayName": "Me",
"imageUrls": [
fromimage
]
},
"recipients": [{
"displayName": "Them",
"imageUrls": [
toimage
]
}],
"menuItems": [
{
"action": "REPLY"
}
]
};
When I reply I want it to be this:
...
"creator": {
"displayName": "Them",
"imageUrls": [
toimage
]
},
"recipients": [{
"displayName": "Me",
"imageUrls": [
fromimage
]
}],
...
Instead I get this:
...
"creator": {
"displayName": "Me",
"imageUrls": [
fromimage
]
},
"recipients": [{
"displayName": "Me",
"imageUrls": [
fromimage
]
}],
...
So right now I'm patching the timeline card when I get notification of reply but it still shows my picture as the background when I reply "to myself"

This is working as intended: when the user replies to a timeline card, the user is indeed the creator of the reply timeline card and the recipients are the creator or the recipients (minus the user) of the original timeline card.

Related

How to subscribe to the coinbase websocket?

I have referred to the following resources:
https://docs.cloud.coinbase.com/exchange/docs/websocket-overview
https://docs.cloud.coinbase.com/exchange/docs/websocket-channels
After I connect to wss://ws-feed.exchange.coinbase.com, I send a subscribe message but it is always rejected by the server.
Example 1:
To coinbase:
{
"type": "subscribe",
"product_ids": [
"ETH-USD",
"ETH-EUR"
],
"channels": [
"level2",
"heartbeat",
{
"name": "ticker",
"product_ids": [
"ETH-BTC",
"ETH-USD"
]
}
]
}
From coinbase: {"type":"error","message":"channel is required"}
Example 2:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "heartbeat", "product_ids": ["ETH-EUR"] }]
}
From coinbase: {"type":"error","message":"channel is required"}
Example 3:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
From coinbase: {"type":"error","message":"channel is required"}
Basically, I cannot subscribe to any channel.
Question> What did I do wrong here?
Thank you
Perhaps something is being cached where what you're sending isn't what you think you're sending? Because it worked perfectly for me here.
With wss://ws-feed.exchange.coinbase.com as the url and
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
as the message.

Report State Always Return 404 after SYNC

I am able to pass the Test Suite but suddenly I'm getting the error 404 on the first time Report State after SYNC, which causes Account Linking failed. I have used the Validator provided at Smart Home Developer portal for my SYNC response which has no issue. And I found if I STOP then START my instance at GCP console, this issue is gone but comes back after a couple times of Account Linking and Unlink.
SYNC JSON object:
{
"requestId": "8044981777755038463",
"payload": {
"agentUserId": "123456789",
"devices": [
{
"id": "123-Fan",
"type": "action.devices.types.FAN",
"traits": [
"action.devices.traits.OnOff",
"action.devices.traits.FanSpeed"
],
"name": {
"defaultNames": [
"Simple Connect Fan"
],
"name": "Livingroom Fan",
"nicknames": [
"Simple Connect Fan"
]
},
"willReportState": true,
"attributes": {
"availableFanSpeeds": {
"speeds": [
{
"speed_name": "S0",
"speed_values": [
{
"speed_synonym": [
"stopped",
"speed 0"
],
"lang": "en"
}
]
},
{
"speed_name": "S1",
"speed_values": [
{
"speed_synonym": [
"low",
"speed 1"
],
"lang": "en"
}
]
},
{
"speed_name": "S2",
"speed_values": [
{
"speed_synonym": [
"medium",
"speed 2"
],
"lang": "en"
}
]
},
{
"speed_name": "S3",
"speed_values": [
{
"speed_synonym": [
"high",
"speed 3"
],
"lang": "en"
}
]
}
],
"ordered": true
},
"reversible": false
},
"deviceInfo": {
"manufacturer": "company",
"model": "test"
},
"customData": {
"speedType": 3
}
},
{
"id": "123-Light",
"type": "action.devices.types.LIGHT",
"traits": [
"action.devices.traits.OnOff",
"action.devices.traits.Brightness"
],
"name": {
"defaultNames": [
"Simple Connect Light"
],
"name": "Livingroom Light",
"nicknames": [
"Simple Connect LIGHT"
]
},
"willReportState": true,
"attributes": {
"commandOnlyOnOff": false
},
"deviceInfo": {
"manufacturer": "company",
"model": "test"
}
}
]
}
}
Report State JSON object:
{
"requestId": "11859327534344019896",
"agentUserId": "123456789",
"payload": {
"devices": {
"states": {
“123-Fan": {
"online": true,
"on": false,
"currentFanSpeedSetting": "S3"
},
“123-Light": {
"online": true,
"on": false,
"brightness": 70
}
}
}
}
}
I'm getting the error 404 on the first time Report State after SYNC, which causes Account Linking failed.
These two things should not be directly linked. The account linking flow should succeed if:
Google successfully receives an OAuth access token
Initial SYNC intent is successful
Initial QUERY intent is successful
Whether or not you are able to successfully call Report State should not cause account linking to fail. It would be because of an error in one of the above steps.
Regarding the 404 error itself, this is likely a timing issue. Until the above linking process is complete, the agentUserId and corresponding device IDs are not yet written to Home Graph. If the API call comes in too soon, this would cause a 404 error.
For the account linking process, however, this is not necessary. The initial QUERY intent sent during the above flow accomplishes the same end populating the initial state in Home Graph. Our Report State guide was recently updated to reflect this change:
Following the initial SYNC for a device, the platform sends a QUERY intent that gathers the state of the device to populate Home Graph. After that point, Home Graph only stores the state that is sent with Report State.
You should determine if you can get account linking to succeed without making an initial call to Report State.

Botkit is not sending Generic Template (Attachments) facebook messenger

I am trying to reply to the user with this message:
bot.reply(message, {
"attachment":
{
"type": "template",
"payload": {
"template_type": "generic",
"sharable": true,
"elements": [
{
"title": "MY title of bd",
"image_url": "https://storage.googleapis.com/ssfkj.com/undefined",
"subtitle": "undefined/undefinedundefinedn(undefined)",
"default_action": { "type": "web_url", "url": "https://ssfkj.com/profile", "messenger_extensions": true, "webview_height_ratio": "tall", "fallback_url": "https://ssfkj.com/profile" }
, "buttons": [{ "type": "payload", "payload": "DEL__PA_undefined", "title": "View more" }
]
}]
}
}
});
But the bot is sending nothing. What is wrong in my code?
My problem was on this level :
"buttons": [{ "type": "payload", "payload": "DEL__PA_undefined", "title": "View more" }]
The
type property
should have the value
postback
not
payload

Docusign Send Multiple Envelope to multiple Signer with one to one Document to Signer mapping

I have been working on Salesforce to Docusign Integration. I have multiple documents with Specific signer for each document i.e. one document should be send to one specific user, not all. But I want to do this in one Rest API call to docusign! The documents are stored in Accounts attachments which are created dynamically for each user which are specific to user.
I have been trying this using CompositeTemplates, what I am doing is, adding document and Signer in each inlineTemplate, But it is sending all the documents to all the users in sequence.
I don't want to show all document to all the user, they should see only document specific to them.
Below is the JSON which I am sending:
{
"status": "Sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 1",
"recipientId": "1",
"name": "Anmol",
"email": "test#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test1"
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": "JVBERi0xLjQKJeLjz9MKN58HkeCg8gJEomcWGJdEFtOYYklsXV2dlT6R6Owc+FXFMNSlpckKM6M/ioTGkROkEjkxBDrgthySkvMxGpQJYapHKWwcwXtRU9GCg=="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "1"
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 2",
"recipientId": "1",
"name": "Anmol",
"email": "test1#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test2"
},
"documents": [
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": "JVBERi0xLjYNJeLjz9MNCjEzIDAgb2JqDTw8L0xpbmVhcmlmDQoxMTYNCiUlRU9GDQo="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "2"
}
]
}
Any doc, code or suggestions about the approach I am following for this will be very helpful.
To do it in a single api call, specify the excludedDocuments property in the EnvelopeCreate request
excludedDocuments: Specifies the documents that are not visible to the recipient. Document Visibility must be enabled for the account and the enforceSignerVisibility property must be set to true for the envelope to use this.
Here is a sample Json for POST /v2/accounts/{accountId}/envelopes
Note: I have combined both your inline templates into a single inlineTemplate.
{
"status": "Sent",
"emailSubject": "Email Subject to all recipients",
"emailBlurb": "Email body to all recipients",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"recipientId": "1",
"name": "recipient one",
"email": "recipientone#dsxtr.com",
"excludedDocuments": [ "2" ]
},
{
"recipientId": "2",
"name": "recipient two",
"email": "recipienttwo#dsxtr.com",
"excludedDocuments": [ "1" ]
}
]
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": ""
},
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": ""
}
]
}
],
"compositeTemplateId": "1"
}
]
}
I believe you're looking for documentVisibility on the create envelope call.
There are other supporting documentVisibility endpoints here.

How to avoid loading attachments data from Gmail Rest API get message

How to avoid loading attachments data from Gmail Rest API with get message request.
Using the fields parameter at least we can avoid loading few fields but when I want to load message body, attachment data also coming along with body just like IMAP
You don't get the attachment like you do in IMAP. You get an attachmentId which you have to use in an additional request to get the attachment.
I just sent a message with an attached image to myself. This is what the response from the API looks like:
{
"id": "1573ec1aa0976b42",
"threadId": "1573ec1aa0976b42",
"labelIds": [
"SENT",
"INBOX",
"IMPORTANT",
"UNREAD"
],
"snippet": "",
"historyId": "939514",
"internalDate": "1474226662000",
"payload": {
"mimeType": "multipart/related",
"filename": "",
"headers": [ ... ],
"body": {
"size": 0
},
"parts": [
{
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "multipart/alternative; boundary=94eb2c0d3cba8637a2053ccd2461"
}
],
"body": {
"size": 0
},
"parts": [
{ ... },
{
"partId": "1",
"mimeType": "image/png",
"filename": "Screen Shot",
"headers": [ ... ],
"body": {
"attachmentId": "ANGjdJ-bmCvsIaV-4KfALXzVV_D567w4i6ksLnwIZhLAl3VXCE335663UbmOLC_vbLrCFusNtnWVpdTv3i88uR482kFwLZqAcwmI7C5gFlamob2aK4-lqAPlCZs17jtCQR9y5Mt4nnpP_Kg64N9qgXbDF0E2vYnEw4xwtEKEo4fRIAbc94ZjjfynFD832mh1B37XFMt-bYw9wkNv24xBife0koBNYpKs-gGLJkfu2EoZouqunGDX9ry1jq2jW2AClWcFXPXvgRBMjUcoRDPtvb9LLLrBhDjU1hu6r1Ibc3c2BSoBogT8QyIp2VUCuFU",
"size": 1511996
}
}
]
},
"sizeEstimate": 1513185
}
As you can see, it just contains an attachmentId and no actual attachment data.

Resources