# penaplast3104-sms-bomber for nodejs

A simple SMS bomber package for automated testing of SMS service by bombarding with messages. Initially, the configuration has sites for Russian phone numbers. You can change this in the configuration. **Use responsibly and only for legitimate purposes, with consent.**

## How to install
```bash
yarn add penaplast3104-sms-bomber
```

## How to use

### javascript
```javascript
const { startBombing } = require('penaplast3104-sms-bomber');

startBombing({ 
    phoneNumber: '99999999999',
    times: 1,
    options?: [...flags],
    sites?: [...sites],
    onBobmingStart?: ({ phoneNumber, times}) => void,
    onBobmingFinish?: ({ phoneNumber, times}) => void,
});
```

You can add an array of your sites to the sites using the example from the configuration item.

### bash
```bash
node start.js <phoneNumber> <times> <...--flags>
```

Replace <phoneNumber> with the target phone number and <times> with the number of attempts.


## Flags

```javascript
--debug // includes logs and launch a "headful" version of Chrome
--without-default-sites // do not use sites installed in the package. ONLY FOR use as an NPM package. For command line edit config in ./constants/sites.js
```

## Configuration

You can configure additional sites by editing the ./constants/sites.js file.

### example:
```typescript
const object = {
    url: string, // site url, It is advisable to search for unpopular sites, without robot detectors
    options?: {
        withoutFirstNumber?: boolean, // for inputs where the region code is initially set
    },
    queue: Array<{
        selector: string, // html element selector
        action: 'click/type', // page action
        isNumber?: boolean, // if this parameter is true, the input is entered target phone nubmer, type action
        value?: string, // value for nonIsNumber inputs, type action
        delay?: number, // delay before action
        isOptional?: boolean, // for optional steps, if the selector is not found, the step will be skipped without error
    }>
}
```
