I am trying to build Slack application with asp net core server. Currently, I have added Slash command which makes a request to my local server through ngrok. Once my server receives that request, it makes a post request to configured slack webhook to display interactive message which looks like pic from attachment.
I want user to be able to select yes or no and receive the result in my controller, but I can't realize how to tell Slack where should it make a post request. I attach the code of this message which is posted through weebhook into Slack:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a section block with a button."
}
},
{
"type": "actions",
"block_id": "actionblock789",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Yes"
},
"style": "primary",
"value": "yes"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "No"
},
"value": "no"
}
]
}
]
}
What I have in netcore is TestController with route /api/test which I suppose should receive from Slack a payload where information about selected button is set, but I couldn't find a way where specify a url in this json code.
You can not configure a URL in the JSON code. That is not how it works with the Slack API.
Slack will send all responses to interactive message - like when someone clicks on a button - to the configured request URL of your Slack app. Check out this link how to find that parameter: documentation
Related
I'm following the tutorial here https://developer.bigcommerce.com/api-docs/storefront/widgets/widgets-tutorial
I made the widget template by performing a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widget-templates with this in the body
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}"
}
The response was successful.
I then performed a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widgets
with this in the body
{
"name": "Header Images",
"widget_configuration": {
"images": [
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/91/309/thekinfolktablecover_1024x1024__80715.1456436719.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/109/361/kinfolkessentialissue_1024x1024__22507.1456436715.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/500x659/products/85/282/livingwithplants_grande__26452.1456436666.jpg?c=2&imbypass=on"
}
]
},
"widget_template_uuid": "7c5f05c2-2361-45a3-bb99-89554dd145ee"
}
The response was successful.
My custom widget does then appear in page builder but when I try to add it I receive this error
This widget is not supported by Page Builder. Please consult our developer documentation for more information on how to make your
widget compatible with Page Builder
When I visit the developer documentation it links to on how to make it compatible with Page Builder I don't see any mention of Page Builder.
Is there any way to find out how to make the tutorial widget compatible with Page Builder?
#Mikhail was correct. I was able to add it as a widget accessible by page builder by specifying a schema in the body of my widget-templates post request. After sending another request with the schema added like this:
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}",
"schema": [
{
"type": "tab",
"label": "Content",
"sections": []
}
]
}
It worked.
You can find more information about schema settings for page builder here https://developer.bigcommerce.com/stencil-docs/page-builder/page-builder-overview
and you can find a list of the items available in your schema here https://developer.bigcommerce.com/stencil-docs/page-builder/schema-settings
I am trying to use the Layout Automation feature of the Social Tables API. When I submit my request, the following error response is returned:
{ "message": "Access Denied to this feature" }
This is the only API method that returns this message. I am able to perform other API actions successfully.
Here is the body for my request. Is something wrong with my request, or is there currently an issue with this API method?
{ "attendee_management": true,
"category": "Association",
"end_time": "2017-05-30T18:56:03.318Z",
"name": "Test Event",
"public": true,
"start_time": "2017-05-30T18:56:03.318Z",
"uses_metric": true,
"spaces": [
{
"name": "Test Space",
"venue_id": "131935",
"wizard": {
"attendees": 100,
"setup": "staggered",
"spacing": {
"x": 2,
"y": 2
}
}
}
],
"venue_mapper_version": 0 }
Your request structure is correct, but access to the Layout Automation API endpoints is currently a paid feature. A good next step might be to contact sales and explore the option of adding access to your account.
Cheers,
Robert
botframework Node.js [DirectLine 3.0 API / React Native Client (Android)] Events received by client websocket as a consequence of calling builder.Prompts.text() in a bot are missing the ‘data’ property (i.e. the activity payload).
Version Information
React Native Client (Android)
Node.js v7.5.0
react-native v0.41.2
Bot
Node.js v6.3.1
botbuilder v3.7.0
DirectLine
API v3.0
Description of Issue
Events received by client websocket as a consequence of calling builder.Prompts.text() in a bot are missing the ‘data’ property (i.e. the activity payload).
Note: Subsequent events following this one will include the Symbol ‘original_event’ which includes the missing event details that would have been expected in the initial event.
Direct Line request from bot (i.e. captured from ChatConnector.authenticatedRequest()):
{
json: true,
method: “POST”,
url: “https://state.botframework.com/v3/botstate/directline/conversations/[MY CONVERSATION ID]”,
body: {
from: {
id: “MyBot#ZSXyfFggVqW”,
name: “MyBot”
},
recipient: {
id: “MyClientId”
},
text: “Hi Pete, please enter the code displayed in the browser page to complete the sign in process.”,
type: “message”
}
}
Event received by websocket:
{
… // Expecting a data property at this level. Don’t confuse this with the data property in the Symbol below, which is for the previous event.
Symbol(original_event): {
data: "{
"activities": [
{
"type": "typing",
"id": "[MY CONVERSATION ID]|5ChLjtMKBEz",
"timestamp": "2017-05-04T10:37:48.3923201Z",
"channelId": "directline",
"from": {
"id": "MyBot",
"name": "MyBot"
},
"conversation": {
"id": "[MY CONVERSATION ID]"
}
}
]}",
type: ”message”
},
timestamp: 1493894269211,
type: “message”
}
Event after the one above contains:
{
…
Symbol(original_event): {
data: "{
"activities": [
{
"type": "message",
"id": "[MY CONVERSATION ID]|0000030",
"timestamp": "2017-05-04T10:37:49.092354Z",
"channelId": "directline",
"from": {
"id": "MyBot",
"name": "MyBot"
},
"conversation": {
"id": "[MY CONVERSATION ID]"
},
"text": "Hi Pete, please enter the code displayed in the browser page to complete the sign in process.”
}
],
"watermark": "30"
}",
type: ”message”
},
timestamp: 1493894511787,
type: “message”
}
Notes:
• Notice that the event following the original has the data property we would have expected, contained in the Symbol “original_event”.
• If the same conversation thread is attempted for any other channel type, the message “Hi Pete, please enter the code displayed in the browser page to complete the sign in process” IS shown in the chat window (i.e. Skype, Slack, Web Chat etc). It is only direct line that appears to have the issue.
• The message in question is a proactive message triggered after a user has been authenticated and a redirect URL called. The message is required to prompt the user for a second form of authentication, in this particular case an access code.
• If all historic message activities are requested for the above conversation, the missing message is among said activities i.e.:
https://directline.botframework.com/v3/directline/conversations/[MY CONVERSATION ID]/activities?watermark=[INITIAL WATERMARK]
{
"activities": [
…
{
"type": "message",
"id": "[MY CONVERSATION ID]|0000009",
"timestamp": "2017-05-04T17:48:33.0747342Z",
"channelId": "directline",
"from": {
"id": "MyBot"
},
"conversation": {
"id": "[MY CONVERSATION ID]"
},
"text": "Hi Pete, please enter the code displayed in the browser page to complete the sign in process."
}
…
Any suggestions?
Update 05/05/2017
Currently pursing two avenues of thought, either there is an issue with the WebSocket library bundled with React Native, or we have a general Direct Line WebSocket issue (a colleague of mine will be retesting with a native IOS client this morning to confirm one way or another).
No longer an issue. Websocket events now appear to be coming through as expected.
I have a hybrid app and having some issue seeing notification..
I get the error
com.ibm.pushworks.server.exceptions.PushWorksException: FPWSE0009E: Internal server error. No devices found
I running on Local MFP (eclipse -- V7.1).. I see the device in the worklightconsole and the app is install on my phone (Xcode->phone via USB) and I see the opt-in notification message.. However, I get the error when I tried to send a push..
I am using postman and the restAPI
http://localhost:10080/worklightadmin/management-apis/1.0/runtimes/MyMobile/notifications/applications/myProj/messages
Here is the body of the post request
{
"message": {
"alert": "Test message"
},
"settings": {
"apns": {
"badge": 1,
"iosActionKey": "Ok",
"payload": {},
"sound": "song.mp3"
},
"gcm": {
"payload": {},
"sound": "song.mp3"
}
},
"target": {
"consumerIds": [],
"deviceIds": ["166CB698-45C2-4C61-9074-248EA4F8AA8F"],
"platforms": [
"A","G"
]
}
}
Can you give some hints to solve this issue ..
Thanks
As Vivin mentioned in the comments, your device ID may be wrong.
The same JSON works for me , in my local setup. Is it possible the device id you entered is wrong? With the current parameters within "target" you can get the error message only if the device id is wrong.
I have been trying to create a job to load a compressed json file from Google Cloud Storage to a Google BigQuery table. I have read/write access in both Google Cloud Storage and Google BigQuery. Also, the uploaded file belongs in the same project as the BigQuery one.
The problem happens when I access to the resource behind this url https://www.googleapis.com/upload/bigquery/v2/projects/NUMERIC_ID/jobs by means of a POST request. The content of the request to the abovementioned resource can be found as follows:
{
"kind" : "bigquery#job",
"projectId" : NUMERIC_ID,
"configuration": {
"load": {
"sourceUris": ["gs://bucket_name/document.json.gz"],
"schema": {
"fields": [
{
"name": "id",
"type": "INTEGER"
},
{
"name": "date",
"type": "TIMESTAMP"
},
{
"name": "user_agent",
"type": "STRING"
},
{
"name": "queried_key",
"type": "STRING"
},
{
"name": "user_country",
"type": "STRING"
},
{
"name": "duration",
"type": "INTEGER"
},
{
"name": "target",
"type": "STRING"
}
]
},
"destinationTable": {
"datasetId": "DATASET_NAME",
"projectId": NUMERIC_ID,
"tableId": "TABLE_ID"
}
}
}
}
However, the error doesn't make any sense and can also be found below:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Job configuration must contain exactly one job-specific configuration object (e.g., query, load, extract, spreadsheetExtract), but there were 0: "
}
],
"code": 400,
"message": "Job configuration must contain exactly one job-specific configuration object (e.g., query, load, extract, spreadsheetExtract), but there were 0: "
}
}
I know the problem doesn't lie either in the project id or in the access token placed in the authentication header, because I have successfully created an empty table before. Also I specify the content-type header to be application/json which I don't think is the issue here, because the body content should be json encoded.
Thanks in advance
Your HTTP request is malformed -- BigQuery doesn't recognize this as a load job at all.
You need to look into the POST request, and check the body you send.
You need to ensure that all the above (which seams correct) is the body of the POST call. The above Json should be on a single line, and if you manually creating the multipart message, make sure there is an extra newline between the headers and body of each MIME type.
If you are using some sort of library, make sure the body is not expected in some other form, like resource, content, or body. I've seen libraries that use these differently.
Try out the BigQuery API explorer: https://developers.google.com/bigquery/docs/reference/v2/jobs/insert and ensure your request body matches the one made by the API.