I need your help how do i go to the next data and follow them, the json is below
"paging": {
"cursors": {
"before": "QVFIUkpHTGJjc2RVTDY5YUpnb240dEdCbTVKZAGNhZAjJSNmY0TzJVRWhNcXk4eVROVU5nRzJUWFFuS1dZAMDhhVFNHMEJ6X0ZAqQTlHMmlfRk9ISHo0Qkw3MTdn",
"after": "QVFIUlFsWXF0OUJLVXdkb0Y3TXBhVG5LVUxCeVN1ZAjhoeVNudkdHXy1tZAWZAOTW1DbzZAIOTJmNGw1RjlKS3liYXJJdWtKMXAtQXNHM0NjVGIzN1JnY3hVTFVB"
},
"next": "https://graph.facebook.com/v1.0/1512513832114020/members?access_token=token&pretty=1&fields=name&limit=100&after=QVFIUlFsWXF0OUJLVXdkb0Y3TXBhVG5LVUxCeVN1ZAjhoeVNudkdHXy1tZAWZAOTW1DbzZAIOTJmNGw1RjlKS3liYXJJdWtKMXAtQXNHM0NjVGIzN1JnY3hVTFVB",
"previous": "https://graph.facebook.com/v1.0/1512513832114020/members?access_token=token&pretty=1&fields=name&limit=100&before=QVFIUkpHTGJjc2RVTDY5YUpnb240dEdCbTVKZAGNhZAjJSNmY0TzJVRWhNcXk4eVROVU5nRzJUWFFuS1dZAMDhhVFNHMEJ6X0ZAqQTlHMmlfRk9ISHo0Qkw3MTdn"
}
Its facebook graph api, so after the extract done, its move to next page until data empty.
in C#, you must use newtonsoft.dll to process data of JSON.
You can download at: https://www.newtonsoft.com/json
Related
I am trying to implement Blob transcript storage(https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp#blob-transcript-storage-implementation). I am able to implement and see the stored transcripts in Azure blob storage under container as json files. Now the issue I am facing is how do I display them properly. If I use SendActivityasync then it displays both bot and user messages as if bot is typing it (on the bot side-left side).
Is there a way to dump the transcript in one go? Just to display the whole conversation or is it supposed to be done one by one? Is there a function that allows this?
Since these transcripts are saved using conversation ids, how do I use this sample to get only the user who's using the bot and not all? If the conversation ids are new for each conversation and user ids according to sample is generated using 'Guid.NewGuid()' it will be random everytime. Are these being saved to keep track of users? Is there any sample to see the whole thing?
I have seen a lot of samples mentioning this being used for debugging. Has anyone implemented this and if so what samples are you following?
Thanks
This is answered in this GitHub Issue. The original issue is pretty old, but there's an updated answer in the linked comment.
Basically, you need to:
Load all of your activities from storage (maybe use the Blob REST API for this)
Pass the activities in to the createStore() method
Pass the store into the renderWebChat() method. For example:
// This is just an example. You'll want to populate history with
// an array of activities from your storage.
const history = [
{
type: "message",
id: "******************",
timestamp: "2020-10-30T20:45:52.7120529Z",
channelId: "webchat",
from: {
id: "******************",
name: "******************",
role: "bot",
},
conversation: {
id: "******************",
},
locale: "en-US",
text: "THIS IS A PREVIOUS MESSAGE",
inputHint: "acceptingInput",
attachments: [
],
entities: [
],
replyToId: "******************",
}
]
[...]
const store = window.WebChat.createStore({ activities: history}, ({ dispatch }) => next => action => {
return next(action);
});
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: token }),
store
},
document.getElementById('webchat'));
[...]
On the Slack website, I can format a message like this:
{
"text": "<http://google.com|link to google>"
}
And in the message it will appear like this:
link to google
But I am trying to write a bot and those links aren't working. Using my websocket connection I can send a message like this:
var send = new MessageToSlack()
{
type = "message",
channel = msg.channel,
text = $"http://google.com"
};
ws.SendAsync(JsonConvert.SerializeObject(send), b => { });
And Slack will correctly interpret http://google.com as a link and display it like:
http://google.com
But if I try to send a message with the link in angle brackets with the pipe between the link and the link text (which works on Slack's site) like this:
var send = new MessageToSlack()
{
type = "message",
channel = msg.channel,
text = $"<http://google.com|to google>"
};
ws.SendAsync(JsonConvert.SerializeObject(send), b => { });
I end up with:
<http://google.com|to google>
So how do I get this working from my bot? Why is it not able to parse by links correctly? What am I missing?
As far as I can see from the docs, this should work. Here in the section on formatting messages it says:
The RTM API only supports posting simple messages formatted using our default message formatting mode.
And links to here which does mention links with the pipe character, so I think it should work.
(note MessageToSlack is just an ordinary .NET class with type, channel and text properties that gets serialized by JSON.Net and appears to give the correct JSON. ws is my websocket connection from the WebSocketSharp nuget package)
JSON:
{
"id": 1,
"type": "message",
"channel": "C6QRKT0EA",
"text": "<http://google.com|to google>"
}
Edit: So it seems if I switch from replying with the web socket connection and instead post to https://slack.com/api/chat.postMessage, it will work correctly, but it's a bit more fiddly to use and the documentation led me to believe that the links should work without needing to jump through that particular hoop. Am I just misreading the docs? Or are docs just not very clear on this point?
Try to enable markdown support by adding "mrkdwn": true to your json
{
"type": "message",
"channel": "C6QRKT0EA",
"text": "<http://google.com|to google>",
"mrkdwn": true
}
Read Message Formatting section. Hope it will help.
We are using the GMail Api in a C# application, and have received a message with an embedded image.
You can see the image if you look at the GMail account (in a browser as a user) but I am unable to find it either in the Payload or get an attachment id when I use the api.
Does the api even support accessing embedded images?
If I use:
var part = message.Payload.Parts
.Where(x => x.MimeType.Equals(mimeType))
.Select(x => x.Body.Data)
.FirstOrDefault();
With the Mime type set to Gif,Jpeg or Tiff it always comes back null;
You might want to check the - Users.messages: get
Gets the specified message.
To be familiar on the structure specially when reading the email message Resource representations. I used the Try it now to get the Users.messages resource in the response body and how it will be formed.
When checking the email, the embedded image will fall in the payload.
........
{
"partId": "1",
"mimeType": "image/png",
"filename": "pasted1",
"headers": [
{
"name": "Content-Type",
"value": "image/png; name=pasted1"
},
.........
This is how it should look like.
Hope this helps.
So, what I would like to do is to programmatically create a link to share with my colleagues in an email message, which allows them to open a OneNote page directly in the App.
I was able to figure out that my link is going to be something like:
onenote://base-path ...
but I'm not getting how to build the base-path link,
I'm able to have all the necessary page details (I guess) from an API call.
can anybody please tell me how to build a link for opening a OneNote page directly in app?
Thanks
You can use the GET Pages endpoint in the REST API to retrieve information about a specific page. The response will include a links field which contains a URL that will open that page in the OneNote client (if its available).
Here is an example response:
{
...
"links": {
"oneNoteClientUrl": {
"href": "onenote:https:\/\/d.docs.live.net\/73dbaf9b7e5c4b4c\/Documents\/James's%20Notebook\/PCR.one#PCR%20Test%20Page\u00ac\u00dfion-id=3dcda1be-9e78-aa4c-b97d-9cdbe9e5cfab&page-id=57197857-14bc-fd48-b2e7-16c2dbce94ee&end"
},
"oneNoteWebUrl": {
"href": "https:\/\/onedrive.live.com\/redir.aspx?cid=73dbaf9b7e5c4b4c&page=edit&resid=61528580FB755FBB!107&wd=target%28PCR.one%7C3dcda1be-9e78-aa4c-b97d-9cdbe9e5cfab%2FPCR%20Test%20Page%7C57197857-16bc-fd48-b2e7-26c2dbce94ee%2F%29"
}
}
...
}
This example was taken from: https://dev.onenote.com/docs#/reference/get-pages/v10menotespagesfilterorderbyselectexpandtopskipsearchcount/get
I hope this helps!
I'm trying to implement a domain search in our website, but I have no clue how... the WHOIS service I registered by, gave me an API key to use... When I use the following address in my browser's url,
http://api.robowhois.com/v1/availability/example.com
a login box appears, asking me for my username and password, when I type in my username and password which is the key they gave me, a page appears with the following
{
"response": {
"available": false
}
}
I'm sorry to say, but I've been searching for weeks on how to solve this but at the end my last resort was to turn to stack overflow... can someone please help, is there a way on how to use and call the url and use the info?
You already got the information you need. It responds with a JSON object saying it's not available.
To retrieve the information as you wish, you can use Jquery, just put your URL in a function as in the examples and get data.response.available value and assign it to your textbox etc. For more information how to make JSON calls and parse them, check out this documentation in Jquery website.
RoboWhois is a web service that provides an API suite to access WHOIS
records and domain related information with a unified, consistent
interface. Using RoboWhois API you can retrieve WHOIS details parsed
as convenient JSON structure.
In order to check the availability of a given domain you have to send a http get request to the robowhois api http://api.robowhois.com/v1/availability/example.com
The server does answer the request by sending http response containing json which looks like this:
{
"response": {
"available": false
}
}
which means the domain is no longer available.
In order to use the information contained in the json response you should deserialize the json object to a c# object. You can do this for example with the json.net library.
Here is a small example from the documentation on how to use json.net to deserialize a json:
Product product = new Product();
product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string output = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "ExpiryDate": "2008-12-28T00:00:00",
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}
Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output);