Popular New Releases in Twilio
easy-sms
2.1.1
sendgrid-nodejs
7.6.2
livehelperchat
3.97v
twilio-video-app-react
v0.6.4
twilio-python
7.8.2
Popular Libraries in Twilio
by overtrue php
2683
:calling: 一款满足你的多种发送需求的短信发送组件
by sendgrid javascript
2589 MIT
The Official Twilio SendGrid Led, Community Driven Node.js API Library
by LiveHelperChat php
1620 Apache-2.0
Live Helper Chat - live support for your website. Featuring web and mobile apps, Voice & Video & ScreenShare. Supports Telegram, Twilio (whatsapp), Facebook messenger including building a bot.
by twilio typescript
1581 Apache-2.0
A collaboration application built with the twilio-video.js SDK and React.js
by twilio python
1569 MIT
A Python module for communicating with the Twilio API and generating TwiML.
by sendgrid php
1340 MIT
The Official Twilio SendGrid Led, Community Driven PHP API Library
by twilio php
1339 MIT
A PHP library for communicating with the Twilio REST API and generating TwiML.
by twilio ruby
1300 MIT
A Ruby gem for communicating with the Twilio API and generating TwiML
by twilio javascript
1151 MIT
Node.js helper library
Trending New libraries in Twilio
by Narasimha1997 go
530 GPL-2.0
A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.
by syncfast go
446 BSD-3-Clause
Clockwise is a meeting cost calculator designed to encourage more efficient meetings.
by johntitus javascript
173 MIT
Get text alerts when products become available on Amazon.
by VaimpierOfficial shell
117
THIS TOOL IS FOR DDOS ATTACK ON PHONE NUMBER YOU CAN USE THIS TOOL ON YOUR KALI LINUX OR TERMUX ALSO IF IS NOT WORK THEN PLEASE CONTACT ME IN "VAIMPIER RITIK" YOUTUBE CHANNEL THANKYOU FOR COMING HERE ......
by miguelgrinberg javascript
101 MIT
A small video conference application using Flask and Twilio Programmable Video
by MrHertal typescript
97 MIT
Twilio Voice React Native module.
by twilio kotlin
90 Apache-2.0
An Android audio management library for real-time communication apps.
by twilio go
86 MIT
A Go package for communicating with the Twilio API.
by 4nat python
67 CC0-1.0
ReborN SMS BOMBER | SpeedX & 4NAT
Top Authors in Twilio
1
121 Libraries
1774
2
64 Libraries
12271
3
23 Libraries
448
4
22 Libraries
938
5
13 Libraries
161
6
13 Libraries
274
7
11 Libraries
142
8
11 Libraries
106
9
9 Libraries
57
10
9 Libraries
115
1
121 Libraries
1774
2
64 Libraries
12271
3
23 Libraries
448
4
22 Libraries
938
5
13 Libraries
161
6
13 Libraries
274
7
11 Libraries
142
8
11 Libraries
106
9
9 Libraries
57
10
9 Libraries
115
Trending Kits in Twilio
No Trending Kits are available at this moment for Twilio
Trending Discussions on Twilio
Is it possible to delete an Asset Version from a Twilio assets service?
Error while trying to integrate Twilio in .NET Core MVC Application
How to read events that come from twilio webhook?
Is there a way to subscribe to a room's `participantConnected` event without becoming a participant?
Curl api parsing
Twilio FlexWebchat 'sendMessage' is triggering the message twice
Google app engine deployment fails- Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
How to hide one div then render the next div in the same page with href?
How to programmatically request media permissions?
Android-Cordova 10.0.1 Task :app:processDebugGoogleServices FAILED
QUESTION
Is it possible to delete an Asset Version from a Twilio assets service?
Asked 2022-Apr-11 at 01:28Twilio Assets, have a sub resource Asset Versions: https://www.twilio.com/docs/runtime/serverless-api/api/asset-version
I see that you can create multiple of these versions over time as you make changes and update your asset.
Example: You upload an MP3 for playback in a <Play>
twiml verb. Overtime you update that content by creating a new version of that asset.
My worry is that overtime those asset versions could build up. I was wondering if there was a way to clean up old un-used asset versions by deleting them. I don't see a method available via the APIs, other than deleting the whole asset all together.
Deleting the entire asset is undesirable because it will have new versions being used in a live build.
My second worry is do asset versions count towards the limitations of assets in a service. https://www.twilio.com/docs/runtime/assets#limitations. Or do only the assets currently deployed in a build count towards this total?
ANSWER
Answered 2022-Apr-11 at 01:28There isn't a way to delete old asset versions, but there is a retention policy that will delete unused asset versions for you.
Function Versions and Asset Versions that are older than 30 days and not part of a build or active deployment will be deleted.
Asset Versions don't count towards the limits of Assets. You can have 1000 public Assets, and those Assets may have more than one Asset Version.
QUESTION
Error while trying to integrate Twilio in .NET Core MVC Application
Asked 2022-Apr-09 at 10:22I'm trying to integrate Twilio with my ASP.NET Core MVC Application but in the controller, I'm getting an error in my return statement.
**Cannot implicitly convert type 'System.Web.Mvc.ContentResult' to 'Microsoft.AspNetCore.Mvc.ContentResult' **
Controller Code
1 using Microsoft.AspNetCore.Mvc;
2using System.Configuration;
3using Twilio;
4using Twilio.AspNet.Mvc;
5using Twilio.Rest.Api.V2010.Account;
6using Twilio.Types;
7using Twilio.TwiML;
8
9namespace TwilioTesting.Controllers
10{
11 public class SMSController : TwilioController
12 {
13 public ContentResult Index()
14 {
15 var accountSid = "AC12345678";
16 var authToken = "12345678";
17
18 TwilioClient.Init(accountSid, authToken);
19
20 var to = new PhoneNumber("+92313887998");
21 var from = new PhoneNumber("+19898980625");
22
23 var message = MessageResource.Create(
24 to: to,
25 from: from,
26 body: "Message from Kamran");
27 return Content(message.Sid);
28 }
29 }
30}
31
ANSWER
Answered 2022-Apr-09 at 10:22You have a using Twilio.AspNet.Mvc;
import which is not for .NET Core & is for ASP.NET MVC. It is unexpectedly importing in System.Web.Mvc.ContentResult
which is conflicting with the import of Microsoft.AspNetCore.Mvc.ContentResult
.
Remove it and replace it with using Twilio;
.
QUESTION
How to read events that come from twilio webhook?
Asked 2022-Apr-09 at 00:57I am creating a Video room on twilio and I created a webhook endpoint to where twilio sends events. One issue is that I don’t know how to read those events since twilio documentation on status callback doesn’t have any examples on how it actually works.
What is the best way to read that data since my endpoint looks something like this
1Public async Task<IActionResult> statuscallbackwebhook(){
2//read data that is recieved from twilio
3}
4
ANSWER
Answered 2022-Apr-09 at 00:57To test this out, I created a console app to create rooms for Twilio Video where you can specify the statusCallback
:
1Public async Task<IActionResult> statuscallbackwebhook(){
2//read data that is recieved from twilio
3}
4using Twilio;
5using Twilio.Rest.Video.V1;
6using HttpMethod = Twilio.Http.HttpMethod;
7
8// make sure to configure your Twilio Account SID and Auth Token as environment variables before running this program
9var accountSid = Environment.GetEnvironmentVariable("TwilioAccountSid");
10var authToken = Environment.GetEnvironmentVariable("TwilioAuthToken");
11
12TwilioClient.Init(accountSid, authToken);
13
14Console.Write("What is the room status callback URL?");
15var roomStatusCallbackUrl = Console.ReadLine();
16Console.WriteLine();
17
18await RoomResource.CreateAsync(
19 statusCallback: new Uri(roomStatusCallbackUrl),
20 statusCallbackMethod: HttpMethod.Post
21);
22
Whatever way you are creating rooms, make sure to configure the statusCallback
to the route that will match your controller-action.
Then in your controller action, you can accept the webhook parameters in two ways: using a strongly-typed object as a parameter, or using simple type parameters like string
, int
, DateTime
, etc.
If you want to bind the webhook request parameters to a strongly-typed object, use the following code:
1Public async Task<IActionResult> statuscallbackwebhook(){
2//read data that is recieved from twilio
3}
4using Twilio;
5using Twilio.Rest.Video.V1;
6using HttpMethod = Twilio.Http.HttpMethod;
7
8// make sure to configure your Twilio Account SID and Auth Token as environment variables before running this program
9var accountSid = Environment.GetEnvironmentVariable("TwilioAccountSid");
10var authToken = Environment.GetEnvironmentVariable("TwilioAuthToken");
11
12TwilioClient.Init(accountSid, authToken);
13
14Console.Write("What is the room status callback URL?");
15var roomStatusCallbackUrl = Console.ReadLine();
16Console.WriteLine();
17
18await RoomResource.CreateAsync(
19 statusCallback: new Uri(roomStatusCallbackUrl),
20 statusCallbackMethod: HttpMethod.Post
21);
22using Microsoft.AspNetCore.Mvc;
23using RoomStatusCallback.Models;
24
25namespace RoomStatusCallback.Controllers;
26
27public class RoomController : Controller
28{
29 private readonly ILogger<RoomController> logger;
30
31 public RoomController(ILogger<RoomController> logger)
32 {
33 this.logger = logger;
34 }
35
36 public ActionResult Status(RoomStatusRequest statusRequest)
37 {
38 logger.LogInformation(@"Room created
39Name: {RoomName}
40Sid: {RoomSid}
41Status: {RoomStatus}
42Type: {RoomType}",
43 statusRequest.RoomName,
44 statusRequest.RoomSid,
45 statusRequest.RoomStatus,
46 statusRequest.RoomType
47 );
48 return Ok();
49 }
50}
51
Then add the class which defines the properties of your strongly-typed object which have to match names with the names of the webhook request parameters. The webhook request parameters for video room status are documented here. Here's the class I created to get data for the room-created
status:
1Public async Task<IActionResult> statuscallbackwebhook(){
2//read data that is recieved from twilio
3}
4using Twilio;
5using Twilio.Rest.Video.V1;
6using HttpMethod = Twilio.Http.HttpMethod;
7
8// make sure to configure your Twilio Account SID and Auth Token as environment variables before running this program
9var accountSid = Environment.GetEnvironmentVariable("TwilioAccountSid");
10var authToken = Environment.GetEnvironmentVariable("TwilioAuthToken");
11
12TwilioClient.Init(accountSid, authToken);
13
14Console.Write("What is the room status callback URL?");
15var roomStatusCallbackUrl = Console.ReadLine();
16Console.WriteLine();
17
18await RoomResource.CreateAsync(
19 statusCallback: new Uri(roomStatusCallbackUrl),
20 statusCallbackMethod: HttpMethod.Post
21);
22using Microsoft.AspNetCore.Mvc;
23using RoomStatusCallback.Models;
24
25namespace RoomStatusCallback.Controllers;
26
27public class RoomController : Controller
28{
29 private readonly ILogger<RoomController> logger;
30
31 public RoomController(ILogger<RoomController> logger)
32 {
33 this.logger = logger;
34 }
35
36 public ActionResult Status(RoomStatusRequest statusRequest)
37 {
38 logger.LogInformation(@"Room created
39Name: {RoomName}
40Sid: {RoomSid}
41Status: {RoomStatus}
42Type: {RoomType}",
43 statusRequest.RoomName,
44 statusRequest.RoomSid,
45 statusRequest.RoomStatus,
46 statusRequest.RoomType
47 );
48 return Ok();
49 }
50}
51namespace RoomStatusCallback.Models;
52
53public class RoomStatusRequest
54{
55 public string AccountSid { get; set; }
56 public string RoomName { get; set; }
57 public string RoomSid { get; set; }
58 public string RoomStatus { get; set; }
59 public string RoomType { get; set; }
60 public string StatusCallbackEvent { get; set; }
61 public DateTime Timestamp { get; set; }
62}
63
Feel free to add/remove properties as needed by your application. ASP.NET Core MVC's model binding will bind the webhook request parameters to the properties of your strongly-typed object.
The second way is to use simple type parameters like this:
1Public async Task<IActionResult> statuscallbackwebhook(){
2//read data that is recieved from twilio
3}
4using Twilio;
5using Twilio.Rest.Video.V1;
6using HttpMethod = Twilio.Http.HttpMethod;
7
8// make sure to configure your Twilio Account SID and Auth Token as environment variables before running this program
9var accountSid = Environment.GetEnvironmentVariable("TwilioAccountSid");
10var authToken = Environment.GetEnvironmentVariable("TwilioAuthToken");
11
12TwilioClient.Init(accountSid, authToken);
13
14Console.Write("What is the room status callback URL?");
15var roomStatusCallbackUrl = Console.ReadLine();
16Console.WriteLine();
17
18await RoomResource.CreateAsync(
19 statusCallback: new Uri(roomStatusCallbackUrl),
20 statusCallbackMethod: HttpMethod.Post
21);
22using Microsoft.AspNetCore.Mvc;
23using RoomStatusCallback.Models;
24
25namespace RoomStatusCallback.Controllers;
26
27public class RoomController : Controller
28{
29 private readonly ILogger<RoomController> logger;
30
31 public RoomController(ILogger<RoomController> logger)
32 {
33 this.logger = logger;
34 }
35
36 public ActionResult Status(RoomStatusRequest statusRequest)
37 {
38 logger.LogInformation(@"Room created
39Name: {RoomName}
40Sid: {RoomSid}
41Status: {RoomStatus}
42Type: {RoomType}",
43 statusRequest.RoomName,
44 statusRequest.RoomSid,
45 statusRequest.RoomStatus,
46 statusRequest.RoomType
47 );
48 return Ok();
49 }
50}
51namespace RoomStatusCallback.Models;
52
53public class RoomStatusRequest
54{
55 public string AccountSid { get; set; }
56 public string RoomName { get; set; }
57 public string RoomSid { get; set; }
58 public string RoomStatus { get; set; }
59 public string RoomType { get; set; }
60 public string StatusCallbackEvent { get; set; }
61 public DateTime Timestamp { get; set; }
62}
63using Microsoft.AspNetCore.Mvc;
64using RoomStatusCallback.Models;
65
66namespace RoomStatusCallback.Controllers;
67
68public class RoomController : Controller
69{
70 private readonly ILogger<RoomController> logger;
71
72 public RoomController(ILogger<RoomController> logger)
73 {
74 this.logger = logger;
75 }
76
77 public ActionResult Status(
78 string roomName,
79 string roomSid,
80 string roomStatus,
81 string roomType
82 )
83 {
84 logger.LogInformation(@"Room created
85Name: {RoomName}
86Sid: {RoomSid}
87Status: {RoomStatus}
88Type: {RoomType}",
89 roomName,
90 roomSid,
91 roomStatus,
92 roomType
93 );
94 return Ok();
95 }
96}
97
The result is exactly the same, but by adding parameters to the action, ASP.NET Core's binding features will bind the webhook request parameters to the parameters of the action, as long as they match names.
To test this out using the sample:
- Start the ASP.NET Core project containing your webhook
- Start the ngrok tunnel service
- Run the console app and pass in the public ngrok forwarding URL + the route to your controller-action.
There are even more ways to do this, but for MVC controller-actions, these two options would be the recommended way.
QUESTION
Is there a way to subscribe to a room's `participantConnected` event without becoming a participant?
Asked 2022-Mar-30 at 23:30One can use the room
returned from calling Video.connect
to subscribe to a room's participantConnected
event, so that all kinds of different logic can be executed when a new participant joins a room. I can also query rooms remotely without Video.connect
to see how many participants are currently connected. However, I would like be able to use the participantConnected
event to display in real time if someone is in a room, without actually joining the room.
Is this possible and how would I do that without becoming a participant via Video.connect
and without polling twilio's api?
Preferably, I'd like to do this on the javascript side, but I could use twilio's api wrapper library on the server-side if I had to. I just want the client to get notified somehow when someone enters or leaves a room so I can display whether the room is empty in real time.
ANSWER
Answered 2022-Mar-30 at 23:30In order to receive those events with the client SDK, you would need to join the room as you would need a connection to it in order to receive events from it.
You can, however, subscribe to status callback webhooks for rooms. There are lots of events that a room emits that can be received as webhooks, such as room-created
, room-ended
, and, as you've asked for, participant-connected
.
You can set the statusCallback
when you create a room with the REST API and you can see all the parameters that are sent as part of the webhook request here.
QUESTION
Curl api parsing
Asked 2022-Mar-22 at 16:57Am trying to parse curl api
but am getting this error 401 Unauthorized
i don't know where is the problem comes from.
because the authentication details are ok
this is the curl
1curl 'https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json' \
2 -X POST \
3 --data-urlencode 'To=whatsapp:+123456789' \
4 --data-urlencode 'From=whatsapp:+1234567890' \
5 --data-urlencode 'Body=Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/' \
6 -u SID:[AuthToken]
7
1curl 'https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json' \
2 -X POST \
3 --data-urlencode 'To=whatsapp:+123456789' \
4 --data-urlencode 'From=whatsapp:+1234567890' \
5 --data-urlencode 'Body=Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/' \
6 -u SID:[AuthToken]
7#!/usr/bin/perl
8
9use strict;
10use warnings;
11use HTTP::Tiny;
12use JSON;
13use Data::Dumper;
14
15my $url = "https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json";
16my $json = encode_json {
17To => 'whatsapp:+256775562361',
18From => 'whatsapp:+14155238886',
19Body => 'new test msg',
20};
21
22my $http = HTTP::Tiny->new(
23default_headers => {
24Authorization => 'SID:TOKEN',
25}
26);
27
28my $response = $http->post( $url => {
29content => $json,
30headers => { 'Content-Type' => 'application/json' },
31});
32
33if ( $response->{'is_success'} ) {
34print Dumper( decode_json $response->{'content'} );
35} else {
36print "$response->{'status'} $response->{'reason'}\n";
37}
38
ANSWER
Answered 2022-Mar-22 at 16:57The format of the "Authorization" header isn't <user>:<pass>
-- it's <auth-scheme> <authorization-parameters>
. curl
is doing this for you, but for this it's basically:
1curl 'https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json' \
2 -X POST \
3 --data-urlencode 'To=whatsapp:+123456789' \
4 --data-urlencode 'From=whatsapp:+1234567890' \
5 --data-urlencode 'Body=Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/' \
6 -u SID:[AuthToken]
7#!/usr/bin/perl
8
9use strict;
10use warnings;
11use HTTP::Tiny;
12use JSON;
13use Data::Dumper;
14
15my $url = "https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json";
16my $json = encode_json {
17To => 'whatsapp:+256775562361',
18From => 'whatsapp:+14155238886',
19Body => 'new test msg',
20};
21
22my $http = HTTP::Tiny->new(
23default_headers => {
24Authorization => 'SID:TOKEN',
25}
26);
27
28my $response = $http->post( $url => {
29content => $json,
30headers => { 'Content-Type' => 'application/json' },
31});
32
33if ( $response->{'is_success'} ) {
34print Dumper( decode_json $response->{'content'} );
35} else {
36print "$response->{'status'} $response->{'reason'}\n";
37}
38Authorization: Basic <mime-encoded "<user>:<pass>">
39
I use the URI module for this:
1curl 'https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json' \
2 -X POST \
3 --data-urlencode 'To=whatsapp:+123456789' \
4 --data-urlencode 'From=whatsapp:+1234567890' \
5 --data-urlencode 'Body=Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/' \
6 -u SID:[AuthToken]
7#!/usr/bin/perl
8
9use strict;
10use warnings;
11use HTTP::Tiny;
12use JSON;
13use Data::Dumper;
14
15my $url = "https://api.twilio.com/2010-04-01/Accounts/SID/Messages.json";
16my $json = encode_json {
17To => 'whatsapp:+256775562361',
18From => 'whatsapp:+14155238886',
19Body => 'new test msg',
20};
21
22my $http = HTTP::Tiny->new(
23default_headers => {
24Authorization => 'SID:TOKEN',
25}
26);
27
28my $response = $http->post( $url => {
29content => $json,
30headers => { 'Content-Type' => 'application/json' },
31});
32
33if ( $response->{'is_success'} ) {
34print Dumper( decode_json $response->{'content'} );
35} else {
36print "$response->{'status'} $response->{'reason'}\n";
37}
38Authorization: Basic <mime-encoded "<user>:<pass>">
39my $uri = URI->new("https://api.twilio.com/...");
40$uri->userinfo("$sid:$auth");
41
42$http->post( $uri => ... );
43
QUESTION
Twilio FlexWebchat 'sendMessage' is triggering the message twice
Asked 2022-Jan-19 at 12:52I am using Twilio Flex WebChat to send and receive messages. I have a requirement to modify a message before sending it. Hence I added a listener beforeSendMessage
in componentDidMount()
where I am collecting the body of the message, transforming it, and sending the message. Here the issue is that it's sending both the original message and transformed message. My target is to send the transformed message alone. Can you possibly help me. Thank you.
1 componentDidMount() {
2 FlexWebChat.Actions.addListener(
3 'beforeSendMessage',
4 async (payload) => {
5 const { body, channelSid } = payload;
6 const modifiedBody = transform(body) //Transforming the message here
7 await FlexWebChat.Actions.invokeAction('SendMessage', {
8 body: modifiedBody, // Sending the transformed message
9 channelSid,
10 })
11 }
12 )
13 }
14
ANSWER
Answered 2022-Jan-19 at 12:52The reason this is happening is because you are doing a SendMessage Twice.
What you can do with the Listener is modify the payload and let the execution continue and it will continue to execute. If you want to block the message sending you can call abortFunction()
1 componentDidMount() {
2 FlexWebChat.Actions.addListener(
3 'beforeSendMessage',
4 async (payload) => {
5 const { body, channelSid } = payload;
6 const modifiedBody = transform(body) //Transforming the message here
7 await FlexWebChat.Actions.invokeAction('SendMessage', {
8 body: modifiedBody, // Sending the transformed message
9 channelSid,
10 })
11 }
12 )
13 }
14 componentDidMount() {
15 FlexWebChat.Actions.addListener(
16 'beforeSendMessage',
17 async (payload, abortFunction) => {
18 const { body, channelSid } = payload;
19 payload.body = transform(body); //Transforming the message here
20 }
21 )
22 }
23
QUESTION
Google app engine deployment fails- Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Asked 2022-Jan-08 at 22:02We are using command prompt c:\gcloud app deploy app.yaml
, but get the following error:
1Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
2Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
3Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
4Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
5Step #2 - "build": --------------------------------------------------------------------------------
6Step #2 - "build": Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
7Step #2 - "build": Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (12.758866ms)
8Step #2 - "build": ERROR: failed to build: exit status 1
9Finished Step #2 - "build"
10ERROR
11ERROR: build step 2 "us.gcr.io/gae-runtimes/buildpacks/python37/builder:python37_20211201_3_7_12_RC00" failed: step exited with non-zero status: 145
12
Our Requirements.txt is as below. We are currently on Python 3.7 standard app engine
1Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
2Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
3Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
4Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
5Step #2 - "build": --------------------------------------------------------------------------------
6Step #2 - "build": Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
7Step #2 - "build": Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (12.758866ms)
8Step #2 - "build": ERROR: failed to build: exit status 1
9Finished Step #2 - "build"
10ERROR
11ERROR: build step 2 "us.gcr.io/gae-runtimes/buildpacks/python37/builder:python37_20211201_3_7_12_RC00" failed: step exited with non-zero status: 145
12firebase_admin==3.0.0
13sendgrid==6.9.3
14google-auth==1.35.0
15google-auth-httplib2==0.1.0
16jinja2==3.0.3
17MarkupSafe==2.0.1
18pytz==2021.3
19Flask==2.0.2
20twilio==6.46.0
21httplib2==0.20.2
22requests==2.24.0
23requests_toolbelt==0.9.1
24google-cloud-tasks==2.7.1
25google-cloud-logging==1.15.1
26googleapis-common-protos==1.54.0
27
Please help.The above code was working well before updating the requirements.txt file. We tried to remove gunicorn to allow the system pickup the latest according to documentation here.
We have a subdirectory structure that stores all the .py files in controllers and db definitions in models. Our main.py has the following -
1Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
2Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
3Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
4Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
5Step #2 - "build": --------------------------------------------------------------------------------
6Step #2 - "build": Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
7Step #2 - "build": Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (12.758866ms)
8Step #2 - "build": ERROR: failed to build: exit status 1
9Finished Step #2 - "build"
10ERROR
11ERROR: build step 2 "us.gcr.io/gae-runtimes/buildpacks/python37/builder:python37_20211201_3_7_12_RC00" failed: step exited with non-zero status: 145
12firebase_admin==3.0.0
13sendgrid==6.9.3
14google-auth==1.35.0
15google-auth-httplib2==0.1.0
16jinja2==3.0.3
17MarkupSafe==2.0.1
18pytz==2021.3
19Flask==2.0.2
20twilio==6.46.0
21httplib2==0.20.2
22requests==2.24.0
23requests_toolbelt==0.9.1
24google-cloud-tasks==2.7.1
25google-cloud-logging==1.15.1
26googleapis-common-protos==1.54.0
27sys.path.append(os.path.join(os.path.dirname(__file__), '../controllers'))
28sys.path.append(os.path.join(os.path.dirname(__file__), '../models'))
29
Does anyone know how to debug this error - Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
. What does this mean?
ANSWER
Answered 2022-Jan-06 at 09:24Your setuptools version is likely to be yanked:
https://pypi.org/project/setuptools/60.3.0/
Not sure how to fix that without a working pip though.
QUESTION
How to hide one div then render the next div in the same page with href?
Asked 2021-Dec-23 at 20:58I want to simulate whats on this page where a user can click an a
tag and move from one div with text to another.
I saw some things with hiding/showing a particular div but this particular page seems to use a href link to #next
1<div class="demo__instructions" data-step="1">
2....
3 <a href="#next" role="step" data-next="">Customize the phone menu</a>
4</div>
5
How does one simulate this?
ANSWER
Answered 2021-Dec-23 at 20:58The next step is triggered on all links which has href
value as #next
.
So each time a link with href="#next"
is clicked a function will execute which will take to the next step, same as simple hiding and showing.
1<div class="demo__instructions" data-step="1">
2....
3 <a href="#next" role="step" data-next="">Customize the phone menu</a>
4</div>
5let nextBtn = document.querySelectorAll("a[href='#next']")
6let stepRunning = 1;
7
8for (let i = 0; i < nextBtn.length; i++) {
9 nextBtn[i].addEventListener('click', nextBtnFunc)
10}
11
12function nextBtnFunc() {
13 stepRunning++;
14 document.querySelector("[data-step='" + stepRunning + "']").style.display = "block";
15 document.querySelector("[data-step='" + (stepRunning - 1) + "']").style.display = "none";
16}
1<div class="demo__instructions" data-step="1">
2....
3 <a href="#next" role="step" data-next="">Customize the phone menu</a>
4</div>
5let nextBtn = document.querySelectorAll("a[href='#next']")
6let stepRunning = 1;
7
8for (let i = 0; i < nextBtn.length; i++) {
9 nextBtn[i].addEventListener('click', nextBtnFunc)
10}
11
12function nextBtnFunc() {
13 stepRunning++;
14 document.querySelector("[data-step='" + stepRunning + "']").style.display = "block";
15 document.querySelector("[data-step='" + (stepRunning - 1) + "']").style.display = "none";
16}.demo__instructions:not([data-step="1"]) {
17 display: none;
18}
1<div class="demo__instructions" data-step="1">
2....
3 <a href="#next" role="step" data-next="">Customize the phone menu</a>
4</div>
5let nextBtn = document.querySelectorAll("a[href='#next']")
6let stepRunning = 1;
7
8for (let i = 0; i < nextBtn.length; i++) {
9 nextBtn[i].addEventListener('click', nextBtnFunc)
10}
11
12function nextBtnFunc() {
13 stepRunning++;
14 document.querySelector("[data-step='" + stepRunning + "']").style.display = "block";
15 document.querySelector("[data-step='" + (stepRunning - 1) + "']").style.display = "none";
16}.demo__instructions:not([data-step="1"]) {
17 display: none;
18}<a href="#next" role="step" data-next="">Next</a>
19
20<div>
21 <div class="demo__instructions" data-step="1">
22 <p>Step 1</p>
23 <a href="#next" role="step" data-next="">Customize the phone menu</a>
24 </div>
25 <div class="demo__instructions" data-step="2">
26 <p>Step 2</p>
27 <a href="#next" role="step" data-next="">phone menu</a>
28 </div>
29 <div class="demo__instructions" data-step="3">
30 <p>Step 3</p>
31 <a href="#next" role="step" data-next="">menu</a>
32 </div>
33 <div class="demo__instructions" data-step="4">
34 <p>Step 4</p>
35 </div>
36</div>
QUESTION
How to programmatically request media permissions?
Asked 2021-Dec-23 at 20:02Camera and microphone are manually blocked in Chrome (as shown in a picture below):
Local media tracks are created using twilio-video library methods createLocalAudioTrack and createLocalVideoTrack which throws the next exception:
1DOMException: Permission denied
2code: 0
3message: "Permission denied"
4name: "NotAllowedError"
5
When trying to use browser native getUserMedia as follows:
1DOMException: Permission denied
2code: 0
3message: "Permission denied"
4name: "NotAllowedError"
5navigator.mediaDevices.getUserMedia({ audio: true, video: true })
6 .catch(error => {
7 console.log(error)
8 })
9
it console logs the same exception in the catch block:
1DOMException: Permission denied
2code: 0
3message: "Permission denied"
4name: "NotAllowedError"
5navigator.mediaDevices.getUserMedia({ audio: true, video: true })
6 .catch(error => {
7 console.log(error)
8 })
9DOMException: Permission denied
10
The question: is it possible to know in advance, before creating local media tracks, that there are no permissions to do it (camera and microphone are manually blocked in a browser) and programmatically request such permissions (show popup requesting the permissions) to create the tracks?
ANSWER
Answered 2021-Dec-23 at 20:02Note that, at the time I'm writing, this is still experimental territory
You can query permissions using Permissions.query()
:
1DOMException: Permission denied
2code: 0
3message: "Permission denied"
4name: "NotAllowedError"
5navigator.mediaDevices.getUserMedia({ audio: true, video: true })
6 .catch(error => {
7 console.log(error)
8 })
9DOMException: Permission denied
10const permissionDescriptors = [
11 {name: 'camera'},
12 {name: 'microphone'},
13];
14
15const permissions = await Promise.all(permissionDescriptors.map(async descriptor => ({
16 descriptor,
17 status: await navigator.permissions.query(descriptor),
18})));
19
20for (const {descriptor, status} of permissions) {
21 console.log(
22 descriptor.name, // 'camera' | 'microphone'
23 status.state, // 'granted' | 'denied' | 'prompt'
24 );
25}
26
You will be able to request permissions using Permissions.request()
. However, this is not currently supported in any browser.
Today, it's better to just try to access the MediaStream
, and catch and handle a potential exception:
1DOMException: Permission denied
2code: 0
3message: "Permission denied"
4name: "NotAllowedError"
5navigator.mediaDevices.getUserMedia({ audio: true, video: true })
6 .catch(error => {
7 console.log(error)
8 })
9DOMException: Permission denied
10const permissionDescriptors = [
11 {name: 'camera'},
12 {name: 'microphone'},
13];
14
15const permissions = await Promise.all(permissionDescriptors.map(async descriptor => ({
16 descriptor,
17 status: await navigator.permissions.query(descriptor),
18})));
19
20for (const {descriptor, status} of permissions) {
21 console.log(
22 descriptor.name, // 'camera' | 'microphone'
23 status.state, // 'granted' | 'denied' | 'prompt'
24 );
25}
26let mediaStream;
27try {
28 const constraints = { audio: true, video: true };
29 mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
30}
31catch (ex) {
32 if (ex instanceof DOMException) {
33 if (ex.name === 'NotAllowedError') {
34 // handle permission denied
35 }
36 else if (ex.name === 'NotFoundError') {
37 // handle media not found
38 }
39 else {
40 // handle unexpected DOMException
41 }
42 }
43 else {
44 // handle unexpected error
45 }
46}
47
48if (!mediaStream) {
49 // handle no stream
50}
51else {
52 // do something with stream
53}
54
QUESTION
Android-Cordova 10.0.1 Task :app:processDebugGoogleServices FAILED
Asked 2021-Nov-25 at 13:33I have upgraded the cordova-android version from 9.0 to 10.0.1 and facing the below issues while building the Cordova app using - ionic cordova build android
Errors:
1Task :app:processDebugGoogleServices FAILED
2Some problems were found with the configuration of task ':app:processDebugGoogleServices' (type 'GoogleServicesTask').
3 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'intermediateDir' without corresponding getter has been annotated with @OutputDirectory.
4
5 Reason: Annotations on fields are only used if there's a corresponding getter for the field.
6
7 Possible solutions:
8 1. Add a getter for field 'intermediateDir'.
9 2. Remove the annotations on 'intermediateDir'.
10
11 Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
12 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.
13
Info:
Cordova CLI - 10.0.0
Cordova android: 10.0.1
Node: v12.18.2
npm: 6.14.13
Project Installed Plugins:
1Task :app:processDebugGoogleServices FAILED
2Some problems were found with the configuration of task ':app:processDebugGoogleServices' (type 'GoogleServicesTask').
3 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'intermediateDir' without corresponding getter has been annotated with @OutputDirectory.
4
5 Reason: Annotations on fields are only used if there's a corresponding getter for the field.
6
7 Possible solutions:
8 1. Add a getter for field 'intermediateDir'.
9 2. Remove the annotations on 'intermediateDir'.
10
11 Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
12 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.
13@havesource/cordova-plugin-push: 2.0.0
14 cordova-android-play-services-gradle-release: 4.0.0
15 cordova-background-geolocation-lt: 4.0.1
16 cordova-plugin-advanced-http: 3.1.0
17 cordova-plugin-android-permissions: 1.1.2
18 cordova-plugin-androidx-adapter: 1.1.3
19 cordova-plugin-androidx: 3.0.0
20 cordova-plugin-app-launcher: 0.4.0
21 cordova-plugin-app-version: 0.1.12
22 cordova-plugin-appminimize: 1.0.1
23 cordova-plugin-background-fetch: 7.0.1
24 cordova-plugin-badge: 0.8.8
25 cordova-plugin-camera: 5.0.2
26 cordova-plugin-device: 2.0.3
27 cordova-plugin-file-opener2: 3.0.5
28 cordova-plugin-file: 6.0.2
29 cordova-plugin-filepath: 1.6.0
30 cordova-plugin-googlemaps: 2.7.1
31 cordova-plugin-inappbrowser: 5.0.0
32 cordova-plugin-ionic-keyboard: 2.2.0
33 cordova-plugin-ionic-webview: 4.2.1
34 cordova-plugin-local-notification: 0.9.0-beta.2
35 cordova-plugin-market: 1.2.0
36 cordova-plugin-ms-azure-mobile-apps: 2.0.2
37 cordova-plugin-network-information: 2.0.2
38 cordova-plugin-sim: 1.3.3
39 cordova-plugin-sms-retriever-manager: 1.0.2
40 cordova-plugin-splashscreen: 6.0.0
41 cordova-plugin-statusbar: 2.4.3
42 cordova-plugin-twilio-chat: 3.3.0
43 cordova-plugin-whitelist: 1.3.4
44 cordova-sqlite-storage: 6.0.0
45 phonegap-plugin-barcodescanner: 8.1.0
46 phonegap-plugin-multidex: 1.0.0
47
Can anyone have an idea how to resolve this issue?
ANSWER
Answered 2021-Aug-15 at 14:36It finally worked for me. I changed the gradle version used to 6.7.1 and reinstall some outdated cordova plugins.
plugins used:
1Task :app:processDebugGoogleServices FAILED
2Some problems were found with the configuration of task ':app:processDebugGoogleServices' (type 'GoogleServicesTask').
3 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'intermediateDir' without corresponding getter has been annotated with @OutputDirectory.
4
5 Reason: Annotations on fields are only used if there's a corresponding getter for the field.
6
7 Possible solutions:
8 1. Add a getter for field 'intermediateDir'.
9 2. Remove the annotations on 'intermediateDir'.
10
11 Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
12 - In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.
13@havesource/cordova-plugin-push: 2.0.0
14 cordova-android-play-services-gradle-release: 4.0.0
15 cordova-background-geolocation-lt: 4.0.1
16 cordova-plugin-advanced-http: 3.1.0
17 cordova-plugin-android-permissions: 1.1.2
18 cordova-plugin-androidx-adapter: 1.1.3
19 cordova-plugin-androidx: 3.0.0
20 cordova-plugin-app-launcher: 0.4.0
21 cordova-plugin-app-version: 0.1.12
22 cordova-plugin-appminimize: 1.0.1
23 cordova-plugin-background-fetch: 7.0.1
24 cordova-plugin-badge: 0.8.8
25 cordova-plugin-camera: 5.0.2
26 cordova-plugin-device: 2.0.3
27 cordova-plugin-file-opener2: 3.0.5
28 cordova-plugin-file: 6.0.2
29 cordova-plugin-filepath: 1.6.0
30 cordova-plugin-googlemaps: 2.7.1
31 cordova-plugin-inappbrowser: 5.0.0
32 cordova-plugin-ionic-keyboard: 2.2.0
33 cordova-plugin-ionic-webview: 4.2.1
34 cordova-plugin-local-notification: 0.9.0-beta.2
35 cordova-plugin-market: 1.2.0
36 cordova-plugin-ms-azure-mobile-apps: 2.0.2
37 cordova-plugin-network-information: 2.0.2
38 cordova-plugin-sim: 1.3.3
39 cordova-plugin-sms-retriever-manager: 1.0.2
40 cordova-plugin-splashscreen: 6.0.0
41 cordova-plugin-statusbar: 2.4.3
42 cordova-plugin-twilio-chat: 3.3.0
43 cordova-plugin-whitelist: 1.3.4
44 cordova-sqlite-storage: 6.0.0
45 phonegap-plugin-barcodescanner: 8.1.0
46 phonegap-plugin-multidex: 1.0.0
47@havesource/cordova-plugin-push 2.0.0 "Cordova Push Plugin"
48cordova-plugin-advanced-http 2.5.1 "Advanced HTTP plugin"
49cordova-plugin-camera 5.0.0 "Camera"
50cordova-plugin-device 2.0.3 "Device"
51cordova-plugin-facebook4 6.4.0 "Facebook Connect"
52cordova-plugin-file 6.0.2 "File"
53cordova-plugin-googleplus 8.5.0 "Google SignIn"
54cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
55cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
56cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
57cordova-plugin-network-information 2.0.1 "Network Information"
58cordova-plugin-splashscreen 5.0.3 "Splashscreen"
59cordova-plugin-statusbar 2.4.3 "StatusBar"
60cordova-plugin-whitelist 1.3.4 "Whitelist"
61cordova-plugin-wkwebview-inject-cookie 1.0.2 "WKWebViewInjectCookie"
62cordova-support-google-services 1.1.0 "cordova-support-google-services"
63
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Twilio
Tutorials and Learning Resources are not available at this moment for Twilio