I am now using fastlane and I can post to slack like this.
version = get_version_number(xcodeproj: "***")
slack(
message: "<!here|here>: New :ios: *#{version}* has been submitted to Dev Hockey :rocket:.",
)
In terminal, I saw something like this after deployment is finished. How can I get get that url and post automatically to slack?
[15:35:04]: Public Download URL:
https://upload.hockeyapp.net/apps/52da8f2b3da60cf8b6d4eaas5f06ae9b
I am reading about their code and they are printing to terminal something like this. But, I don't know how to retrieve and post to slack.
https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/hockey.rb
Khant Thu Linn you found a good snippet.
In the fastlane docs you can see all context variables.
To get the hockey app download link use
lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK]
which will be generated by hockey.
This could be an example Slack call for your fastfile:
slack(
message: "New :ios: version has been submitted to Hockey :rocket:.",
payload: {
"Hockey App Download URL" => lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK]
}
)
I found out how to post hockey download url to slack from this link.
http://rolandleth.com/fastlane-fastfile-3
slack_params = {
message: 'iOS App successfully released to Hockey!',
payload: {
# 'Date' => "#{t.year}-#{t.month}-#{t.day} #{t.hour}:#{t.min} (#{t.zone})",
# Because we increase the version after each build,
# but submit before the increase
'Build' => "#{build_number.to_i - 1}",
'Version' => version_number,
'Type' => type
},
default_payloads: [:git_branch, :git_author, :last_git_commit]
}
if release_lane lane
slack_params[:message] = 'iOS App successfully submitted to the App Store!'
commit_tag_and_update_release_branch
else
slack_params[:payload]['Download Link'] = "#{Actions.lane_context[Actions::SharedValues::HOCKEY_DOWNLOAD_LINK]}"
end
slack slack_params
Related
I created a Slack bot using the "New App". Set it as a bot and am using the "OAuth Tokens for Your Workspace". With the following scopes under "Bot token scopes":
app_mentions:read
chat:write
chat:write.customize
files:read
files:write
groups:write
I added some of these permissions after the initial install (if it matters and you have to refresh something?). The bot is installed to a workspace and I have invited it to a private channel.
Using the example of the Slack API documentation:
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
slack_token = SLACK_TOKEN # xoxb-....
client = WebClient(token=slack_token)
try:
"""
response = client.files_upload(
channels="C040W4L2HA6",
file="test.txt",
title="Test upload"
)
"""
response = client.chat_postMessage(
channel="C040W4L2HA6",
text="Hello from your app! :tada:"
)
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["error"]
For both the file write and message examples I get: "ok":false,"error":"missing_scope","needed":"chat:write:bot","provided":"app_mentions:read" but "needed" changes from "chat:write:bot" to "file:write" if I run that part.
Few issues here. I am using the newest version of the client with Python 3.9 and it asks for a permission that is depricated (write:bot is just write now). In both cases it is as if my only active scope is app_mentions:read, nothing else. When I added the other scopes, I clicked "Request to install" and the person reviewing that accepted.
YAML config:
display_information:
name: BotName
description: Bot desc.
background_color: "#000000"
features:
bot_user:
display_name: botname
always_online: false
oauth_config:
scopes:
user:
- chat:write
bot:
- app_mentions:read
- chat:write
- files:write
- files:read
- groups:write
- chat:write.customize
settings:
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
Any ideas?
Under "Install app" I had to reinstall it to the workspace, it was not done automatically.
I can't find information about acceptable response content or code status from my site to zapier app on test step.
I have my site on Laravel and Zapier app for this site. In my Zapier app I have an action: "Create New Project". I made my "create" according to the example. Everything works except the testing step. I tested with the following zap:
Trello -> "New card created" trigger. Test successful.
My app -> "Create new project". Test fails with We had trouble sending your test through. Could not handle special, non-standard characters. Please contact support.
Strangely, the project was created successfully. Therefore, I think the problem lies in the response from my site to zapier:
// creates/project.js
// My perform function:
perform: (z, bundle) => {
const promise = z.request({
url: `${process.env.BASE_URL}/api/folder`,
method: 'POST',
body: JSON.stringify({
title: bundle.inputData.title,
}),
headers: {
'content-type': 'application/json',
}
});
return promise.then((response) => JSON.parse(response.content));
}
//ZapierController.php
public function addFolder(Request $request)
{
// Made record to DB, and other, after this returned same data which in request
return response()->json(['title' => $request['title']]);
}
Expected result - successful test on "Test this step". Can anyone help me?
David here, from the Zapier Platform team.
I already answered your support ticket, but I figured I'd reply here in case anyone else has the same issue.
The root problem is made clear when you run zapier logs on the cli:
== Log
Unhandled error: CheckError: Invalid API Response:
- Got a non-object result, expected an object from create ("title")
What happened:
Executing creates.сFolder.operation.perform with bundle
Invalid API Response:
- Got a non-object result, expected an object from create ("title")
Your server can reply with any 2xx status code, but the output needs to be valid json. Something like {"title": "my title here"} would certainly work. Users find it more helpful to get info about the project they just created, so the name, id, etc would be even better.
As for why this surfaced as a character encoding issue, I have no clue. We plan on getting to the bottom of it though!
I understand the whole process of dialogflow and I have a working deployed bot with 2 different intents. How do I actually get the response from the bot when a user answers questions? (I set the bot on fulfillment to go to my domain). Using rails 5 app and it's deployed with Heroku.
Thanks!
If you have already set the GOOGLE_APPLICATION_CREDENTIALS path to the jso file, now you can test using a ruby script.
Create a ruby file -> ex: chatbot.rb
Write the code bellow in the file.
project_id = "Your Google Cloud project ID"
session_id = "mysession"
texts = ["hello"]
language_code = "en-US"
require "google/cloud/dialogflow"
session_client = Google::Cloud::Dialogflow::Sessions.new
session = session_client.class.session_path project_id, session_id
puts "Session path: #{session}"
texts.each do |text|
query_input = { text: { text: text, language_code: language_code } }
response = session_client.detect_intent session, query_input
query_result = response.query_result
puts "Query text: #{query_result.query_text}"
puts "Intent detected: #{query_result.intent.display_name}"
puts "Intent confidence: #{query_result.intent_detection_confidence}"
puts "Fulfillment text: #{query_result.fulfillment_text}\n"
end
Insert your project_id. You can find this information on your agent on Dialogflow. Click on the gear on the right side of the Agent's name in the left menu.
Run the ruby file in the terminal or in whatever you using to run ruby files. Then you see the bot replying to the "hello" message you have sent.
Obs: Do not forget to install the google-cloud gem:
Not Entirely familiar with Dilogflow, but if you want to receive a response when an action occurs on another app this usually mean you need to receive web-hooks from them
A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. A web application implementing WebHooks will POST a message to a URL when certain things happen.
I would recommend checking their fulfillment documentation for an example. Hope this helps you out.
I'm setting up payments using the Stripe API to allow a user to log into their Stripe account on an iPad and accept payments from anyone. To do this, I'm using Stripe Connect to log them in and save their account id, then I'm using the STPPaymentCardTextField to obtain credit card details, then using the Stripe iOS SDK I'm submitting a card (with the test card info - 4242...) and getting back a token via createTokenWithCard. This successfully returns a token. At this point I need to submit that token along with the destination account id (provided to the app after the user logged in) and other info (currency, amount, etc) to my own server to submit the payment to Stripe. I have verified that information is being submitted and forwarded onto Stripe, but Stripe is returning an error:
{ type: 'invalid_request_error',
app[web.1]: message: 'No such token: tok_13vxes2eZkKYli2C9bHY1YfX',
app[web.1]: param: 'source',
app[web.1]: statusCode: 400,
app[web.1]: requestId: 'req_7AIT8cEasnzEaq' },
app[web.1]: requestId: 'req_7AIT8cEasnzEaq',
app[web.1]: statusCode: 400 }
If we submit the credit card info directly, avoiding the token altogether, the payment succeeds. Something is wrong with this token, and we are not sure why it is failing. What could be going wrong here?
[[STPAPIClient sharedClient] createTokenWithCard:card completion:^(STPToken *token, NSError *error) {
//submit tokenId and other info to 'charge' endpoint below
}
NodeJS:
app.post('/charge', (req, res, next) => {
stripe.charges.create({
amount: req.body.amount,
currency: req.body.currency,
source: req.body.token,
description: req.body.description,
destination: req.body.destination
}, (err, charge) => {
if (err) return next(err)
res.json(charge)
})
})
Are you sure you're using the same API keys on your server and client?
Your server should be using your (live/test) secret key, and your iOS app should be using your (live/ test) publishable key as mentioned here on Stripe Testing.
I had been facing same issue for my test environment and the mistake i had been doing, i was adding the token received by Stripe like this one source: 'tok_18nnwSJ6tVEvTdcVs3dNIhGs' , but for the test environment we have to use source: 'tok_visa'.
Here is the list of test sources provided by Stripe. https://stripe.com/docs/testing#cards
It created customer for me, let me know if it helped anyone else as well.
The accepted answer does not work for me. I am using correct key for client and server, but still the issue is still there. I am sending source from iOS to the server as well, based on stripe example RocketRides, it is sending source ID of the credit card, which is "card_xxx", and that is not gonna work. You will have to add "customer" attribute for the call on your server side.
For example: (python)
stripe.Charge.create(amount=1000, currency='usd', source="card_xxxxx", **customer**='cus_xxxx', application_fee=600,destination={'account': 'acct_xxxx'})
Neither of the answers here worked for me.
I was trying to use Stripe's PHP library to charge a card that I already had on file like this...
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'gbp',
'card' => 'card_xxx',
'description' => 'Payment for Sam',
]);
And I was receiving the no such token error above.
To get it to work, I also had to provide the customer id like so...
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'gbp',
'customer' => 'cus_xxx',
'card' => 'card_xxx',
'description' => 'Payment for Sam',
]);
First check api keys wheather they are the same at front end and backend.
If you are using testing api keys then you have to pass source: 'tok_visa' instead of your card source token source: 'tok_kb3kb23k2bk32bk3b2'.
I have created a test account with Authorize.net. My development environment is rails 3 and I am trying to implement the Server Integration Method (SIM) by using static IP. But I am getting an error:
"3,1,87,(TESTMODE) Transactions of this market type cannot be processed on this system.,000000,P,0,,,199.00,,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,D3EA25CA1DF97765286A48C6B22287F4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,✓,uSIUUgX0d++dIheYjcHdlztlViD/r4YDUP9rEuEy9U8=,Purchase" when send request to "AuthorizeNet::SIM::Transaction::Gateway::TEST" gateway.
I also found this link: others got similar type error
But not helpful. Any suggestions how to resolve this error? I wrote following codes in the action.
#amount = 10.00
#sim_transaction = AuthorizeNet::SIM::Transaction.new('API Login ID', 'Transaction Key', #amount, :hosted_payment_form => true)
#sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))
Since you are dealing with credit card transactions through web applications, you need to make sure your Sandbox account is of "Card Not Present" type. If you don't remember which type you set it to, it is a good idea to create a new account and make sure to select "Card Not Present" option. Otherwise, you will get this error message.
I hope this helps.