Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

34
LINES

< > BotCompany Repo | #1028638 // Twilio Web Bot [wraps Twilio library because it conflicts with Google lib]

JavaX source code (desktop) [tags: butter use-pretranspiled] - run with: x30.jar - homepage

Download Jar. Uses 10012K of libraries. Click here for Pure Java version (2578L/17K).

1  
!7
2  
3  
lib 1400402 // twilio
4  
5  
import com.twilio.Twilio;
6  
import com.twilio.rest.api.v2010.account.Message;
7  
import com.twilio.type.PhoneNumber;
8  
import com.twilio.security.RequestValidator;
9  
10  
p {
11  
  registerMainClassAs twilioHolder();
12  
}
13  
14  
sbool inited;
15  
16  
sbool twilioInited() { ret inited; }
17  
18  
svoid twilioInit(S accountSID, S authToken) {
19  
  Twilio.init(accountSID, authToken);
20  
  inited = true;
21  
}
22  
23  
static Message twilioSend(S from, S to, S text) {
24  
  ret Message
25  
    .creator(new PhoneNumber(to), // to
26  
      new PhoneNumber(from), // from
27  
      text)
28  
    .create();
29  
}
30  
31  
sbool twilioValidateRequest(S authToken, S url, SS params, S twilioSig) {
32  
  RequestValidator validator = new(authToken);
33  
  ret validator.validate(url, params, twilioSig);
34  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028638
Snippet name: Twilio Web Bot [wraps Twilio library because it conflicts with Google lib]
Eternal ID of this version: #1028638/11
Text MD5: bd4af28dafca0971166a802122b46588
Transpilation MD5: 12e7f7d4f065ef2222e4bd9574e683fa
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-30 16:20:04
Source code size: 763 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 164 / 847
Version history: 10 change(s)
Referenced in: [show references]