This is my response json Where I need to Add Attachments name and type dynamically (Without using storyboard), In case attachment count == 0 , attachment name/type view should not be shown
[{
"Name": "Name1",
"attachement": [{
"imagename": "Name 1",
"imagetype": "Png "
},
{
"imagename": "Name 2",
"imagetype": "Jpeg "
}
],
"DetailView": "This is sample detailview Example with very long information"
},
{
"Name": "Name1",
"attachement": [{
"imagename": "Test Image 1",
"imagetype": "Png "
}],
"DetailView": "This is sample detailview Example with very long information"
},
{
"Name": "Name1",
"attachement": [],
"DetailView": "This is sample detailview Example with very long information"
}
]
Here is how my view looks
Collapse case :
UITableview
--Cell
---- Name Label
Expend case after looping attachment to show on UILabel :
UITableview
--Cell
---- Name Label
---- DetailView Label
---- imagename": "Name 1"
---- imagename": "Name 2"
I am using this code to Show my Expend/collapse UITableview programatically
Related
I am able to send mail and add custom internetMessageHeaders. But what I'm attempting to do now is return messages based on filtering to the custom headers I'm adding.
Example:
If I add a custom header to the message for "x-custom-header-productid = x123z" I want to filter and return all messages that have the custom header for x-custom-header-productid that equals x123z. Is this possible?
Thanks!
The header needs to be provisioned in the Mailbox you want to search for it on eg https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-provision-x-headers-by-using-ews-in-exchange
So in the Graph if you send a Message using that mailbox that would provision it for use in that Mailbox eg
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "youmailbox#domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "String {00020386-0000-0000-C000-000000000046} Name X-blah-blah",
"value": "Food"
}
]
}
}
You could then search for any messages that arrived (after you provisioned that header)eg which would mean the property would be promoted in the store.
https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String {00020386-0000-0000-C000-000000000046} Name X-blah-blah' and ep/value eq 'Food')
I'm trying to use message formatting in slack. The Elastalert Testrule.yaml file is partially being parsed. The slack alert shows up with only slack_alert_fields and alert_text fields. I want to send attachments as well in the alerts.
How to use attachments or create buttons fort slack alerts?
es_host: elasticsearch
es_port: 9200
name: Test rule Alert
type: any
index: alerts-*
filter:
- term:
alertType.keyword: "New alert created"
alert:
- "slack"
slack_alert_fields:
- title: Network Name
value: networkName
short: true
- title: Alert Type
value: alertType
short: true
slack_actions:
- name: "network url"
text: "Network URL"
type: "button"
value: networkUrl
alert_text: |
alertData : {0}
alert_text_type: alert_text_only
alert_text_args: ["alertData"]
attachments: [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#37964f",
"pretext": "New alert created",
"title": alertData.reason ,
"fields": [
{
"title": "Network Name",
"value": networkName,
"short" : true
},
{
"title": "Timestamp",
"value": timestamp,
"short" : true
}
],
"actions": [
{
"name": "network url",
"text": "Network URL",
"type": "button",
"value": networkUrl
},
{
"name": "org_url",
"text": "Organization URL",
"type": "button",
"value": organizationUrl
}
]
}
]
slack_webhook_url:
- "https://hooks.slack.com/xxxxxxxxxxxxxxxxxxxxxxx"
Looking at the official documentation it appears that Elastalert does not support adding custom Slack attachments for alerts, because there is no property for it in the documentation.
In fact it seams that alerts are already formatted as attachment, which is why you can set a title and a title-URL. And also define additional "fields". Something that you can only do with attachments in Slack.
This also means that you can not specify buttons for your alerts (which are a special kind of attachments in Slack).
If you need this functionality I would suggest contacting the developer of Elastalert.
How can I set the ID of the record or doc in the Firebase Database when I use the JSON import functionality?
When I import the file it creates sequential IDs (0, 1, 2 etc), but I would like to specify an ID so its easier to retrieve the record.
Below is my sample JSON data:
[
{
"GameID": 2234567890,
"GameName": "Team 3 vs Team 2",
"GameLocation": "Rink 4 Hockey Town",
"TypeOfGame": "Tournament Round Robin",
"HomeTeam": {
"Name": "Team 1",
"ImageUrl": "My Image URL 1",
"Level": "16AAA",
"Country": "USA"
}
}, {
"GameID": 1234567890,
"GameName": "Team 1 vs Team 2",
"GameLocation": "Rink 1 Hockey Town",
"TypeOfGame": "Tournament Round Robin",
"HomeTeam": {
"Name": "Team 1",
"ImageUrl": "My Image URL 1",
"Level": "16AAA",
"Country": "USA"
}
}
]
There is no way in which you can import a JSON file and generate a custom Id in the same time. You are getting (0, 1, 2 etc) as Ids because there is no unique identifier between those objects and Firebase sees all those records as a list, and therefor provides those ids for you.
To achieve what you want, you need to add that data programmatically using the push() function provided by Firebase for each record. This method generates a unique id which easy to be used in the future.
[ {
"1234567890" : {
"GameID" : 1234567890,
"GameLocation" : "Rink 1 Hockey Town",
"GameName" : "Team 1 vs Team 2",
"HomeTeam" : {
"Country" : "USA",
"ImageUrl" : "My Image URL 1",
"Level" : "16AAA",
"Name" : "Team 1"
},
"TypeOfGame" : "Tournament Round Robin"
},
"2234567890" : {
"GameID" : 2234567890,
"GameLocation" : "Rink 4 Hockey Town",
"GameName" : "Team 3 vs Team 2",
"HomeTeam" : {
"Country" : "USA",
"ImageUrl" : "My Image URL 1",
"Level" : "16AAA",
"Name" : "Team 1"
},
"TypeOfGame" : "Tournament Round Robin"
}
} ]
I have a model for a routine like the following:
struct Routine {
var routineName: String!
var routineExercisesAndSets: [String:Int]!
}
And a UITableView where I collect data before creating a new instance of that model, which once created looks like:
var routine = Routine()
//values are assigned to the routine here and then when printed looks like below
(routineName: All Over,
routineExercisesAndSets: ["Bent Over Row": 3, "Barbell Curl": 3, "Bench Press (Flat)": 4])
How could I save this into Firebase so that it fits my data structure
"routines": {
"users unique identifier": {
"routine unique identifier": {
"routine_name": "routine name",
"routine_create_date": "routine created date",
"exercises": {
"exercise name": {
"Sets": "number of sets",
"rest between sets": "timer duration"
}
}
}
}
}
The user unique identifier will be the current logged in users uid and routine unique identifier will be an autoId, but how can I work through the model to push data to Firebase the same as the model?
If your user is authenticated try this:-
FIRDatabase.database().reference().child("routines/\(FIRAuth.auth()!.currentUser!.uid)").childByAutoId().setValue([
"routine_Name" : "All Over",
"routine_create_date": "routine created date",
"exercises": [
"exercise name": [
"Sets": "number of sets",
"rest between sets": "timer duration"
]]
])
I'm creating a Slack integration with the Slack API. I followed the documentation but the markdown formatting doesn't work on my attachments...
Here is my response object:
{
response_type: "in_channel",
text: "List:",
attachments: [
{
text: "*pseudo*:\nbla bla bla",
mrkdwn: true
}
]
}
The "*" are displayed and not evaluated. Did I make a mistake?
Set the attribute mrkdwn_in in attachments:
"attachments": [
{
"text": "*pseudo*:\nbla bla bla",
"mrkdwn_in": ["text"]
}
]
See https://api.slack.com/docs/formatting for more information.
Rep limit for commenting to an answer is stupid ... how are people supposed to get reputation if they cannot even interact with the forum.
Also sorry for necroing the old post, but it's the closest one to my issue that I've found so far.
Anyways, the mrkdwn_in property doesn't help much with the stars * problem in the attachments.
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#000000",
"mrkdwn_in": ["fields", "text"],
"fields": [
{
"title": "XXXXXX",
"value": "*PVC* avg: xxs, max: xxxs, avg-diff: xx% \n*EPH* avg: xxs, max: xxxs, avg-diff: xx%",
"short": true
},
{
"title": "XXXXXX",
"value": "*PVC* avg: xxs, max: xxxs, avg-diff: xx% \n*EPH* avg: xxs, max: xxxs, avg-diff: xx%",
"short": true
}
]
},
.
.
.
After avg-diff: I'm inserting a string " *↑* " and concatenating it with the rest of the message.
For some reason the downwards arrow " _↓_ " gets translated to HTML correctly. It's just the bold that's broken.
As a result, the message still contains the * around the ASCII arrow, but the rest of the text like *PVC* gets translated into HTML correctly
Screenshot of the attachment from Slack