feat: Implement twilio connection
This commit is contained in:
20
packages/backend/src/apps/twilio/auth/verify-credentials.ts
Normal file
20
packages/backend/src/apps/twilio/auth/verify-credentials.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await $.http.get('/2010-04-01/Accounts.json?PageSize=1', {
|
||||
auth: {
|
||||
username: $.auth.data.accountSid as string,
|
||||
password: $.auth.data.authToken as string,
|
||||
},
|
||||
});
|
||||
|
||||
await $.auth.set({
|
||||
screenName: $.auth.data.accountSid,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(JSON.stringify(error.response.data));
|
||||
}
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
Reference in New Issue
Block a user