|
34105
|
1284
|
43
|
2026-05-13T10:54:17.481442+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669657481_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"bounds":{"left":0.3723404,"top":0.15881884,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.38464096,"top":0.15881884,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.39361703,"top":0.15722266,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.40093085,"top":0.15722266,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.40957448,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.41821808,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.42918882,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.43783244,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.44647607,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.4574468,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.46841756,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.4950133,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.50598407,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.7084442,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"bounds":{"left":0.67785907,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.69015956,"top":0.123703115,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"bounds":{"left":0.6994681,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"bounds":{"left":0.7117686,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.7237367,"top":0.12210695,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.73105055,"top":0.12210695,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5235887219890144577
|
2218635325254022725
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
34103
|
NULL
|
NULL
|
NULL
|
|
34106
|
1283
|
49
|
2026-05-13T10:54:23.186662+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669663186_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
4/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"4/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-803956194695264929
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
4/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34107
|
1284
|
44
|
2026-05-13T10:54:28.737920+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669668737_m2.jpg...
|
PhpStorm
|
faVsco.js – TextRelayService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Mail;
use Carbon\Carbon;
use Jiminny\Component\Queue\Constants;
use Jiminny\Jobs\Mailbox\EmailTextRelay;
use Jiminny\Models\TextRelay;
use Google\Service\Gmail as GoogleGmail;
class TextRelayService
{
public function __construct()
{
$credentials = storage_path('text-relay.json');
abort_unless(file_exists($credentials), 422);
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);
}
/**
* Fetch the latest messages since the last sync.
*/
public function sync(): array
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$messageHistory = $this->getHistory($service);
$messageIds = [];
foreach ($messageHistory as $histories) {
$messages = $histories->messagesAdded;
foreach ($messages as $message) {
$messageId = $message->message->id;
$relayedText = TextRelay::where('email_provider_id', $messageId)->first();
if ($relayedText === null) {
$relayedText = TextRelay::create([
'email_provider' => TextRelay::PROVIDER_GSUITE,
'email_provider_id' => $messageId,
'status' => TextRelay::STATUS_PROCESSING,
]);
}
$job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);
dispatch($job);
$messageIds[] = $messageId;
}
}
return $messageIds;
}
public function getHistory(GoogleGmail $service): array
{
$pageToken = null;
$topic = config('jiminny.google_text_relay_topic');
$messages = [];
$historyId = \Cache::get($topic);
// If we have no history stored, WatchMailboxEvents must not have run yet :/
if ($historyId == false) {
$historyId = $this->refreshHistoryPoint($topic);
}
$params = [
'historyTypes' => 'messageAdded',
'startHistoryId' => $historyId,
];
do {
try {
if ($pageToken) {
$params['pageToken'] = $pageToken;
}
$historyResponse = $service->users_history->listUsersHistory(
config('jiminny.google_text_user'),
$params
);
$this->setHistoryPoint($topic, $historyResponse->historyId);
if ($historyResponse->getHistory()) {
$messages = array_merge($messages, $historyResponse->getHistory());
$pageToken = $historyResponse->getNextPageToken();
}
} catch (\Exception $e) {
\Sentry::captureException($e);
}
} while ($pageToken);
return $messages;
}
protected function setHistoryPoint(string $topic, int $historyPoint): Carbon
{
$expiresAt = now()->addDay();
\Cache::put($topic, $historyPoint, $expiresAt);
return $expiresAt;
}
public function getService(string $mailbox): GoogleGmail
{
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(GoogleGmail::GMAIL_MODIFY);
$client->setAccessType('offline');
$client->setSubject($mailbox);
return new GoogleGmail($client);
}
public function refreshHistoryPoint(string $topic): int
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$watchRequest = new GoogleGmail\WatchRequest();
$watchRequest->setLabelIds(['INBOX']);
$watchRequest->setLabelFilterAction('include');
$watchRequest->setTopicName($topic);
$watchResponse = $service->users->watch($mailbox, $watchRequest);
//$expiryTimestamp = $watchResponse->expiration / 1000;
$historyPoint = $watchResponse->historyId;
$this->setHistoryPoint($topic, $historyPoint);
return $historyPoint;
}
}
Execute
Explain Plan
Browse Query History
View Parameters...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"bounds":{"left":0.3849734,"top":0.12529927,"width":0.019946808,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Services\\Mail;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Jobs\\Mailbox\\EmailTextRelay;\nuse Jiminny\\Models\\TextRelay;\nuse Google\\Service\\Gmail as GoogleGmail;\n\nclass TextRelayService\n{\n public function __construct()\n {\n $credentials = storage_path('text-relay.json');\n\n abort_unless(file_exists($credentials), 422);\n\n putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);\n }\n\n /**\n * Fetch the latest messages since the last sync.\n */\n public function sync(): array\n {\n $mailbox = config('jiminny.google_text_user');\n\n $service = $this->getService($mailbox);\n\n $messageHistory = $this->getHistory($service);\n $messageIds = [];\n\n foreach ($messageHistory as $histories) {\n $messages = $histories->messagesAdded;\n\n foreach ($messages as $message) {\n $messageId = $message->message->id;\n $relayedText = TextRelay::where('email_provider_id', $messageId)->first();\n\n if ($relayedText === null) {\n $relayedText = TextRelay::create([\n 'email_provider' => TextRelay::PROVIDER_GSUITE,\n 'email_provider_id' => $messageId,\n 'status' => TextRelay::STATUS_PROCESSING,\n ]);\n }\n\n $job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);\n\n dispatch($job);\n\n $messageIds[] = $messageId;\n }\n }\n\n return $messageIds;\n }\n\n public function getHistory(GoogleGmail $service): array\n {\n $pageToken = null;\n $topic = config('jiminny.google_text_relay_topic');\n $messages = [];\n $historyId = \\Cache::get($topic);\n\n // If we have no history stored, WatchMailboxEvents must not have run yet :/\n if ($historyId == false) {\n $historyId = $this->refreshHistoryPoint($topic);\n }\n\n $params = [\n 'historyTypes' => 'messageAdded',\n 'startHistoryId' => $historyId,\n ];\n\n do {\n try {\n if ($pageToken) {\n $params['pageToken'] = $pageToken;\n }\n\n $historyResponse = $service->users_history->listUsersHistory(\n config('jiminny.google_text_user'),\n $params\n );\n\n $this->setHistoryPoint($topic, $historyResponse->historyId);\n\n if ($historyResponse->getHistory()) {\n $messages = array_merge($messages, $historyResponse->getHistory());\n $pageToken = $historyResponse->getNextPageToken();\n }\n } catch (\\Exception $e) {\n \\Sentry::captureException($e);\n }\n } while ($pageToken);\n\n return $messages;\n }\n\n protected function setHistoryPoint(string $topic, int $historyPoint): Carbon\n {\n $expiresAt = now()->addDay();\n\n \\Cache::put($topic, $historyPoint, $expiresAt);\n\n return $expiresAt;\n }\n\n public function getService(string $mailbox): GoogleGmail\n {\n $client = new \\Google_Client();\n $client->useApplicationDefaultCredentials();\n $client->addScope(GoogleGmail::GMAIL_MODIFY);\n $client->setAccessType('offline');\n $client->setSubject($mailbox);\n\n return new GoogleGmail($client);\n }\n\n public function refreshHistoryPoint(string $topic): int\n {\n $mailbox = config('jiminny.google_text_user');\n $service = $this->getService($mailbox);\n\n $watchRequest = new GoogleGmail\\WatchRequest();\n $watchRequest->setLabelIds(['INBOX']);\n $watchRequest->setLabelFilterAction('include');\n $watchRequest->setTopicName($topic);\n\n $watchResponse = $service->users->watch($mailbox, $watchRequest);\n\n //$expiryTimestamp = $watchResponse->expiration / 1000;\n $historyPoint = $watchResponse->historyId;\n\n $this->setHistoryPoint($topic, $historyPoint);\n\n return $historyPoint;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Services\\Mail;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Jobs\\Mailbox\\EmailTextRelay;\nuse Jiminny\\Models\\TextRelay;\nuse Google\\Service\\Gmail as GoogleGmail;\n\nclass TextRelayService\n{\n public function __construct()\n {\n $credentials = storage_path('text-relay.json');\n\n abort_unless(file_exists($credentials), 422);\n\n putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);\n }\n\n /**\n * Fetch the latest messages since the last sync.\n */\n public function sync(): array\n {\n $mailbox = config('jiminny.google_text_user');\n\n $service = $this->getService($mailbox);\n\n $messageHistory = $this->getHistory($service);\n $messageIds = [];\n\n foreach ($messageHistory as $histories) {\n $messages = $histories->messagesAdded;\n\n foreach ($messages as $message) {\n $messageId = $message->message->id;\n $relayedText = TextRelay::where('email_provider_id', $messageId)->first();\n\n if ($relayedText === null) {\n $relayedText = TextRelay::create([\n 'email_provider' => TextRelay::PROVIDER_GSUITE,\n 'email_provider_id' => $messageId,\n 'status' => TextRelay::STATUS_PROCESSING,\n ]);\n }\n\n $job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);\n\n dispatch($job);\n\n $messageIds[] = $messageId;\n }\n }\n\n return $messageIds;\n }\n\n public function getHistory(GoogleGmail $service): array\n {\n $pageToken = null;\n $topic = config('jiminny.google_text_relay_topic');\n $messages = [];\n $historyId = \\Cache::get($topic);\n\n // If we have no history stored, WatchMailboxEvents must not have run yet :/\n if ($historyId == false) {\n $historyId = $this->refreshHistoryPoint($topic);\n }\n\n $params = [\n 'historyTypes' => 'messageAdded',\n 'startHistoryId' => $historyId,\n ];\n\n do {\n try {\n if ($pageToken) {\n $params['pageToken'] = $pageToken;\n }\n\n $historyResponse = $service->users_history->listUsersHistory(\n config('jiminny.google_text_user'),\n $params\n );\n\n $this->setHistoryPoint($topic, $historyResponse->historyId);\n\n if ($historyResponse->getHistory()) {\n $messages = array_merge($messages, $historyResponse->getHistory());\n $pageToken = $historyResponse->getNextPageToken();\n }\n } catch (\\Exception $e) {\n \\Sentry::captureException($e);\n }\n } while ($pageToken);\n\n return $messages;\n }\n\n protected function setHistoryPoint(string $topic, int $historyPoint): Carbon\n {\n $expiresAt = now()->addDay();\n\n \\Cache::put($topic, $historyPoint, $expiresAt);\n\n return $expiresAt;\n }\n\n public function getService(string $mailbox): GoogleGmail\n {\n $client = new \\Google_Client();\n $client->useApplicationDefaultCredentials();\n $client->addScope(GoogleGmail::GMAIL_MODIFY);\n $client->setAccessType('offline');\n $client->setSubject($mailbox);\n\n return new GoogleGmail($client);\n }\n\n public function refreshHistoryPoint(string $topic): int\n {\n $mailbox = config('jiminny.google_text_user');\n $service = $this->getService($mailbox);\n\n $watchRequest = new GoogleGmail\\WatchRequest();\n $watchRequest->setLabelIds(['INBOX']);\n $watchRequest->setLabelFilterAction('include');\n $watchRequest->setTopicName($topic);\n\n $watchResponse = $service->users->watch($mailbox, $watchRequest);\n\n //$expiryTimestamp = $watchResponse->expiration / 1000;\n $historyPoint = $watchResponse->historyId;\n\n $this->setHistoryPoint($topic, $historyPoint);\n\n return $historyPoint;\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.40957448,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.41821808,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.42918882,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.43783244,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4183277320359584336
|
1631651689498380683
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Mail;
use Carbon\Carbon;
use Jiminny\Component\Queue\Constants;
use Jiminny\Jobs\Mailbox\EmailTextRelay;
use Jiminny\Models\TextRelay;
use Google\Service\Gmail as GoogleGmail;
class TextRelayService
{
public function __construct()
{
$credentials = storage_path('text-relay.json');
abort_unless(file_exists($credentials), 422);
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);
}
/**
* Fetch the latest messages since the last sync.
*/
public function sync(): array
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$messageHistory = $this->getHistory($service);
$messageIds = [];
foreach ($messageHistory as $histories) {
$messages = $histories->messagesAdded;
foreach ($messages as $message) {
$messageId = $message->message->id;
$relayedText = TextRelay::where('email_provider_id', $messageId)->first();
if ($relayedText === null) {
$relayedText = TextRelay::create([
'email_provider' => TextRelay::PROVIDER_GSUITE,
'email_provider_id' => $messageId,
'status' => TextRelay::STATUS_PROCESSING,
]);
}
$job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);
dispatch($job);
$messageIds[] = $messageId;
}
}
return $messageIds;
}
public function getHistory(GoogleGmail $service): array
{
$pageToken = null;
$topic = config('jiminny.google_text_relay_topic');
$messages = [];
$historyId = \Cache::get($topic);
// If we have no history stored, WatchMailboxEvents must not have run yet :/
if ($historyId == false) {
$historyId = $this->refreshHistoryPoint($topic);
}
$params = [
'historyTypes' => 'messageAdded',
'startHistoryId' => $historyId,
];
do {
try {
if ($pageToken) {
$params['pageToken'] = $pageToken;
}
$historyResponse = $service->users_history->listUsersHistory(
config('jiminny.google_text_user'),
$params
);
$this->setHistoryPoint($topic, $historyResponse->historyId);
if ($historyResponse->getHistory()) {
$messages = array_merge($messages, $historyResponse->getHistory());
$pageToken = $historyResponse->getNextPageToken();
}
} catch (\Exception $e) {
\Sentry::captureException($e);
}
} while ($pageToken);
return $messages;
}
protected function setHistoryPoint(string $topic, int $historyPoint): Carbon
{
$expiresAt = now()->addDay();
\Cache::put($topic, $historyPoint, $expiresAt);
return $expiresAt;
}
public function getService(string $mailbox): GoogleGmail
{
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(GoogleGmail::GMAIL_MODIFY);
$client->setAccessType('offline');
$client->setSubject($mailbox);
return new GoogleGmail($client);
}
public function refreshHistoryPoint(string $topic): int
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$watchRequest = new GoogleGmail\WatchRequest();
$watchRequest->setLabelIds(['INBOX']);
$watchRequest->setLabelFilterAction('include');
$watchRequest->setTopicName($topic);
$watchResponse = $service->users->watch($mailbox, $watchRequest);
//$expiryTimestamp = $watchResponse->expiration / 1000;
$historyPoint = $watchResponse->historyId;
$this->setHistoryPoint($topic, $historyPoint);
return $historyPoint;
}
}
Execute
Explain Plan
Browse Query History
View Parameters...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34108
|
1283
|
50
|
2026-05-13T10:54:28.739089+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669668739_m1.jpg...
|
PhpStorm
|
faVsco.js – TextRelayService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Mail;
use Carbon\Carbon;
use Jiminny\Component\Queue\Constants;
use Jiminny\Jobs\Mailbox\EmailTextRelay;
use Jiminny\Models\TextRelay;
use Google\Service\Gmail as GoogleGmail;
class TextRelayService
{
public function __construct()
{
$credentials = storage_path('text-relay.json');
abort_unless(file_exists($credentials), 422);
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);
}
/**
* Fetch the latest messages since the last sync.
*/
public function sync(): array
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$messageHistory = $this->getHistory($service);
$messageIds = [];
foreach ($messageHistory as $histories) {
$messages = $histories->messagesAdded;
foreach ($messages as $message) {
$messageId = $message->message->id;
$relayedText = TextRelay::where('email_provider_id', $messageId)->first();
if ($relayedText === null) {
$relayedText = TextRelay::create([
'email_provider' => TextRelay::PROVIDER_GSUITE,
'email_provider_id' => $messageId,
'status' => TextRelay::STATUS_PROCESSING,
]);
}
$job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);
dispatch($job);
$messageIds[] = $messageId;
}
}
return $messageIds;
}
public function getHistory(GoogleGmail $service): array
{
$pageToken = null;
$topic = config('jiminny.google_text_relay_topic');
$messages = [];
$historyId = \Cache::get($topic);
// If we have no history stored, WatchMailboxEvents must not have run yet :/
if ($historyId == false) {
$historyId = $this->refreshHistoryPoint($topic);
}
$params = [
'historyTypes' => 'messageAdded',
'startHistoryId' => $historyId,
];
do {
try {
if ($pageToken) {
$params['pageToken'] = $pageToken;
}
$historyResponse = $service->users_history->listUsersHistory(
config('jiminny.google_text_user'),
$params
);
$this->setHistoryPoint($topic, $historyResponse->historyId);
if ($historyResponse->getHistory()) {
$messages = array_merge($messages, $historyResponse->getHistory());
$pageToken = $historyResponse->getNextPageToken();
}
} catch (\Exception $e) {
\Sentry::captureException($e);
}
} while ($pageToken);
return $messages;
}
protected function setHistoryPoint(string $topic, int $historyPoint): Carbon
{
$expiresAt = now()->addDay();
\Cache::put($topic, $historyPoint, $expiresAt);
return $expiresAt;
}
public function getService(string $mailbox): GoogleGmail
{
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(GoogleGmail::GMAIL_MODIFY);
$client->setAccessType('offline');
$client->setSubject($mailbox);
return new GoogleGmail($client);
}
public function refreshHistoryPoint(string $topic): int
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$watchRequest = new GoogleGmail\WatchRequest();
$watchRequest->setLabelIds(['INBOX']);
$watchRequest->setLabelFilterAction('include');
$watchRequest->setTopicName($topic);
$watchResponse = $service->users->watch($mailbox, $watchRequest);
//$expiryTimestamp = $watchResponse->expiration / 1000;
$historyPoint = $watchResponse->historyId;
$this->setHistoryPoint($topic, $historyPoint);
return $historyPoint;
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Services\\Mail;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Jobs\\Mailbox\\EmailTextRelay;\nuse Jiminny\\Models\\TextRelay;\nuse Google\\Service\\Gmail as GoogleGmail;\n\nclass TextRelayService\n{\n public function __construct()\n {\n $credentials = storage_path('text-relay.json');\n\n abort_unless(file_exists($credentials), 422);\n\n putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);\n }\n\n /**\n * Fetch the latest messages since the last sync.\n */\n public function sync(): array\n {\n $mailbox = config('jiminny.google_text_user');\n\n $service = $this->getService($mailbox);\n\n $messageHistory = $this->getHistory($service);\n $messageIds = [];\n\n foreach ($messageHistory as $histories) {\n $messages = $histories->messagesAdded;\n\n foreach ($messages as $message) {\n $messageId = $message->message->id;\n $relayedText = TextRelay::where('email_provider_id', $messageId)->first();\n\n if ($relayedText === null) {\n $relayedText = TextRelay::create([\n 'email_provider' => TextRelay::PROVIDER_GSUITE,\n 'email_provider_id' => $messageId,\n 'status' => TextRelay::STATUS_PROCESSING,\n ]);\n }\n\n $job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);\n\n dispatch($job);\n\n $messageIds[] = $messageId;\n }\n }\n\n return $messageIds;\n }\n\n public function getHistory(GoogleGmail $service): array\n {\n $pageToken = null;\n $topic = config('jiminny.google_text_relay_topic');\n $messages = [];\n $historyId = \\Cache::get($topic);\n\n // If we have no history stored, WatchMailboxEvents must not have run yet :/\n if ($historyId == false) {\n $historyId = $this->refreshHistoryPoint($topic);\n }\n\n $params = [\n 'historyTypes' => 'messageAdded',\n 'startHistoryId' => $historyId,\n ];\n\n do {\n try {\n if ($pageToken) {\n $params['pageToken'] = $pageToken;\n }\n\n $historyResponse = $service->users_history->listUsersHistory(\n config('jiminny.google_text_user'),\n $params\n );\n\n $this->setHistoryPoint($topic, $historyResponse->historyId);\n\n if ($historyResponse->getHistory()) {\n $messages = array_merge($messages, $historyResponse->getHistory());\n $pageToken = $historyResponse->getNextPageToken();\n }\n } catch (\\Exception $e) {\n \\Sentry::captureException($e);\n }\n } while ($pageToken);\n\n return $messages;\n }\n\n protected function setHistoryPoint(string $topic, int $historyPoint): Carbon\n {\n $expiresAt = now()->addDay();\n\n \\Cache::put($topic, $historyPoint, $expiresAt);\n\n return $expiresAt;\n }\n\n public function getService(string $mailbox): GoogleGmail\n {\n $client = new \\Google_Client();\n $client->useApplicationDefaultCredentials();\n $client->addScope(GoogleGmail::GMAIL_MODIFY);\n $client->setAccessType('offline');\n $client->setSubject($mailbox);\n\n return new GoogleGmail($client);\n }\n\n public function refreshHistoryPoint(string $topic): int\n {\n $mailbox = config('jiminny.google_text_user');\n $service = $this->getService($mailbox);\n\n $watchRequest = new GoogleGmail\\WatchRequest();\n $watchRequest->setLabelIds(['INBOX']);\n $watchRequest->setLabelFilterAction('include');\n $watchRequest->setTopicName($topic);\n\n $watchResponse = $service->users->watch($mailbox, $watchRequest);\n\n //$expiryTimestamp = $watchResponse->expiration / 1000;\n $historyPoint = $watchResponse->historyId;\n\n $this->setHistoryPoint($topic, $historyPoint);\n\n return $historyPoint;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Services\\Mail;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Jobs\\Mailbox\\EmailTextRelay;\nuse Jiminny\\Models\\TextRelay;\nuse Google\\Service\\Gmail as GoogleGmail;\n\nclass TextRelayService\n{\n public function __construct()\n {\n $credentials = storage_path('text-relay.json');\n\n abort_unless(file_exists($credentials), 422);\n\n putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);\n }\n\n /**\n * Fetch the latest messages since the last sync.\n */\n public function sync(): array\n {\n $mailbox = config('jiminny.google_text_user');\n\n $service = $this->getService($mailbox);\n\n $messageHistory = $this->getHistory($service);\n $messageIds = [];\n\n foreach ($messageHistory as $histories) {\n $messages = $histories->messagesAdded;\n\n foreach ($messages as $message) {\n $messageId = $message->message->id;\n $relayedText = TextRelay::where('email_provider_id', $messageId)->first();\n\n if ($relayedText === null) {\n $relayedText = TextRelay::create([\n 'email_provider' => TextRelay::PROVIDER_GSUITE,\n 'email_provider_id' => $messageId,\n 'status' => TextRelay::STATUS_PROCESSING,\n ]);\n }\n\n $job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);\n\n dispatch($job);\n\n $messageIds[] = $messageId;\n }\n }\n\n return $messageIds;\n }\n\n public function getHistory(GoogleGmail $service): array\n {\n $pageToken = null;\n $topic = config('jiminny.google_text_relay_topic');\n $messages = [];\n $historyId = \\Cache::get($topic);\n\n // If we have no history stored, WatchMailboxEvents must not have run yet :/\n if ($historyId == false) {\n $historyId = $this->refreshHistoryPoint($topic);\n }\n\n $params = [\n 'historyTypes' => 'messageAdded',\n 'startHistoryId' => $historyId,\n ];\n\n do {\n try {\n if ($pageToken) {\n $params['pageToken'] = $pageToken;\n }\n\n $historyResponse = $service->users_history->listUsersHistory(\n config('jiminny.google_text_user'),\n $params\n );\n\n $this->setHistoryPoint($topic, $historyResponse->historyId);\n\n if ($historyResponse->getHistory()) {\n $messages = array_merge($messages, $historyResponse->getHistory());\n $pageToken = $historyResponse->getNextPageToken();\n }\n } catch (\\Exception $e) {\n \\Sentry::captureException($e);\n }\n } while ($pageToken);\n\n return $messages;\n }\n\n protected function setHistoryPoint(string $topic, int $historyPoint): Carbon\n {\n $expiresAt = now()->addDay();\n\n \\Cache::put($topic, $historyPoint, $expiresAt);\n\n return $expiresAt;\n }\n\n public function getService(string $mailbox): GoogleGmail\n {\n $client = new \\Google_Client();\n $client->useApplicationDefaultCredentials();\n $client->addScope(GoogleGmail::GMAIL_MODIFY);\n $client->setAccessType('offline');\n $client->setSubject($mailbox);\n\n return new GoogleGmail($client);\n }\n\n public function refreshHistoryPoint(string $topic): int\n {\n $mailbox = config('jiminny.google_text_user');\n $service = $this->getService($mailbox);\n\n $watchRequest = new GoogleGmail\\WatchRequest();\n $watchRequest->setLabelIds(['INBOX']);\n $watchRequest->setLabelFilterAction('include');\n $watchRequest->setTopicName($topic);\n\n $watchResponse = $service->users->watch($mailbox, $watchRequest);\n\n //$expiryTimestamp = $watchResponse->expiration / 1000;\n $historyPoint = $watchResponse->historyId;\n\n $this->setHistoryPoint($topic, $historyPoint);\n\n return $historyPoint;\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5635068400895023689
|
2218600145176901197
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Mail;
use Carbon\Carbon;
use Jiminny\Component\Queue\Constants;
use Jiminny\Jobs\Mailbox\EmailTextRelay;
use Jiminny\Models\TextRelay;
use Google\Service\Gmail as GoogleGmail;
class TextRelayService
{
public function __construct()
{
$credentials = storage_path('text-relay.json');
abort_unless(file_exists($credentials), 422);
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $credentials);
}
/**
* Fetch the latest messages since the last sync.
*/
public function sync(): array
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$messageHistory = $this->getHistory($service);
$messageIds = [];
foreach ($messageHistory as $histories) {
$messages = $histories->messagesAdded;
foreach ($messages as $message) {
$messageId = $message->message->id;
$relayedText = TextRelay::where('email_provider_id', $messageId)->first();
if ($relayedText === null) {
$relayedText = TextRelay::create([
'email_provider' => TextRelay::PROVIDER_GSUITE,
'email_provider_id' => $messageId,
'status' => TextRelay::STATUS_PROCESSING,
]);
}
$job = (new EmailTextRelay($messageId, $relayedText))->onQueue(Constants::QUEUE_EMAILS);
dispatch($job);
$messageIds[] = $messageId;
}
}
return $messageIds;
}
public function getHistory(GoogleGmail $service): array
{
$pageToken = null;
$topic = config('jiminny.google_text_relay_topic');
$messages = [];
$historyId = \Cache::get($topic);
// If we have no history stored, WatchMailboxEvents must not have run yet :/
if ($historyId == false) {
$historyId = $this->refreshHistoryPoint($topic);
}
$params = [
'historyTypes' => 'messageAdded',
'startHistoryId' => $historyId,
];
do {
try {
if ($pageToken) {
$params['pageToken'] = $pageToken;
}
$historyResponse = $service->users_history->listUsersHistory(
config('jiminny.google_text_user'),
$params
);
$this->setHistoryPoint($topic, $historyResponse->historyId);
if ($historyResponse->getHistory()) {
$messages = array_merge($messages, $historyResponse->getHistory());
$pageToken = $historyResponse->getNextPageToken();
}
} catch (\Exception $e) {
\Sentry::captureException($e);
}
} while ($pageToken);
return $messages;
}
protected function setHistoryPoint(string $topic, int $historyPoint): Carbon
{
$expiresAt = now()->addDay();
\Cache::put($topic, $historyPoint, $expiresAt);
return $expiresAt;
}
public function getService(string $mailbox): GoogleGmail
{
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(GoogleGmail::GMAIL_MODIFY);
$client->setAccessType('offline');
$client->setSubject($mailbox);
return new GoogleGmail($client);
}
public function refreshHistoryPoint(string $topic): int
{
$mailbox = config('jiminny.google_text_user');
$service = $this->getService($mailbox);
$watchRequest = new GoogleGmail\WatchRequest();
$watchRequest->setLabelIds(['INBOX']);
$watchRequest->setLabelFilterAction('include');
$watchRequest->setTopicName($topic);
$watchResponse = $service->users->watch($mailbox, $watchRequest);
//$expiryTimestamp = $watchResponse->expiration / 1000;
$historyPoint = $watchResponse->historyId;
$this->setHistoryPoint($topic, $historyPoint);
return $historyPoint;
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
34106
|
NULL
|
NULL
|
NULL
|
|
34109
|
1283
|
51
|
2026-05-13T10:54:33.284389+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669673284_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
FinderFileEditViewGoWindowHelp> 0Support Daily FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 6 mA100% C8• Wed 13 May13:54:33PROD (ssh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:APP (-zsh)"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ПГRmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
2702292848173332060
|
NULL
|
click
|
ocr
|
NULL
|
FinderFileEditViewGoWindowHelp> 0Support Daily FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 6 mA100% C8• Wed 13 May13:54:33PROD (ssh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:APP (-zsh)"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ПГRmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34110
|
1283
|
52
|
2026-05-13T10:54:35.237369+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669675237_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Telephony;
use Jiminny\Component\Activity\Services\GetDefaultActivityTypeService;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Exceptions\LogicException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Models\Activity;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\ActivityService;
use Jiminny\Services\Crm\CachedCrmServiceDecorator;
use Jiminny\Services\Crm\ProviderRegistry;
use Twilio\Exceptions\ConfigurationException;
use Twilio\Exceptions\TwilioException;
use Twilio\Rest\Api\V2010\Account\MessageInstance;
class TextMessagingService
{
private ?Team $team = null;
private ?TwilioClient $twilioClient = null;
public function __construct(
private readonly ProviderRegistry $providerRegistry,
private readonly ActivityService $activityService,
private readonly Webhook $urlGenerator,
private readonly TwilioClientBuilder $twilioClientBuilder,
) {
}
/**
* @throws ConfigurationException
*/
public function setTeam(Team $team): void
{
$this->team = $team;
$this->twilioClient = $this->twilioClientBuilder->build($team);
}
/**
* @throws \Exception
*/
public function send(User $from, string $to, string $message): MessageInstance
{
if ($this->team->id !== $from->team_id) {
throw new \InvalidArgumentException('Sender does not belong to this team.');
}
$payload = [
'from' => $from->softphone_number,
'body' => $message,
'smartEncoded' => true, // Detect Unicode characters that have a similar GSM-7 character and replace.
'statusCallback' => $this->urlGenerator->route('jiminny.webhook.softphone.sms.event'),
];
if ($this->team->twilio_messaging_sid !== null) {
$payload['messagingServiceSid'] = $this->team->twilio_messaging_sid;
} else {
$payload['applicationSid'] = $this->team->twilio_sms_sid;
}
return $this->twilioClient
->messages
->create($to, $payload);
}
/**
* @throws TwilioException
*/
public function redact(Activity $activity): void
{
$this->twilioClient
->messages($activity->telephony_provider_id)
->delete();
}
public function buildActivity(
?string $messageId,
string $type,
User $user,
string $from,
string $to,
string $message,
?string $customerId,
?string $objectType,
?string $countryCode
): Activity {
$lead = null;
$account = null;
$contact = null;
$stage = null;
$opportunity = null;
$team = $user->getTeam();
try {
$crmService = $this->providerRegistry->get($team->crm->provider);
if (! $user->isCrmRequired()) {
$crmService->setUser($team->getOwner());
} else {
$crmService->setUser($user);
}
if ($customerId) {
// Query the CRM for full details of this customer.
[$lead, $account, $opportunity, $contact, $stage, $crmCountryCode] = $crmService->parseRecords($customerId, $objectType);
// Prefer the passed country code from Twilio over CRM data.
if ($countryCode === null && $crmCountryCode) {
$countryCode = $crmCountryCode;
}
} else {
$decorator = resolve(CachedCrmServiceDecorator::class);
$decorator->setCrmService($crmService);
// Lookup who the message might be to/from based on their phone number.
$lookup = $type === Activity::TYPE_SMS_INBOUND ? $from : $to;
[$lead, $account, $opportunity, $contact, $stage] = $decorator->matchByPhone(
$lookup,
null,
$user->getId()
);
}
if ($opportunity === null) {
$opportunities = $crmService->findOpportunities(
$account ? $account->crm_provider_id : null,
$contact ? $contact->crm_provider_id : null,
$user->getId()
);
if (! empty($opportunities)) {
$opportunity = $crmService->syncOpportunity($opportunities[0]['crmId']);
}
}
} catch (SocialAccountTokenInvalidException $accountTokenInvalidException) {
// If their CRM has become disconnected, we really have no idea who the text customer is.
$lead = $account = $opportunity = $contact = $stage = null;
}
if ($countryCode === null) {
$countryCode = $user->country_code;
}
if ($type === Activity::TYPE_SMS_OUTBOUND) {
$to = phone_e164($countryCode, $to);
// Check they are allowed to text this number.
if ($this->activityService->userCanText($user, $to, $countryCode) === false) {
throw new \InvalidArgumentException('Recipient in block list for this user.');
}
$title = 'Text to ' . phone_national($countryCode, $to);
$status = Activity::STATUS_QUEUED;
} else {
$title = 'Text from ' . phone_national($countryCode, $from);
$status = Activity::STATUS_RECEIVED;
}
$category = $this->getActivityType($user, $type);
$activity = $user->activities()->create([
'provider' => Activity::PROVIDER_TWILIO,
'telephony_provider_id' => $messageId ?? null,
'type' => $type,
'title' => $title,
'description' => $message,
'crm_configuration_id' => $team->crm_id,
'playbook_category_id' => $category->id ?? null,
'lead_id' => $lead->id ?? null,
'account_id' => $account->id ?? null,
'contact_id' => $contact->id ?? null,
'opportunity_id' => $opportunity->id ?? null,
'value' => $opportunity ? $opportunity->value : null,
'stage_id' => $stage->id ?? null,
'status' => $status,
'scheduled_start_time' => now(),
]);
if (! $activity instanceof Activity) {
throw new LogicException('Activity model expected');
}
// Create two participants to store the sender/receiver of the message.
$userParticipant = $activity->participants()->create([
'user_id' => $user->id,
'email' => $user->email,
'name' => $user->name,
'phone_number' => $user->softphone_number,
]);
$prospectParticipant = $activity->participants()->create([
'lead_id' => $activity->lead_id ?? null,
'contact_id' => $activity->contact_id ?? null,
'name' => mb_strimwidth($activity->prospect_name, 0, 100),
'phone_number' => $type === Activity::TYPE_SMS_OUTBOUND ? $to : $from,
]);
// Refresh the model to fetch participants we just created so they'll be pushed to ES
$activity->refresh();
// Depending on the message direction, setup the from/to.
$activity->from_participant_id = $type === Activity::TYPE_SMS_OUTBOUND
? $userParticipant->id
: $prospectParticipant->id;
$activity->to_participant_id = $type === Activity::TYPE_SMS_OUTBOUND
? $prospectParticipant->id
: $userParticipant->id;
$activity->save();
return $activity;
}
public function convertCustomerToCountryCode(User $user, string $customerId, ?string $objectType): string
{
$crmService = $this->providerRegistry->get($user->team->crm->provider);
$crmService->setUser($user);
// Query the CRM for full details of this customer.
try {
[, , , , , $countryCode] = $crmService->parseRecords($customerId, $objectType);
} catch (\Exception $ex) {
\Sentry::captureException($ex);
return $user->getCountryCode();
}
// Prefer the passed country code from CRM data to the user.
if ($countryCode === null) {
$countryCode = $user->getCountryCode();
}
return $countryCode;
}
private function getActivityType(User $user, string $type): ?PlaybookCategory
{
$getDefaultActivityTypeService = app(GetDefaultActivityTypeService::class);
return $getDefaultActivityTypeService->getForUserAndChannel($user, $type);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Services\\Telephony;\n\nuse Jiminny\\Component\\Activity\\Services\\GetDefaultActivityTypeService;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Exceptions\\LogicException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\ActivityService;\nuse Jiminny\\Services\\Crm\\CachedCrmServiceDecorator;\nuse Jiminny\\Services\\Crm\\ProviderRegistry;\nuse Twilio\\Exceptions\\ConfigurationException;\nuse Twilio\\Exceptions\\TwilioException;\nuse Twilio\\Rest\\Api\\V2010\\Account\\MessageInstance;\n\nclass TextMessagingService\n{\n private ?Team $team = null;\n private ?TwilioClient $twilioClient = null;\n\n public function __construct(\n private readonly ProviderRegistry $providerRegistry,\n private readonly ActivityService $activityService,\n private readonly Webhook $urlGenerator,\n private readonly TwilioClientBuilder $twilioClientBuilder,\n ) {\n }\n\n /**\n * @throws ConfigurationException\n */\n public function setTeam(Team $team): void\n {\n $this->team = $team;\n $this->twilioClient = $this->twilioClientBuilder->build($team);\n }\n\n /**\n * @throws \\Exception\n */\n public function send(User $from, string $to, string $message): MessageInstance\n {\n if ($this->team->id !== $from->team_id) {\n throw new \\InvalidArgumentException('Sender does not belong to this team.');\n }\n\n $payload = [\n 'from' => $from->softphone_number,\n 'body' => $message,\n 'smartEncoded' => true, // Detect Unicode characters that have a similar GSM-7 character and replace.\n 'statusCallback' => $this->urlGenerator->route('jiminny.webhook.softphone.sms.event'),\n ];\n\n if ($this->team->twilio_messaging_sid !== null) {\n $payload['messagingServiceSid'] = $this->team->twilio_messaging_sid;\n } else {\n $payload['applicationSid'] = $this->team->twilio_sms_sid;\n }\n\n return $this->twilioClient\n ->messages\n ->create($to, $payload);\n }\n\n /**\n * @throws TwilioException\n */\n public function redact(Activity $activity): void\n {\n $this->twilioClient\n ->messages($activity->telephony_provider_id)\n ->delete();\n }\n\n public function buildActivity(\n ?string $messageId,\n string $type,\n User $user,\n string $from,\n string $to,\n string $message,\n ?string $customerId,\n ?string $objectType,\n ?string $countryCode\n ): Activity {\n $lead = null;\n $account = null;\n $contact = null;\n $stage = null;\n $opportunity = null;\n\n $team = $user->getTeam();\n\n try {\n $crmService = $this->providerRegistry->get($team->crm->provider);\n\n if (! $user->isCrmRequired()) {\n $crmService->setUser($team->getOwner());\n } else {\n $crmService->setUser($user);\n }\n\n if ($customerId) {\n // Query the CRM for full details of this customer.\n [$lead, $account, $opportunity, $contact, $stage, $crmCountryCode] = $crmService->parseRecords($customerId, $objectType);\n\n // Prefer the passed country code from Twilio over CRM data.\n if ($countryCode === null && $crmCountryCode) {\n $countryCode = $crmCountryCode;\n }\n } else {\n $decorator = resolve(CachedCrmServiceDecorator::class);\n $decorator->setCrmService($crmService);\n\n // Lookup who the message might be to/from based on their phone number.\n $lookup = $type === Activity::TYPE_SMS_INBOUND ? $from : $to;\n [$lead, $account, $opportunity, $contact, $stage] = $decorator->matchByPhone(\n $lookup,\n null,\n $user->getId()\n );\n }\n\n if ($opportunity === null) {\n $opportunities = $crmService->findOpportunities(\n $account ? $account->crm_provider_id : null,\n $contact ? $contact->crm_provider_id : null,\n $user->getId()\n );\n\n if (! empty($opportunities)) {\n $opportunity = $crmService->syncOpportunity($opportunities[0]['crmId']);\n }\n }\n } catch (SocialAccountTokenInvalidException $accountTokenInvalidException) {\n // If their CRM has become disconnected, we really have no idea who the text customer is.\n $lead = $account = $opportunity = $contact = $stage = null;\n }\n\n if ($countryCode === null) {\n $countryCode = $user->country_code;\n }\n\n if ($type === Activity::TYPE_SMS_OUTBOUND) {\n $to = phone_e164($countryCode, $to);\n\n // Check they are allowed to text this number.\n if ($this->activityService->userCanText($user, $to, $countryCode) === false) {\n throw new \\InvalidArgumentException('Recipient in block list for this user.');\n }\n\n $title = 'Text to ' . phone_national($countryCode, $to);\n $status = Activity::STATUS_QUEUED;\n } else {\n $title = 'Text from ' . phone_national($countryCode, $from);\n $status = Activity::STATUS_RECEIVED;\n }\n\n $category = $this->getActivityType($user, $type);\n\n $activity = $user->activities()->create([\n 'provider' => Activity::PROVIDER_TWILIO,\n 'telephony_provider_id' => $messageId ?? null,\n 'type' => $type,\n 'title' => $title,\n 'description' => $message,\n 'crm_configuration_id' => $team->crm_id,\n 'playbook_category_id' => $category->id ?? null,\n 'lead_id' => $lead->id ?? null,\n 'account_id' => $account->id ?? null,\n 'contact_id' => $contact->id ?? null,\n 'opportunity_id' => $opportunity->id ?? null,\n 'value' => $opportunity ? $opportunity->value : null,\n 'stage_id' => $stage->id ?? null,\n 'status' => $status,\n 'scheduled_start_time' => now(),\n ]);\n\n if (! $activity instanceof Activity) {\n throw new LogicException('Activity model expected');\n }\n\n // Create two participants to store the sender/receiver of the message.\n $userParticipant = $activity->participants()->create([\n 'user_id' => $user->id,\n 'email' => $user->email,\n 'name' => $user->name,\n 'phone_number' => $user->softphone_number,\n ]);\n\n $prospectParticipant = $activity->participants()->create([\n 'lead_id' => $activity->lead_id ?? null,\n 'contact_id' => $activity->contact_id ?? null,\n 'name' => mb_strimwidth($activity->prospect_name, 0, 100),\n 'phone_number' => $type === Activity::TYPE_SMS_OUTBOUND ? $to : $from,\n ]);\n\n // Refresh the model to fetch participants we just created so they'll be pushed to ES\n $activity->refresh();\n\n // Depending on the message direction, setup the from/to.\n $activity->from_participant_id = $type === Activity::TYPE_SMS_OUTBOUND\n ? $userParticipant->id\n : $prospectParticipant->id;\n\n $activity->to_participant_id = $type === Activity::TYPE_SMS_OUTBOUND\n ? $prospectParticipant->id\n : $userParticipant->id;\n\n $activity->save();\n\n return $activity;\n }\n\n public function convertCustomerToCountryCode(User $user, string $customerId, ?string $objectType): string\n {\n $crmService = $this->providerRegistry->get($user->team->crm->provider);\n $crmService->setUser($user);\n\n // Query the CRM for full details of this customer.\n try {\n [, , , , , $countryCode] = $crmService->parseRecords($customerId, $objectType);\n } catch (\\Exception $ex) {\n \\Sentry::captureException($ex);\n\n return $user->getCountryCode();\n }\n\n // Prefer the passed country code from CRM data to the user.\n if ($countryCode === null) {\n $countryCode = $user->getCountryCode();\n }\n\n return $countryCode;\n }\n\n private function getActivityType(User $user, string $type): ?PlaybookCategory\n {\n $getDefaultActivityTypeService = app(GetDefaultActivityTypeService::class);\n\n return $getDefaultActivityTypeService->getForUserAndChannel($user, $type);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Services\\Telephony;\n\nuse Jiminny\\Component\\Activity\\Services\\GetDefaultActivityTypeService;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Exceptions\\LogicException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\ActivityService;\nuse Jiminny\\Services\\Crm\\CachedCrmServiceDecorator;\nuse Jiminny\\Services\\Crm\\ProviderRegistry;\nuse Twilio\\Exceptions\\ConfigurationException;\nuse Twilio\\Exceptions\\TwilioException;\nuse Twilio\\Rest\\Api\\V2010\\Account\\MessageInstance;\n\nclass TextMessagingService\n{\n private ?Team $team = null;\n private ?TwilioClient $twilioClient = null;\n\n public function __construct(\n private readonly ProviderRegistry $providerRegistry,\n private readonly ActivityService $activityService,\n private readonly Webhook $urlGenerator,\n private readonly TwilioClientBuilder $twilioClientBuilder,\n ) {\n }\n\n /**\n * @throws ConfigurationException\n */\n public function setTeam(Team $team): void\n {\n $this->team = $team;\n $this->twilioClient = $this->twilioClientBuilder->build($team);\n }\n\n /**\n * @throws \\Exception\n */\n public function send(User $from, string $to, string $message): MessageInstance\n {\n if ($this->team->id !== $from->team_id) {\n throw new \\InvalidArgumentException('Sender does not belong to this team.');\n }\n\n $payload = [\n 'from' => $from->softphone_number,\n 'body' => $message,\n 'smartEncoded' => true, // Detect Unicode characters that have a similar GSM-7 character and replace.\n 'statusCallback' => $this->urlGenerator->route('jiminny.webhook.softphone.sms.event'),\n ];\n\n if ($this->team->twilio_messaging_sid !== null) {\n $payload['messagingServiceSid'] = $this->team->twilio_messaging_sid;\n } else {\n $payload['applicationSid'] = $this->team->twilio_sms_sid;\n }\n\n return $this->twilioClient\n ->messages\n ->create($to, $payload);\n }\n\n /**\n * @throws TwilioException\n */\n public function redact(Activity $activity): void\n {\n $this->twilioClient\n ->messages($activity->telephony_provider_id)\n ->delete();\n }\n\n public function buildActivity(\n ?string $messageId,\n string $type,\n User $user,\n string $from,\n string $to,\n string $message,\n ?string $customerId,\n ?string $objectType,\n ?string $countryCode\n ): Activity {\n $lead = null;\n $account = null;\n $contact = null;\n $stage = null;\n $opportunity = null;\n\n $team = $user->getTeam();\n\n try {\n $crmService = $this->providerRegistry->get($team->crm->provider);\n\n if (! $user->isCrmRequired()) {\n $crmService->setUser($team->getOwner());\n } else {\n $crmService->setUser($user);\n }\n\n if ($customerId) {\n // Query the CRM for full details of this customer.\n [$lead, $account, $opportunity, $contact, $stage, $crmCountryCode] = $crmService->parseRecords($customerId, $objectType);\n\n // Prefer the passed country code from Twilio over CRM data.\n if ($countryCode === null && $crmCountryCode) {\n $countryCode = $crmCountryCode;\n }\n } else {\n $decorator = resolve(CachedCrmServiceDecorator::class);\n $decorator->setCrmService($crmService);\n\n // Lookup who the message might be to/from based on their phone number.\n $lookup = $type === Activity::TYPE_SMS_INBOUND ? $from : $to;\n [$lead, $account, $opportunity, $contact, $stage] = $decorator->matchByPhone(\n $lookup,\n null,\n $user->getId()\n );\n }\n\n if ($opportunity === null) {\n $opportunities = $crmService->findOpportunities(\n $account ? $account->crm_provider_id : null,\n $contact ? $contact->crm_provider_id : null,\n $user->getId()\n );\n\n if (! empty($opportunities)) {\n $opportunity = $crmService->syncOpportunity($opportunities[0]['crmId']);\n }\n }\n } catch (SocialAccountTokenInvalidException $accountTokenInvalidException) {\n // If their CRM has become disconnected, we really have no idea who the text customer is.\n $lead = $account = $opportunity = $contact = $stage = null;\n }\n\n if ($countryCode === null) {\n $countryCode = $user->country_code;\n }\n\n if ($type === Activity::TYPE_SMS_OUTBOUND) {\n $to = phone_e164($countryCode, $to);\n\n // Check they are allowed to text this number.\n if ($this->activityService->userCanText($user, $to, $countryCode) === false) {\n throw new \\InvalidArgumentException('Recipient in block list for this user.');\n }\n\n $title = 'Text to ' . phone_national($countryCode, $to);\n $status = Activity::STATUS_QUEUED;\n } else {\n $title = 'Text from ' . phone_national($countryCode, $from);\n $status = Activity::STATUS_RECEIVED;\n }\n\n $category = $this->getActivityType($user, $type);\n\n $activity = $user->activities()->create([\n 'provider' => Activity::PROVIDER_TWILIO,\n 'telephony_provider_id' => $messageId ?? null,\n 'type' => $type,\n 'title' => $title,\n 'description' => $message,\n 'crm_configuration_id' => $team->crm_id,\n 'playbook_category_id' => $category->id ?? null,\n 'lead_id' => $lead->id ?? null,\n 'account_id' => $account->id ?? null,\n 'contact_id' => $contact->id ?? null,\n 'opportunity_id' => $opportunity->id ?? null,\n 'value' => $opportunity ? $opportunity->value : null,\n 'stage_id' => $stage->id ?? null,\n 'status' => $status,\n 'scheduled_start_time' => now(),\n ]);\n\n if (! $activity instanceof Activity) {\n throw new LogicException('Activity model expected');\n }\n\n // Create two participants to store the sender/receiver of the message.\n $userParticipant = $activity->participants()->create([\n 'user_id' => $user->id,\n 'email' => $user->email,\n 'name' => $user->name,\n 'phone_number' => $user->softphone_number,\n ]);\n\n $prospectParticipant = $activity->participants()->create([\n 'lead_id' => $activity->lead_id ?? null,\n 'contact_id' => $activity->contact_id ?? null,\n 'name' => mb_strimwidth($activity->prospect_name, 0, 100),\n 'phone_number' => $type === Activity::TYPE_SMS_OUTBOUND ? $to : $from,\n ]);\n\n // Refresh the model to fetch participants we just created so they'll be pushed to ES\n $activity->refresh();\n\n // Depending on the message direction, setup the from/to.\n $activity->from_participant_id = $type === Activity::TYPE_SMS_OUTBOUND\n ? $userParticipant->id\n : $prospectParticipant->id;\n\n $activity->to_participant_id = $type === Activity::TYPE_SMS_OUTBOUND\n ? $prospectParticipant->id\n : $userParticipant->id;\n\n $activity->save();\n\n return $activity;\n }\n\n public function convertCustomerToCountryCode(User $user, string $customerId, ?string $objectType): string\n {\n $crmService = $this->providerRegistry->get($user->team->crm->provider);\n $crmService->setUser($user);\n\n // Query the CRM for full details of this customer.\n try {\n [, , , , , $countryCode] = $crmService->parseRecords($customerId, $objectType);\n } catch (\\Exception $ex) {\n \\Sentry::captureException($ex);\n\n return $user->getCountryCode();\n }\n\n // Prefer the passed country code from CRM data to the user.\n if ($countryCode === null) {\n $countryCode = $user->getCountryCode();\n }\n\n return $countryCode;\n }\n\n private function getActivityType(User $user, string $type): ?PlaybookCategory\n {\n $getDefaultActivityTypeService = app(GetDefaultActivityTypeService::class);\n\n return $getDefaultActivityTypeService->getForUserAndChannel($user, $type);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
7956377783685541015
|
1065678670634825285
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Services\Telephony;
use Jiminny\Component\Activity\Services\GetDefaultActivityTypeService;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Exceptions\LogicException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Models\Activity;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\ActivityService;
use Jiminny\Services\Crm\CachedCrmServiceDecorator;
use Jiminny\Services\Crm\ProviderRegistry;
use Twilio\Exceptions\ConfigurationException;
use Twilio\Exceptions\TwilioException;
use Twilio\Rest\Api\V2010\Account\MessageInstance;
class TextMessagingService
{
private ?Team $team = null;
private ?TwilioClient $twilioClient = null;
public function __construct(
private readonly ProviderRegistry $providerRegistry,
private readonly ActivityService $activityService,
private readonly Webhook $urlGenerator,
private readonly TwilioClientBuilder $twilioClientBuilder,
) {
}
/**
* @throws ConfigurationException
*/
public function setTeam(Team $team): void
{
$this->team = $team;
$this->twilioClient = $this->twilioClientBuilder->build($team);
}
/**
* @throws \Exception
*/
public function send(User $from, string $to, string $message): MessageInstance
{
if ($this->team->id !== $from->team_id) {
throw new \InvalidArgumentException('Sender does not belong to this team.');
}
$payload = [
'from' => $from->softphone_number,
'body' => $message,
'smartEncoded' => true, // Detect Unicode characters that have a similar GSM-7 character and replace.
'statusCallback' => $this->urlGenerator->route('jiminny.webhook.softphone.sms.event'),
];
if ($this->team->twilio_messaging_sid !== null) {
$payload['messagingServiceSid'] = $this->team->twilio_messaging_sid;
} else {
$payload['applicationSid'] = $this->team->twilio_sms_sid;
}
return $this->twilioClient
->messages
->create($to, $payload);
}
/**
* @throws TwilioException
*/
public function redact(Activity $activity): void
{
$this->twilioClient
->messages($activity->telephony_provider_id)
->delete();
}
public function buildActivity(
?string $messageId,
string $type,
User $user,
string $from,
string $to,
string $message,
?string $customerId,
?string $objectType,
?string $countryCode
): Activity {
$lead = null;
$account = null;
$contact = null;
$stage = null;
$opportunity = null;
$team = $user->getTeam();
try {
$crmService = $this->providerRegistry->get($team->crm->provider);
if (! $user->isCrmRequired()) {
$crmService->setUser($team->getOwner());
} else {
$crmService->setUser($user);
}
if ($customerId) {
// Query the CRM for full details of this customer.
[$lead, $account, $opportunity, $contact, $stage, $crmCountryCode] = $crmService->parseRecords($customerId, $objectType);
// Prefer the passed country code from Twilio over CRM data.
if ($countryCode === null && $crmCountryCode) {
$countryCode = $crmCountryCode;
}
} else {
$decorator = resolve(CachedCrmServiceDecorator::class);
$decorator->setCrmService($crmService);
// Lookup who the message might be to/from based on their phone number.
$lookup = $type === Activity::TYPE_SMS_INBOUND ? $from : $to;
[$lead, $account, $opportunity, $contact, $stage] = $decorator->matchByPhone(
$lookup,
null,
$user->getId()
);
}
if ($opportunity === null) {
$opportunities = $crmService->findOpportunities(
$account ? $account->crm_provider_id : null,
$contact ? $contact->crm_provider_id : null,
$user->getId()
);
if (! empty($opportunities)) {
$opportunity = $crmService->syncOpportunity($opportunities[0]['crmId']);
}
}
} catch (SocialAccountTokenInvalidException $accountTokenInvalidException) {
// If their CRM has become disconnected, we really have no idea who the text customer is.
$lead = $account = $opportunity = $contact = $stage = null;
}
if ($countryCode === null) {
$countryCode = $user->country_code;
}
if ($type === Activity::TYPE_SMS_OUTBOUND) {
$to = phone_e164($countryCode, $to);
// Check they are allowed to text this number.
if ($this->activityService->userCanText($user, $to, $countryCode) === false) {
throw new \InvalidArgumentException('Recipient in block list for this user.');
}
$title = 'Text to ' . phone_national($countryCode, $to);
$status = Activity::STATUS_QUEUED;
} else {
$title = 'Text from ' . phone_national($countryCode, $from);
$status = Activity::STATUS_RECEIVED;
}
$category = $this->getActivityType($user, $type);
$activity = $user->activities()->create([
'provider' => Activity::PROVIDER_TWILIO,
'telephony_provider_id' => $messageId ?? null,
'type' => $type,
'title' => $title,
'description' => $message,
'crm_configuration_id' => $team->crm_id,
'playbook_category_id' => $category->id ?? null,
'lead_id' => $lead->id ?? null,
'account_id' => $account->id ?? null,
'contact_id' => $contact->id ?? null,
'opportunity_id' => $opportunity->id ?? null,
'value' => $opportunity ? $opportunity->value : null,
'stage_id' => $stage->id ?? null,
'status' => $status,
'scheduled_start_time' => now(),
]);
if (! $activity instanceof Activity) {
throw new LogicException('Activity model expected');
}
// Create two participants to store the sender/receiver of the message.
$userParticipant = $activity->participants()->create([
'user_id' => $user->id,
'email' => $user->email,
'name' => $user->name,
'phone_number' => $user->softphone_number,
]);
$prospectParticipant = $activity->participants()->create([
'lead_id' => $activity->lead_id ?? null,
'contact_id' => $activity->contact_id ?? null,
'name' => mb_strimwidth($activity->prospect_name, 0, 100),
'phone_number' => $type === Activity::TYPE_SMS_OUTBOUND ? $to : $from,
]);
// Refresh the model to fetch participants we just created so they'll be pushed to ES
$activity->refresh();
// Depending on the message direction, setup the from/to.
$activity->from_participant_id = $type === Activity::TYPE_SMS_OUTBOUND
? $userParticipant->id
: $prospectParticipant->id;
$activity->to_participant_id = $type === Activity::TYPE_SMS_OUTBOUND
? $prospectParticipant->id
: $userParticipant->id;
$activity->save();
return $activity;
}
public function convertCustomerToCountryCode(User $user, string $customerId, ?string $objectType): string
{
$crmService = $this->providerRegistry->get($user->team->crm->provider);
$crmService->setUser($user);
// Query the CRM for full details of this customer.
try {
[, , , , , $countryCode] = $crmService->parseRecords($customerId, $objectType);
} catch (\Exception $ex) {
\Sentry::captureException($ex);
return $user->getCountryCode();
}
// Prefer the passed country code from CRM data to the user.
if ($countryCode === null) {
$countryCode = $user->getCountryCode();
}
return $countryCode;
}
private function getActivityType(User $user, string $type): ?PlaybookCategory
{
$getDefaultActivityTypeService = app(GetDefaultActivityTypeService::class);
return $getDefaultActivityTypeService->getForUserAndChannel($user, $type);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
34109
|
NULL
|
NULL
|
NULL
|
|
34111
|
1284
|
45
|
2026-05-13T10:54:33.287399+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669673287_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormINavigarecodeFV faVsco.jsProiectC) SvncBat PhostormINavigarecodeFV faVsco.jsProiectC) SvncBatchRedisSeTraitsc Baseclient.onp© BaseService.phpo countrycoderesoiver.© CrmActivityProviderint© CrmActivityService.ph© CrmConfigurationSettic crmobiectskesolver.oc) DeraultProspectsearcc) cmallhelper.phge rinosProspecuinienacc) Lavourmanader.ono@ MatchDomainByEmaillC) OpportunitvActivityMa1 OpportunitvSvncStrate(C) Prosoect SearchScone(1) ProspectSearchStrate•) ProviderRedistrv.oho.C RecordSelector.ohoT ResolveComnanvNam(c) TimePerioditerator nhrm imnorKiockm Mail)MActioncaffinoM PenositoriesM Docalvord>C TraitsC Validators(e) RatchCriteria.phoTextkelayservice.pnp* BatchCriterialnterface1L001© BatchService.php102® BatchServicelnterface. 110©EmailActivityService.pl 1ndEmailActivityServiceln1 112C) EmailMessage.ohoEmailMessagelnterfaci [EMAIL]@ InboxServicelnterface. 11%© InternetMessagelnterf: 11-© MailChannelService.pr11g© TextRelayService.php1M MeptinaGeneratoh Notification© MailboxController.phpsms-relay-failed.blade.phpsynce. arraySservice = $this->getService($mailbox);smessageniscory = schis->gechiscorysservicesmessacelas = urforeach Smessagehistory as shistories) «Smessages = shistories->messagesadded*foreach Smessages as Smessage) *Smessagelld = smessage->message»>1d*SrelayedText = TextRelay: :where('email_provider_id', $messageld)->first();if SrelavedText za= nulb *SrelavedText = TextRelav:.crentedl= TextRelav: •PROVIDER GSUITE.I'email_provider_id' => $messageld,statust => TeytRelav. • STATIIS PROCESSTNGSjob = (new EmailTextRelay(SmessageId, SrelayedText))->onQueue(Constants::QUEUE_EMAILS) :dispatch(Sjob):SmessageIds[] = $messageId;return Smessagelds:public function getHistory(GooqleGmail Sservice): arravf...?protected function setHistorvPoint(string Stopic. int ShistoryPoint): Carbonf...}public function getService(string Smailbox): GoogleGmailSclient = new \Google_Client:Scilient->useAnniicationdefau tcredentialcolSclient->addScone (GonaleGmai]• • GMATI MONTEY) •Sclient->cetAccecsTvne('nffline')•Sclient->ce+Suhiect(Smailhox)•netunn new GooaleGmail(Sclient):hl"suppont Dally• In ih om100% L2• Wed 13 May 13:54:32AskJiminnyReportActivityServiceTest v= custom.loglaravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]cascadeA console [STAGING]63€ Trial Owner Role SeleSMS Failure Email Inve+0 ..Tx: Auto vSo jiminnyExpected FlowJOIN calendars c ON c.user_id = v.id AND c.status = 'active' AND c.calendar_provider_id LIfmLEFT JOIN team domains td4041440 X.04 A1. Inbound SMS → Email Notification (First Email Scott Received)ON to.team 1d = t.idAND td.deleted_at IS NULLAND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER RY + name, calendan domain:select * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.tean id = 880:select * from activities where id = 74049485; # team 563 crm 53%select * from activities where id = 73272382: # team 563 crm 537select * from activities where id = 64400389: # team 563 crm 537select * from activities where id = 58081273: # team 563 crm 537select * from activities where id = 54520297: # team 563 crm 53'%select * from participants where activity id = 58081273:select * from activities where crm confiquration id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where erm confiquration id = 537 and id = 19003658:select * from automated report results where id = 1976:select * from automated_reports where id = 583;select * From activity searches where 1d = 87114:select * from activity search filtens where activity search id = 87714:SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidon uuid to bin '47842446-af51-4bch-854f-cc65602901019) = uuid:SELECT * FROM crm_configurations WHERE provider = 'hubspot' :select * from rate_limits;select * from automated report results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated reports where id = 54:SELECT * FROM users WHERE id IN (24623,29443,29613):• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)•Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)SELECT * FROM automated report_results WHERE uuid to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid›select * from text relavs where created at > 2026-05-01'• Scott replies to the email notification•EmailTextRelay job processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message body not emptyMessage body not too large (s1600 characters via Smsmessage rule)• vallidation basses;• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDvalidation tails.TextRelayException thrown with reason codeFailure email sent (SmsRelayFailed) < This is the second email Scott received• TextRelav status = FAILEDScotr's Soecitic caseThe cecond email chowe.• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)• Code: 2000 (matches REASON CODE MESSAGE BODY TOO LARGE constant)Root Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The Smssage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bua I IdentifiedThe failure email loaic ic flawed hecnuca.• It's sent when the entire iob fails. not snecificallv when the SMS fails to sendi•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent)• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failed)The failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeedediShow me more code around it. What is the trigger. I want to see the whole flow so i can replicate it locallyhought for isAsk anvthina (84L)« Code SWF-1.6O0 1.WN Windsurf Teame10•25 UTF.8io 4 spaces...
|
NULL
|
-3111569598235280729
|
NULL
|
click
|
ocr
|
NULL
|
PhostormINavigarecodeFV faVsco.jsProiectC) SvncBat PhostormINavigarecodeFV faVsco.jsProiectC) SvncBatchRedisSeTraitsc Baseclient.onp© BaseService.phpo countrycoderesoiver.© CrmActivityProviderint© CrmActivityService.ph© CrmConfigurationSettic crmobiectskesolver.oc) DeraultProspectsearcc) cmallhelper.phge rinosProspecuinienacc) Lavourmanader.ono@ MatchDomainByEmaillC) OpportunitvActivityMa1 OpportunitvSvncStrate(C) Prosoect SearchScone(1) ProspectSearchStrate•) ProviderRedistrv.oho.C RecordSelector.ohoT ResolveComnanvNam(c) TimePerioditerator nhrm imnorKiockm Mail)MActioncaffinoM PenositoriesM Docalvord>C TraitsC Validators(e) RatchCriteria.phoTextkelayservice.pnp* BatchCriterialnterface1L001© BatchService.php102® BatchServicelnterface. 110©EmailActivityService.pl 1ndEmailActivityServiceln1 112C) EmailMessage.ohoEmailMessagelnterfaci [EMAIL]@ InboxServicelnterface. 11%© InternetMessagelnterf: 11-© MailChannelService.pr11g© TextRelayService.php1M MeptinaGeneratoh Notification© MailboxController.phpsms-relay-failed.blade.phpsynce. arraySservice = $this->getService($mailbox);smessageniscory = schis->gechiscorysservicesmessacelas = urforeach Smessagehistory as shistories) «Smessages = shistories->messagesadded*foreach Smessages as Smessage) *Smessagelld = smessage->message»>1d*SrelayedText = TextRelay: :where('email_provider_id', $messageld)->first();if SrelavedText za= nulb *SrelavedText = TextRelav:.crentedl= TextRelav: •PROVIDER GSUITE.I'email_provider_id' => $messageld,statust => TeytRelav. • STATIIS PROCESSTNGSjob = (new EmailTextRelay(SmessageId, SrelayedText))->onQueue(Constants::QUEUE_EMAILS) :dispatch(Sjob):SmessageIds[] = $messageId;return Smessagelds:public function getHistory(GooqleGmail Sservice): arravf...?protected function setHistorvPoint(string Stopic. int ShistoryPoint): Carbonf...}public function getService(string Smailbox): GoogleGmailSclient = new \Google_Client:Scilient->useAnniicationdefau tcredentialcolSclient->addScone (GonaleGmai]• • GMATI MONTEY) •Sclient->cetAccecsTvne('nffline')•Sclient->ce+Suhiect(Smailhox)•netunn new GooaleGmail(Sclient):hl"suppont Dally• In ih om100% L2• Wed 13 May 13:54:32AskJiminnyReportActivityServiceTest v= custom.loglaravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]cascadeA console [STAGING]63€ Trial Owner Role SeleSMS Failure Email Inve+0 ..Tx: Auto vSo jiminnyExpected FlowJOIN calendars c ON c.user_id = v.id AND c.status = 'active' AND c.calendar_provider_id LIfmLEFT JOIN team domains td4041440 X.04 A1. Inbound SMS → Email Notification (First Email Scott Received)ON to.team 1d = t.idAND td.deleted_at IS NULLAND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER RY + name, calendan domain:select * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.tean id = 880:select * from activities where id = 74049485; # team 563 crm 53%select * from activities where id = 73272382: # team 563 crm 537select * from activities where id = 64400389: # team 563 crm 537select * from activities where id = 58081273: # team 563 crm 537select * from activities where id = 54520297: # team 563 crm 53'%select * from participants where activity id = 58081273:select * from activities where crm confiquration id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where erm confiquration id = 537 and id = 19003658:select * from automated report results where id = 1976:select * from automated_reports where id = 583;select * From activity searches where 1d = 87114:select * from activity search filtens where activity search id = 87714:SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidon uuid to bin '47842446-af51-4bch-854f-cc65602901019) = uuid:SELECT * FROM crm_configurations WHERE provider = 'hubspot' :select * from rate_limits;select * from automated report results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated reports where id = 54:SELECT * FROM users WHERE id IN (24623,29443,29613):• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)•Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)SELECT * FROM automated report_results WHERE uuid to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid›select * from text relavs where created at > 2026-05-01'• Scott replies to the email notification•EmailTextRelay job processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message body not emptyMessage body not too large (s1600 characters via Smsmessage rule)• vallidation basses;• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDvalidation tails.TextRelayException thrown with reason codeFailure email sent (SmsRelayFailed) < This is the second email Scott received• TextRelav status = FAILEDScotr's Soecitic caseThe cecond email chowe.• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)• Code: 2000 (matches REASON CODE MESSAGE BODY TOO LARGE constant)Root Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The Smssage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bua I IdentifiedThe failure email loaic ic flawed hecnuca.• It's sent when the entire iob fails. not snecificallv when the SMS fails to sendi•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent)• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failed)The failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeedediShow me more code around it. What is the trigger. I want to see the whole flow so i can replicate it locallyhought for isAsk anvthina (84L)« Code SWF-1.6O0 1.WN Windsurf Teame10•25 UTF.8io 4 spaces...
|
34107
|
NULL
|
NULL
|
NULL
|
|
34112
|
1283
|
53
|
2026-05-13T10:54:36.747726+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669676747_m1.jpg...
|
PhpStorm
|
faVsco.js – TextMessagingService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/12","depth":4,"on_screen":true,"role_description":"text"}]...
|
4692237979246312459
|
-8249180261314221628
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12
FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 6 mA100% C8• Wed 13 May13:54:36PROD (ssh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:APP (-zsh)"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ПГRmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34113
|
1284
|
46
|
2026-05-13T10:54:36.804489+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669676804_m2.jpg...
|
PhpStorm
|
faVsco.js – TextMessagingService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
2071313998401604616
|
-8249180122122160186
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
PhostormINavigarecodeFV faVsco.jsProledeyC) SvncBatchRedisSeTextkelayservice.ongTraitsc Baseclient.onp© BaseService.phpo countrycoderesoiver.© CrmActivityProviderInt© CrmActivityService.ph© CrmConfigurationSetti© CrmObjectsResolver.p© DefaultProspectSearct 188c) cmallhelper.png@ FindsProspectinterfacc) Lavourmanader.ono© MatchDomainBvEmailli 192C) OpportunitvActivityMa@ OpportunitvSvncStrate 474(C) Prosoect SearchScone(1) ProspectSearchStrateC) ProviderRedistrv.ohoC RecordSelector.ohoT ResolveComnanvNam(c) TimePerioditerator nhrm imnorD Kioskm Mail207)MActioncaffino209D RepositoriesM Docalvord211>C TraitsM Validators213(e) RatchCriteria.pho* BatchCriterialnterface215c)BatchService.php* BatchServicelnterface@ EmailActivitvService.ol 218@ EmailActivitvServicelnt 219C) EmailMessage.ohoEmailMessagelnterfac@.InboyService.php1) InboxServicelnterface© InternetMessageinterf: 248(c) Mailchanne Service oi© TextRelayService.php1M MeptinaGeneratoNotification© MailboxController.phpsms-relay-failed.blade.php© TextMessagingService.php X~/iiminnvlaoo/aoo/.obs/Mailbox/EmailTextRelav.onoTunccIon DULLOACuIVIcy1t . Sactivity 1nstanceot Activitythrow new Loq1cException'Activ1ty model expected'o:Create two particivants to store the sender/receiver of the message..SuserParticipant = Sactivitv->participants()->create(П'user id'= Suser->id.= Suser->emaiu= Suser->name"nhone numbent => Susen->softnhone numher.SnrosnectPanticinant = Cactivitv->nanticinantc@->cnpatefl"ead id!=> Sactivity->lead_id ?? null=> Sactivity->contact_id ?? null,=> mb_strimwidth(Sactivity->prospect_name, 0, 100),'phone_number' => $type === Activity::TYPE_SMS_OUTBOUND ? $to : $from,I Refresh the model to fetch participants we just created so they'll be pushed to ESSactivity->refreshO:|| Depending on the message direction, setup the from/toSactivity->from_participant id = Stype === Activity:: TYPE_SMS_OUTBOUNDsuserparticipant->1d*SorospectPartzczoant->10:Sactivity->to participant id = Stype === Activity::TYPE SMS OUTBOUND?$prospectParticipant->id*SuserParticivant->id.Sactivitv->saveo:neturn Sactivity. €658660public function convertCustomerToCountryCode(User Suser, string $customerId, ?string SobjectType): stringi 661662663private function getActivityType(User Suser, string $type): ?PlaybookCategory{...}665666 гhl"suppont Dally • In ih om100% L2• Wed 13 May 13:54:36AskJiminnyReportActivityServiceTest v= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]cascadeA console [STAGING]Trial Owner Role SeleSMS Failure Email Inve+0 ..Tx: Auto vSo jiminnyExpected FlowJOIN calendars c ON c.user_id = v.id AND c.status = 'active' AND c.calendar_provider_id LIMmLEFT JOIN team domains to4041440 X.04 A1. Inbound SMS → Email Notification (First Email Scott Received)ON to.team 1d = t.idAND to.deleted at IS NULUAND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER RY + name, calendan domain:select * from users u join calendars c 1<->1.n: on c.user_id = u.idMhere .team id = 882:select * from activities where id = 74049485; # team 563 crm 537select * from activities where id = 73272382: # team 563 crm 537select * from activities where id = 64400389: # team 563 crm 537select * from activities where id = 58081273: # team 563 crm 537select * from activities where id = 54520297: # team 563 crm 53'%select * trom participants where accivity 10 = 580812/51select * from activities where crm confiquration id = 537 and provider = 'aircall'and account id = 19003658 order by updated at desc:select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where erm confiquration 1d = 537 and 1d = 19003658:select * from automated report results where 1d = 1976:select * from automated_reports where id = 583;select * From activity searches where 1d = 87714:select * from activity_search_filters where activity_search_id = 87714;SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidon uuid to bin 47842446-af51-4bch-854f-cc65602901010) = uuideSELECT * FROM crm_configurations WHERE provider = 'hubspot';select * from rate_limits;select * from automated report results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated reports where id = 54:SELECT * FROM users WHERE id IN (24623,29443,29613):• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)•Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)SELECT * FROM automated_ report_results WHERE uuid to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid›select * from text relavs where created at > '2026-05-01'•• Scott replies to the email notification•EmailTextRelay job processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message body not emptyMessage body not too large (s1600 characters via Smsmessage rule)• vallidation basses;• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDvalidation tails.TextRelayException thrown with reason codeFailure email sent (SmsRelayFailed) < This is the second email Scott received• TextRelav status = FAILEDScotr's Soecitic caseThe cecond email chowe.• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)• Code: 2000 (matches REASON CODE MESSAGE BODY TOO LARGE constant)Root Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The Smssage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bua I IdentifiedThe failure email loaic ic flawed hecnuca.• It's sent when the entire iob fails. not snecificallv when the SMS fails to sendi•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent)• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failed)The failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeedediShow me more code around it. What is the trigger. I want to see the whole flow so i can replicate it locallyhought for isAsk anvthina (84L)« Code SWF-1.6O0 1.WN Windsurf Teamc80-18 UTF.8Po 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34114
|
1283
|
54
|
2026-05-13T10:54:38.928709+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669678928_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-7484207053786149660
|
-8322363755795863100
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh)DOCKER$81DEV (docker)₴8211DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:--max-ba"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ERmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > '/proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan'mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch> 0lihlSupport Daily • in 1h 6 mA*3-zshPROD (ssh)'do-release-upgrade' to upgrade to it.84100% C8• Wed 13 May 13:54:38181screenpipe"О 85PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
34112
|
NULL
|
NULL
|
NULL
|
|
34115
|
1283
|
55
|
2026-05-13T10:54:41.934618+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669681934_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
8043719072324535154
|
-8628527368849355612
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
FinderFileEditViewGoWindo Project: faVsco.js, menu
FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 6 mA100% C8• Wed 13 May 13:54:41PROD (ssh)APP (-zsh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ПГRmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34116
|
1283
|
56
|
2026-05-13T10:54:52.842799+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669692842_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
6574685655485917971
|
-2331696013057992603
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
34115
|
NULL
|
NULL
|
NULL
|
|
34117
|
1284
|
47
|
2026-05-13T10:54:52.809925+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669692809_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4047408223668449518
|
-8636777727364969024
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
PhostormProledeyINavigarecodeLaravelWindowFV faVsco.js°9 master k"suppont Dally• In ih om100% S2• Wed 13 May 13:54:52AskJiminnyReportActivityServiceTest v© MailboxController.phpg createlnoox.onp© TextRelayService.phgcmalllextkelay.onpxsms-relay-failed.blade.php© DeleteEmailMessages.cmalllextkelay.onpc Processtmalsoneras_ MeeuinabouC MiddlewareTextRelayExceptionclass EmailTextRelay extends Job implements ShouldQueuepublic function handle(TextMessagingService SmessagingService, TextRelayService SrelayService): voidsmessagzngservice->secleamsuser-zceaug= custom.log=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]D69.+0 ..A29 V1 ^ v 629626627Tx: AutovSo jiminnyJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIM-m040 A1 A40 V 64 ^LEFT JOIN team domains tdON to.team 1d = t.idAND to.deleted at IS NULUAND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER BY +.name. calendan domarin:w Telephony0 Userc) ChangeEmailJob.ohpDeactivateUserJob.ph(C) SetuoDefaultSavedSe:©SvncTolntercom.oho© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.p© Job.phpc.lobdisoatcher.onp© JobDispatcherInterface.p© PurgeSoftDeletedOpportiT SqsVisibilityControl.phpv C Listenersv @ Activitiesv @ ActivityProvider> D JustCall|v D UserPilotc) TrackProviderin>C Audic> MBotsv CoachingIntercomv Planhat(C) CreateActivitvlc© CreateCoaching© CreateCoaching© CreateCoaching© CreateCoaching(C) CreateCommeni(C) CreateManaderd© CreatePlayedEvi(C) CreateSelfCoaci(e) CrantoCharodEy•MllcorDilot(e) Cronto Avnilabilitunhl(e) CronteConchingSoclSmessage = $messagingService->send(Schis->co,Sthis->textE652=633Sactavity = SmessaqinqService->ou1ldActavitv-635636type: Activity:: TYPE SMS OUTBOUND.637638Suser->softphone number.63864€Sthis->text.— 641customerld:Sthis->activitvirigin->orosoect?Sthis->activitviriain->orospect->crm_provider id•A4 642strtolower(Sthis->activitvdrigin->orosnect tvne).643Sthic-stey+Relav-sundated1'origin_activity_id' => $this->activity0rigin->id,acurvily-ld => pacuevilyasun=> TextRelay::STATUS_PROCESSED,D:} catch (TextRetion $e) {Cthic-dtov+Polaw-sundotocf'status' => TextRelay::STATUS_FAILED'code' => Se->getCodeO.Ssender = Sthis->parseSender(Sheaders[ 'From']) :I| If we can pull the sender, tell them that it failed.if (Ssender) {Sresponden = (new SmsRelavFailed(Sthis->textRelav. Se->qetMessage(). Se->aetCode@))|e: Constants::QUEUE_EMAILS):Mail: :to(Ssender)->queue(Sresponder):1647-164649— 65€—651= 653653= 654655— 65€— 657658_659— 661_ 662663665666 Vselect * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.team_id = 882;select * from activities where id = 74049485; # team 563 crm 53%select * from activities where id = 73272382: # team 563 crm 537select * from activities where id = 64400389: # team 563 crm 537select * from activities where id = 58081273: # team 563 crm 537select * from activities where id = 54520297: # team 563 crm 53'%select * from participants where activity id = 58081273:select * from activities where crm confiquration id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where erm confiquration 1d = 537 and 1d = 19003658:select * from automated_report_results where 1d = 1976;select * From automated renonts where 1d = 5855select * From activity searches where 1d = 87114:select * from activity_search_filters where activity_search_id = 87714;SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidon uuid to bin '47842446-af51-4bch-854f-cc65602901019) = uuid:SELECT * FROM crm_configurations WHERE provider = 'hubspot':select * from rate_limits;select * from automated report results where media type = 'pdf' and status = 2and id IN (18, 1872):select * from automated reports where id = 54:SELECT * FROM users WHERE id IN (24623,29443,29613):cascadeTrial Owner Role SeleSMS Failure Email InveExpected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)•Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification•EmailTextRelay job processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message body not emptyMessage body not too large (s1600 characters via Smsmessage rule)• vallidation basses;• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDvalidation tails.TextRelayException thrown with reason codeFailure email sent (SmsRelayFailed) < This is the second email Scott received• TextRelav status = FAILEDSELECT * FROM automated_ report_results WHERE uuid to bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuidselect * from text relavs where created at > '2026-05-01'•*catch Excention Se) &Sthis->textRelav->undatedir' hac heon rectored Il Pollback II Confiaure (todav 12-27)Scotr's Soecitic caseThe cecond email chowe.• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)• Code: 2000 (matches REASON CODE MESSAGE BODY TOO LARGE constant)Root Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The Smssage validation rule in Ema1lTextRelay:: checkIntegrityo reiected it, triggering the tailure emailiThe Bua I IdentifiedThe failure email loaic ic flawed hecnuca.• It's sent when the entire iob fails. not snecificallv when the SMS fails to sendi•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent)• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failed))The failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeedediShow me more code around it. What is the trigger. I want to see the whole flow so i can replicate it locallyhought for isAsk anvthina (84L)« Code SWF-1.6O0 1.WN Windsurf Teams102-201UTE.8Po 4 spaces...
|
34113
|
NULL
|
NULL
|
NULL
|
|
34118
|
1283
|
57
|
2026-05-13T10:54:57.023001+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669697023_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01';","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-6213634802821743320
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01';
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34119
|
1284
|
48
|
2026-05-13T10:54:57.252544+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669697252_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"bounds":{"left":0.3723404,"top":0.15881884,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.38464096,"top":0.15881884,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.39361703,"top":0.15722266,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-1534628582262974032
|
-8249180124278043710
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
PhostormProledeycodeFV faVsco.js"suppont Dally • In ih omAskJiminnyReportActivityServiceTest v100% S2• Wed 13 May 13:54:56© MailboxController.phpg createlnoox.onp© TextRelayService.phgsms-relay-failed.blade.phpA console [STAGING]© DeleteEmailMessages.Emalllextkelay.onpc ProcesstmalsonerasTextRelayExceptionclass EmailTextRelay extends Job implements ShouldQueueA29 V1 ^ v 629_MeeuinobouC Middlewarepublic function handle(TextMessagingService SmessagingService, TextRelayService SrelayService): void626Streamina627'sender' => Str::limit($headers['From']end:"')D Team"reciolent => scr..u1m1csneaders10'nImit 171.end:"'),w Telephony0 Userc) ChangeEmailJob.ohpSth1s->checkIntear1tySpavload)sP DeactivateUserJob.ph 104© DeletescheduledUser/ 105Suser = Sthis->actzvitv0r1q1n->user:© SetupDefaultSavedSe: 104RAARERRCSvncTolntercom.ohv// Create the activity and send the sMs.© SyncToPlanhat.php637© SyncToUserPilot.php© BaseProcessingJob.php638Smessage = SmessaginaService->sendd(c) Dummv.loh.nhn639Suser© ImportRecallAlRecordings 112640Sthis->to,© ImportRemoteTrackJob.p 113Sthic-Steyh© Job.phpc).lobDispatcher.onp© JobDispatcherinterface.p 1/Sactivity = $messagingService->buildActivity(© PurgeSoftDeletedOpportu 117Smessage->sid.T SqsVisibilityControl.phptype: Activity::TYPE_SMS_OUTBOUND,v C ListenersSuserv @ ActivitiesCucen->softphonenumber,v @ ActivityProviderТЕРНІ647648- 649> D JustCall|v D UserPilot© Trackproviderin: 124> C Audicstrtolower(sth1s->actzv1ty0r1q1n->prospect type)Wruleadletnttti> MBotsv CoachingIntercomv Planhat© CreateActivityLc 136© CreateCoaching 130onionn activitv 1o => sthis-›actvitvirio1n->10l'activity id' => Sactivity->idi=> TextRelav:: STATUS PROCESSED.I© CreateCoaching 13%© CreateCoaching 13:© CreateCoaching 134© CreateComment 1z5© CreateManager( 1z/} catch (TextfavExcentior $e) {Sthis->textRelav->uodate(П"status! => TextRelav. • STATIIS SATISNI"codel => Se->aetChde0.© CreatePlayedEvi 13*=654655—A5A-657ASS-659666-661_ 662663664665666 г© CreateSelfCoact 1z9© CreateSharedEv 1z0$sender = $this->parseSender(Sheaders['From']):•MllcorDilot© CreateAvailabilityNi© CreateCoachingFee 11/I If we can pull the sender, tell them that it failed.if ($sender) {A SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]+0 ..So jiminnyJOIN calendars c ON c.user id = u.id AND c.status = 'active' AND c.calendar_provider_1d LIMm040 A1 A40 V 64 ^LEFT JOIN team domains tdON td. team id = t.idAND td.deleted_at IS NULLAND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER RY + name, calendan domainiselect * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.team_id = 882;select * from activities where id = 74049485; # team 563 crm 53select * from activities where id = 73272382: # team 563 crm 537colort + Enom antivitioc whono id = L4LAAZQO. # +oam 54Z enm 537)select * from activities where id = 58081273: # team 563 crm 537select * from activities where id = 54520297: # team 563 crm 53'%select * from participants where activity id = 58081273:select * from activities where crm_configuration_id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where crm confiquration id = 537 and id = 19003658:select * from automated report results where id = 1976:ated_reports where id = 583;select * From activitv searches where 1d = 87114:SELECT * FROM activities WHERE uvid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidon uuid to bin('47842446-af51-4bch-854f-cc6560290101') = uuid:SFLECT * FROM cem confiqurations WHERE provider = 'hubspot':select * from rate_limits;and id IN (18, 1872):select * from automated reports where id = 54:CCICAT & CO0M nGonG WHEDE Ad TA (04407 20117 20417)4cascadeTrial Owner Role SeleSMS Failure Email InveExpected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)•Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification•EmailTextRelay job processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message body not emptyMessage body not too large (s1600 characters via Smsmessage rule)• vallidation basses;• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDvalidation tails.TextRelayException thrown with reason codeFailure email sent (SmsRelayFailed) < This is the second email Scott received• TextRelav status = FAILEDSELECT * FROM automated report_results WHERE uuid to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid›select * from text relavs where created at > 2026-05-01'Scotr's Soecitic caseThe cecond email chowe.• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)• Code: 2000 (matches REASON CODE MESSAGE BODY TOO LARGE constant)Root Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The Smssage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bua I IdentifiedThe failure email loaic ic flawed hecnuca.• It's sent when the entire iob fails. not soecificallv when the SMS fails to sendi•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent)• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failed)The failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeedediShow me more code around it. What is the trigger. I want to see the whole flow so i can replicate it locallyhought for isAsk anvthina (84L)« Code SWF-1.6O0 1.WN Windsurf Teams126-25UTE.8io 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34120
|
1283
|
58
|
2026-05-13T10:55:00.059599+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669700059_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-2325747045127793127
|
-8240172924586971708
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 6 mA100% C8• Wed 13 May 13:54:59• 0PROD (ssh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=15• ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan"schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:APP (-zsh)--max-ba"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ERmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]docker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|Y4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys00185PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
34118
|
NULL
|
NULL
|
NULL
|
|
34121
|
1283
|
59
|
2026-05-13T10:55:03.131203+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669703131_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
8043719072324535154
|
-8628527368849355612
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
FinderFileEditViewGoWindo Project: faVsco.js, menu
FinderFileEditViewGoWindowHelp> 0Support Daily • in 1h 5 mA100% C8• Wed 13 May13:55:02PROD (ssh)181DOCKER181DEV (docker)₴82DOCKER (docker-compose)docker_lamp_1tches=151 ('/usr/local/bin/php' 'artisan''/proc/1/fd/1'mailbox:batch:retry-failed'/usr/local/bin/php''artisan'schedule: finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null'docker_lamp_1docker_lamp_1run_artisan_schedule:APP (-zsh)"framewodocker_lamp_12026-05-13 10:54:06 Running ['artisan'ПГRmeeting-bot:schedule-bot]docker_lamp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accounts]2s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:13 Running ['artisan'mailbox:skip-lists:refresh]2S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan"mailbox:skip-lists:refresh › '/proc/2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan'mailbox:batch:process --max-batches=15]2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:18 Running ['artisan'conference:monitor:count] …1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' conference:monitor:count › '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch-zsh84screenpipe"PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny|$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XIT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34122
|
1284
|
49
|
2026-05-13T10:55:03.094353+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669703094_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormFV faVsco.js~ProjectVIewINavigareCodeLarav PhostormFV faVsco.js~ProjectVIewINavigareCodeLaravelKeractorWindow?9 master kg createlnoox.onpDeleteEmailMessages.Emalllextkelay.onpc Processtmalsoneras© TextRelayService.phpcmalllextkelay.onpxTextRelayExceptionTL Y:_ Meeuinabou207Streaminaw TelephonyDUserc) ChangeEmailJob.ohp© DeactivateUserJob.ph 230(C) SetuoDefaultSavedSe:©SvncTolntercom.oho© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.p 247© Job.php@ JobDispatcher.phpJobDispatcherInterface.p 250© PurgeSoftDeletedOpportt 2510 SqsVisibilityControl.phpv C Listeners~ Activities~ D ActivityProvider>D JustCall~ D UserPilotC) TrackProviderin: 258> D Audio> MBotsv@ CoachingIntercomv Planhat(C) CreateActivitvlc 264© CreateCoaching 265(C) Createcoaching 261© CreateCoaching 267© CreateCoaching 268© CreateComment 269(C) CreateManadert 276© CreatePlayedEvi 271(C) CreateSelfCoact 272(e) CrantoCharodEy 273•MllcorDilot© CreateAvailabilityNi 275(e) CronteConchinaSoc 274issing function's return type declarationclass EmailTextRelay extends Job implements ShouldQueue* @throws JExceptionprivate function parseRecipient(string $recipient): stringt...* achrows exceptzonprivate function parseRecipientIntoEntities(string Srecipient): arrayf..* achrowsExcention1 usadeprivate function kheckIntegrity(GoogleGmaiZ\MessagePart $payload)Sheaders = $this->getHeaders($payload->getHeaders());$body = $this->getBody($payload->getParts());// Parse the email body and check it can actually be sent.Semail = (new EmailParser()) ->parse($body);Stext = Semail->getVisibleText();if ($text ===throw new TextRelayExceptionC'Message body is un-readable or empty.',code: self::REASON_CODE_MESSAGE_BODY_EMPTY$validator = Validator: :make(['data' »> $text], ['data' => new SmsMessage()]);it Svalidator->fa1lsopthrow new TextRelayException('Message body is too large to send as an SMS.'.code: self: :REASON_CODE_MESSAGE_BODY_TOO_LARGESthis->text = Stext:Scenden = Sthis-snanceSendenCheadencf:From1b// Extract the Liminny recipient.Snecinient = eynlode( senarator'@', Sthis->parseRecipient(Sheaders['To'D):© MailboxController.php# sms-relay-failed.blade.phpE custom.logA console [STAGING]E laravel.logA SF jiminny@localhost]A HS_Jocal [jiminny@localhost]A console (PROD] X A console [EU]624A29 X1 A v 625ДЕДЦЦЦЦ630632-635636637638639-640—641642643644645- 646=648- 649-650_651Iei11: 653—661-662663Tx: Autovdajiminny ~JUIN caLendars C UN c.user_1d = U.1d AND c.status = 'active' AND c.caLendar_provider_1d Litm040 A1 A40 V 64 ~LEFT JOIN team_domains tdUN td.team 1d = t.10AND td.deleted_at IS NULLAND td.domain = LOWER(SUBSTRING_LNDEX(c.caLendar_provider_1d, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER BY t.name..calendar domain:select * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.team_id = 882;select * from activities where id = 74049485; # team 563 crm 537select * from activities where id = 73272382; # team 563 crm 537select * from activities where id = 64400389; # team 563 crm 537select * from activities where id = 58081273; # team 563 crm 537select * from activities where id = 54520297; # team 563 crm 537select * from participants where activity_id = 58081273;select * from activities where crm_configuration_id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where crm_configuration_id = 537 and id = 19003658;select * from automated_report_results where id = 1976;select * tromautomated_reports where id = 583;select * trom activity searches where 1d = 8/141select * from activity search filters where activity search 1d = 877141SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidor uuid to bin47842446-af51-40ch-854f-cc6560290101' = uuid:SELECT * FROM crm_configurations WHERE provider = 'hubspot':select * from rate_limits;select * from automated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54;CEL CCT + SP0M uconc WHEPE id TM (24427 20447 2041794SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;665666vselect * from text_relays where created_at > '2026-05-01';"suppon Dally • In 1h om100% S28• Wed 13 May 13:55:02U AskJiminnyReportActivityServiceTest~CascadeTrial Owner Role SeleSMS Failure Email InveExpected Flow1. Inbound SMS - Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)+0 ..• Scott replies to the email notification• EmailTextRelay job processes the emailEmailParser extracts visible text from the email body• Validation checks (in checkIntegrity()):• Message body not empty• Message body not too large (≤1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to original sende• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDTextRelayExcept ion thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLEDScott's Specitic caseThe second email shows:• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)Code: 2000 matches REASON CODE MESSAGE BODY TOO LARGE constantRoot Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The SmsMessage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bug I IdentifiedThe failure email logic is flawed because:•It's sent when the entire job fails, not specifically when the SMS fails to send•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failediThe failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeededi6ul ..Show me more code around it. What is the trigger. I want to see the whole flow so I can replicate it locallyhought for 1sAsk anvthina (84L)SWE-16WN Windsurf Toams 247-22UTF-8f?4 spaces...
|
NULL
|
-3558600310600750828
|
NULL
|
click
|
ocr
|
NULL
|
PhostormFV faVsco.js~ProjectVIewINavigareCodeLarav PhostormFV faVsco.js~ProjectVIewINavigareCodeLaravelKeractorWindow?9 master kg createlnoox.onpDeleteEmailMessages.Emalllextkelay.onpc Processtmalsoneras© TextRelayService.phpcmalllextkelay.onpxTextRelayExceptionTL Y:_ Meeuinabou207Streaminaw TelephonyDUserc) ChangeEmailJob.ohp© DeactivateUserJob.ph 230(C) SetuoDefaultSavedSe:©SvncTolntercom.oho© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.p 247© Job.php@ JobDispatcher.phpJobDispatcherInterface.p 250© PurgeSoftDeletedOpportt 2510 SqsVisibilityControl.phpv C Listeners~ Activities~ D ActivityProvider>D JustCall~ D UserPilotC) TrackProviderin: 258> D Audio> MBotsv@ CoachingIntercomv Planhat(C) CreateActivitvlc 264© CreateCoaching 265(C) Createcoaching 261© CreateCoaching 267© CreateCoaching 268© CreateComment 269(C) CreateManadert 276© CreatePlayedEvi 271(C) CreateSelfCoact 272(e) CrantoCharodEy 273•MllcorDilot© CreateAvailabilityNi 275(e) CronteConchinaSoc 274issing function's return type declarationclass EmailTextRelay extends Job implements ShouldQueue* @throws JExceptionprivate function parseRecipient(string $recipient): stringt...* achrows exceptzonprivate function parseRecipientIntoEntities(string Srecipient): arrayf..* achrowsExcention1 usadeprivate function kheckIntegrity(GoogleGmaiZ\MessagePart $payload)Sheaders = $this->getHeaders($payload->getHeaders());$body = $this->getBody($payload->getParts());// Parse the email body and check it can actually be sent.Semail = (new EmailParser()) ->parse($body);Stext = Semail->getVisibleText();if ($text ===throw new TextRelayExceptionC'Message body is un-readable or empty.',code: self::REASON_CODE_MESSAGE_BODY_EMPTY$validator = Validator: :make(['data' »> $text], ['data' => new SmsMessage()]);it Svalidator->fa1lsopthrow new TextRelayException('Message body is too large to send as an SMS.'.code: self: :REASON_CODE_MESSAGE_BODY_TOO_LARGESthis->text = Stext:Scenden = Sthis-snanceSendenCheadencf:From1b// Extract the Liminny recipient.Snecinient = eynlode( senarator'@', Sthis->parseRecipient(Sheaders['To'D):© MailboxController.php# sms-relay-failed.blade.phpE custom.logA console [STAGING]E laravel.logA SF jiminny@localhost]A HS_Jocal [jiminny@localhost]A console (PROD] X A console [EU]624A29 X1 A v 625ДЕДЦЦЦЦ630632-635636637638639-640—641642643644645- 646=648- 649-650_651Iei11: 653—661-662663Tx: Autovdajiminny ~JUIN caLendars C UN c.user_1d = U.1d AND c.status = 'active' AND c.caLendar_provider_1d Litm040 A1 A40 V 64 ~LEFT JOIN team_domains tdUN td.team 1d = t.10AND td.deleted_at IS NULLAND td.domain = LOWER(SUBSTRING_LNDEX(c.caLendar_provider_1d, '@', -1))GROUP BY t.id, t.name, calendar_domainORDER BY t.name..calendar domain:select * from users u join calendars c 1<->1.n: on c.user_id = u.idwhere u.team_id = 882;select * from activities where id = 74049485; # team 563 crm 537select * from activities where id = 73272382; # team 563 crm 537select * from activities where id = 64400389; # team 563 crm 537select * from activities where id = 58081273; # team 563 crm 537select * from activities where id = 54520297; # team 563 crm 537select * from participants where activity_id = 58081273;select * from activities where crm_configuration_id = 537 and provider = 'aircall'and account_id = 19003658 order by updated_at desc;select * from contacts where crm_configuration_id = 537 and id = 35957759;select * from accounts where crm_configuration_id = 537 and id = 19003658;select * from automated_report_results where id = 1976;select * tromautomated_reports where id = 583;select * trom activity searches where 1d = 8/141select * from activity search filters where activity search 1d = 877141SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuidor uuid to bin47842446-af51-40ch-854f-cc6560290101' = uuid:SELECT * FROM crm_configurations WHERE provider = 'hubspot':select * from rate_limits;select * from automated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54;CEL CCT + SP0M uconc WHEPE id TM (24427 20447 2041794SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;665666vselect * from text_relays where created_at > '2026-05-01';"suppon Dally • In 1h om100% S28• Wed 13 May 13:55:02U AskJiminnyReportActivityServiceTest~CascadeTrial Owner Role SeleSMS Failure Email InveExpected Flow1. Inbound SMS - Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via email2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)+0 ..• Scott replies to the email notification• EmailTextRelay job processes the emailEmailParser extracts visible text from the email body• Validation checks (in checkIntegrity()):• Message body not empty• Message body not too large (≤1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to original sende• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDTextRelayExcept ion thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLEDScott's Specitic caseThe second email shows:• Reference: fd2f33ba-a7d2-4b00-9355-a63c47011b70 (TextRelay ID)Code: 2000 matches REASON CODE MESSAGE BODY TOO LARGE constantRoot Cause: Scott's email reply (likely including his email signature) exceeded the 1600-character limit for SMSmessages. The SmsMessage validation rule in Ema1lTextRelay:: checkintegrityo reiected it, triggering the failure emailThe Bug I IdentifiedThe failure email logic is flawed because:•It's sent when the entire job fails, not specifically when the SMS fails to send•It SMS is sent successfully but activity creation fails, no failure email is sent (but SMS was already sent• If SMS sendina fails but it's not a TextRelavExcent ion. no failure email is sent (user never knows SMS failediThe failure email should be based on whether the SMS was actually delivered by Twilio, not whether the emailorocessina iob succeededi6ul ..Show me more code around it. What is the trigger. I want to see the whole flow so I can replicate it locallyhought for 1sAsk anvthina (84L)SWE-16WN Windsurf Toams 247-22UTF-8f?4 spaces...
|
34119
|
NULL
|
NULL
|
NULL
|
|
34123
|
1284
|
50
|
2026-05-13T10:55:07.018513+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669707018_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"bounds":{"left":0.3723404,"top":0.15881884,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.38464096,"top":0.15881884,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.39361703,"top":0.15722266,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.40093085,"top":0.15722266,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.40957448,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.41821808,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.42918882,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.43783244,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.44647607,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.4574468,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.46841756,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.4950133,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.50598407,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.7084442,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
4228910382537919106
|
-2331696013057992603
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34124
|
1283
|
60
|
2026-05-13T10:55:09.261668+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669709261_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
FinderFileEditViewGoWindowHelp> 0(alo)Support D FinderFileEditViewGoWindowHelp> 0(alo)Support Daily - in 1h 5 mPROD (ssh)DOCKER181DEV (docker)₴82APP (-zsh)DOCKER (docker-compose)tches=15 › '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan'schedule: finish"framework/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1docker_lamp_1docker_1amp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_11sDONE2026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot]docker_1amp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities] .2s DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountS]2S DONEdocker_lamp_1proc/1/fd/1' 2>&1docker_1amp_1111 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2S DONEdocker_lamp_1'/usr/local/bin/php' 'artisan'mailbox: skip-lists:refresh › '/proc/1/fd/1'2>&1docker_lamp_112026-05-13 10:54:16 Running ['artisan' mailbox:batch:process--max-batches=15]2s DONEdocker_1amp_11• '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:18 Running ['artisan' conference:monitor: count]1sDONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2s DONEdocker_lamp_1/proc/1/fd/1'1 '/usr/local/bin/php' 'artisan' activity:aircall:check-and-renew › '2>81docker_lamp_12026-05-13 10:54:23 Running ['artisan'track:retry-failed-downloads]2s DONEdocker_lamp_1c/1/fd/1'1 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/pro2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1-zshPROD (ssh)Run'do-release-upgrade' to upgrade to it.View in Docker Desktopo View Configw Enable Watch84100% C8• Wed 13 May 13:55:09181ffmpegО 85PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
8032094340917785926
|
NULL
|
click
|
ocr
|
NULL
|
FinderFileEditViewGoWindowHelp> 0(alo)Support D FinderFileEditViewGoWindowHelp> 0(alo)Support Daily - in 1h 5 mPROD (ssh)DOCKER181DEV (docker)₴82APP (-zsh)DOCKER (docker-compose)tches=15 › '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan'schedule: finish"framework/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1docker_lamp_1docker_1amp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_11sDONE2026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot]docker_1amp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities] .2s DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountS]2S DONEdocker_lamp_1proc/1/fd/1' 2>&1docker_1amp_1111 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2S DONEdocker_lamp_1'/usr/local/bin/php' 'artisan'mailbox: skip-lists:refresh › '/proc/1/fd/1'2>&1docker_lamp_112026-05-13 10:54:16 Running ['artisan' mailbox:batch:process--max-batches=15]2s DONEdocker_1amp_11• '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:18 Running ['artisan' conference:monitor: count]1sDONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2s DONEdocker_lamp_1/proc/1/fd/1'1 '/usr/local/bin/php' 'artisan' activity:aircall:check-and-renew › '2>81docker_lamp_12026-05-13 10:54:23 Running ['artisan'track:retry-failed-downloads]2s DONEdocker_lamp_1c/1/fd/1'1 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/pro2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1-zshPROD (ssh)Run'do-release-upgrade' to upgrade to it.View in Docker Desktopo View Configw Enable Watch84100% C8• Wed 13 May 13:55:09181ffmpegО 85PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|T4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
34121
|
NULL
|
NULL
|
NULL
|
|
34125
|
1284
|
51
|
2026-05-13T10:55:09.275400+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669709275_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIeWINavigarecodeLaravelKeractorWindowFV f PhostormVIeWINavigarecodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxM Makefile(C) SmsMessage.pnpJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueueTaraw_sqL_query.sq207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmlusvetur.contig.fsM+ WEBHOOK FILTERING_ IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database Consoles1232V AEU& console EUlADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServices+ocv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 1 s 919 ms# STAGINGA console→, Nockor* Athrows Exceptionprivate function parseRecipient(string Srecipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkintegrity(GoogleGmail \MessagePart $payload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays XHilwid Y(Duuid (UUID with time-low and time-high swapped) Y70412 120/1756-1005-106h-hdL0-61907C12/41032413 d793a23c-c30b-4729-b350-543df817b51d32414 208c13f8-f896-4104-a716-3a8a53/78bcd330415 c6x325ch-1744-4256-ac0e-4F04214dhhh3)32416 a4d7aa2d-8652-4cd1-a526-8705e3621364"suppon Dally • In 1h om100% S2U AskJiminnyReportActivityServiceTest v© MailboxController.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] XA console [EU]cascadesms-relay-failed.blade.phpA console [STAGING]A29 11 ^ v 643І ПОННН 1- 646654655656=657TEMTT659111111email provider YTrial Owner Role SeleSMS Failure Email InveTx: Auto vSo jiminnyExoectedFlowand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)select * trom contacts where crm contiquration 1d = 557 and 1d = 3595/759select * from accounts where crm_configuration id = 537 and id = 19003658:Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMSselect * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714÷select * from activity search filters where activity search 1d = 877141• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailSELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidEmailParser extracts visible text from the email bodyor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;Validation checks (in checkIntegrity()):• Message bodv not emoty.SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:select * from autlated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54;SELECT * FROM users WHERE id IN (24623,29443,29613):• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDIf validation fails.SELECT * FROM automated report results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:TextRelayException thrown with reason codeCailure email sent (SmcPelavSailed) < Thic is the cecond email Scott receivedselect * from text relays where created at > '2026-05-01':TextRelay status = FAlLED«Code SWF-16email provider id Ylemail sent at Ysender Y÷ @•recipient Ygsuite19e1447dea629ed02026-05-10 23:45:10DE ZOETEN Scott <[EMAIL]›Meg Katsiouras <[EMAIL]›asulte19e1728569327bc82026-05-11 13:09:33Kuliit Fowles <[EMAIL]›Campbell Johnston Clark Limited <[EMAIL]›gsuite19e1c2e118add1fc2026-05-12 12:33:48Charles Beatty <[EMAIL] Walker <447480488754.447825393014.anGlxwmo21dtxt.Timinnv.com›gsuite1962027868264h422026-05-13 10:05•08ManioGeoraiev <manio.aeorarevdiiminnv.com›447577084583.447893937879.ARn8d8VARzdtyt.Jiminnv.comgsuite19e2033ed8ea6h102026-05-13 10-18-39Stoyan Tomov <[EMAIL] Georgiev <[EMAIL]>• Wed 13 May 13:55:08+0 ..CSVv!# statusfailedprocessedfailednrocessednrocessedI code YNN Windeurf Toame A66.22 UITC.9Aensod...
|
NULL
|
584029111716986326
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIeWINavigarecodeLaravelKeractorWindowFV f PhostormVIeWINavigarecodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxM Makefile(C) SmsMessage.pnpJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueueTaraw_sqL_query.sq207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmlusvetur.contig.fsM+ WEBHOOK FILTERING_ IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database Consoles1232V AEU& console EUlADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServices+ocv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 1 s 919 ms# STAGINGA console→, Nockor* Athrows Exceptionprivate function parseRecipient(string Srecipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkintegrity(GoogleGmail \MessagePart $payload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays XHilwid Y(Duuid (UUID with time-low and time-high swapped) Y70412 120/1756-1005-106h-hdL0-61907C12/41032413 d793a23c-c30b-4729-b350-543df817b51d32414 208c13f8-f896-4104-a716-3a8a53/78bcd330415 c6x325ch-1744-4256-ac0e-4F04214dhhh3)32416 a4d7aa2d-8652-4cd1-a526-8705e3621364"suppon Dally • In 1h om100% S2U AskJiminnyReportActivityServiceTest v© MailboxController.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] XA console [EU]cascadesms-relay-failed.blade.phpA console [STAGING]A29 11 ^ v 643І ПОННН 1- 646654655656=657TEMTT659111111email provider YTrial Owner Role SeleSMS Failure Email InveTx: Auto vSo jiminnyExoectedFlowand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)select * trom contacts where crm contiquration 1d = 557 and 1d = 3595/759select * from accounts where crm_configuration id = 537 and id = 19003658:Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMSselect * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714÷select * from activity search filters where activity search 1d = 877141• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailSELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidEmailParser extracts visible text from the email bodyor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;Validation checks (in checkIntegrity()):• Message bodv not emoty.SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:select * from autlated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54;SELECT * FROM users WHERE id IN (24623,29443,29613):• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDIf validation fails.SELECT * FROM automated report results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:TextRelayException thrown with reason codeCailure email sent (SmcPelavSailed) < Thic is the cecond email Scott receivedselect * from text relays where created at > '2026-05-01':TextRelay status = FAlLED«Code SWF-16email provider id Ylemail sent at Ysender Y÷ @•recipient Ygsuite19e1447dea629ed02026-05-10 23:45:10DE ZOETEN Scott <[EMAIL]›Meg Katsiouras <[EMAIL]›asulte19e1728569327bc82026-05-11 13:09:33Kuliit Fowles <[EMAIL]›Campbell Johnston Clark Limited <[EMAIL]›gsuite19e1c2e118add1fc2026-05-12 12:33:48Charles Beatty <[EMAIL] Walker <447480488754.447825393014.anGlxwmo21dtxt.Timinnv.com›gsuite1962027868264h422026-05-13 10:05•08ManioGeoraiev <manio.aeorarevdiiminnv.com›447577084583.447893937879.ARn8d8VARzdtyt.Jiminnv.comgsuite19e2033ed8ea6h102026-05-13 10-18-39Stoyan Tomov <[EMAIL] Georgiev <[EMAIL]>• Wed 13 May 13:55:08+0 ..CSVv!# statusfailedprocessedfailednrocessednrocessedI code YNN Windeurf Toame A66.22 UITC.9Aensod...
|
34123
|
NULL
|
NULL
|
NULL
|
|
34126
|
1283
|
61
|
2026-05-13T10:55:11.742032+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669711742_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-7673782238848625796
|
-8646559087753982588
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
FinderFileEd Project: faVsco.js, menu
master, menu
FinderFileEditViewGoWindowHelp> 0(alo)Support Daily - in 1h 5 mPROD (ssh)DOCKER181DEV (docker)₴82APP (-zsh)DOCKER (docker-compose)tches=15 › '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan'schedule: finish"framework/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1docker_1amp_1docker_1amp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_11sDONE2026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot]docker_1amp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:08 Running ['artisan' dialers:monitor-activities] .2s DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountS]2S DONEdocker_lamp_1proc/1/fd/1' 2>&1docker_lamp_1111 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2S DONEdocker_lamp_1t '/usr/local/bin/php' 'artisan'mailbox: skip-lists:refresh › */proc/1/fd/1'2>&1docker_lamp_112026-05-13 10:54:16 Running ['artisan' mailbox:batch:process--max-batches=15]2s DONEdocker_1amp_11• '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_lamp_12026-05-13 10:54:18 Running ['artisan' conference:monitor: count]1sDONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall:check-and-renew]2s DONEdocker_lamp_1/proc/1/fd/1'1 '/usr/local/bin/php' 'artisan' activity:aircall:check-and-renew › '2>81docker_lamp_12026-05-13 10:54:23 Running ['artisan'track:retry-failed-downloads]2s DONEdocker_lamp_1c/1/fd/1'1 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/pro2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1-zshPROD (ssh)Run'do-release-upgrade' to upgrade to it.View in Docker Desktopo View Configw Enable Watch84100% C8• Wed 13 May 13:55:11181ffmpegО 85PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|XIT4STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0T6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34127
|
1284
|
52
|
2026-05-13T10:55:12.624015+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669712624_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4235983745889776938
|
-8204421443435123770
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
PhostormVIeWINavicarecodeLaravelKeractorWindowFV faVsco.js°9 master kroledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxM Makefile(C) SmsMessage.pnpJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueueTaraw_sqL_query.sq207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmlusvetur.contig.fsM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database Consoles1232V AEU& console EUlADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di liminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServices+ocv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 1 s 919 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string Srecipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrows Excention1 usageprivate function checkintegrity(GoogleGmail \MessagePart $payload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays XTy./Hilw5 rowsid Y(Duuid (UUID with time-low and time-high swapped) Y70/12 420/1756-10c5-106h-hd40-61962C12/41032413 d793a23c-c30b-4729-b350-543df817b51d32414 208c13f8-f896-4104-a716-3a8a5378bcd337415 c6x325ch-1744-4256-ac0e-4F04214dhhh3)32416 a4d7aa2d-8652-4cd1-a526-8705e3621364"suppon Dally • In 1h om100% 2• Wed 13 May 13:55:12AskJiminnyReportActivityServiceTest v© MailboxController.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] XA console [EU]cascadesms-relay-failed.blade.phpA console [STAGING]A29 V1 ^ v 643І ПОННН 1- 646654655=657659664email provider YTrial Owner Role SeleSMS Failure Email Inve+0 ..Tx: Auto vSo jiminnyExoected Flowand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)select * trom contacts where crm contiquration 1d = 557 and 1d = 3595/759select * from accounts where crm_configuration id = 537 and id = 19003658:Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMSselect * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714÷select * from activity search filters where activity search 1d = 877141• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailSELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidEmailParser extracts visible text from the email bodyor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;Validation checks (in checkIntegrity()):• Message bodv not emotviSELECT * FROM crm_configurations WHERE provider = 'hubspot':splect * from nate limits.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:select * from autmated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):• SMS sent via Twilio to original sender• Activity created (TYPE_SMS_OUTBOUND)• TextRelay status = PROCESSEDIf validation fails.SELECT * FROM automated report results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:TextRelayException thrown with reason codeCailure email sent (SmcPelavSailed) < Thic is the cecond email Scott receivedselect * from text_relays where created_at > ^2026-05-01:|TextRelay status = FAlLED«Code SWF-16CSVvemail provider id YWemail sent_at YM cender÷ @•recipient Y÷ ! status Y(™ code Vgsuite19e1447dea629ed02026-05-10 23:45:10DE ZOETEN Scott <[EMAIL]›Meg Katsiouras <[EMAIL]›failedasulte19e1728569327bc82026-05-11 13:09:33Kuliit Fowles <[EMAIL]›Campbell Johnston Clark Limited <[EMAIL]›processedgsuite19e1c2e118add1fc2026-05-12 12:33:48Charles Beatty <[EMAIL] Walker <447480488754.447825393014.anGlxwmo21dtxt.Timinnv.com›failedgsuite1962027868264h422026-05-13 10:05•08Mario Georgiev <[EMAIL]›447577084583.447893937879.ARn8d8VARzdtyt.Jiminnv.comnracessedgsuite19e2033ed8ea6h102026-05-13 10:18:39StovanTomov <[EMAIL]›Mario Georgiev <[EMAIL]>nrocessedNN Windeurf ToameGGA.KO LITE-QAensod...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34128
|
1283
|
62
|
2026-05-13T10:55:21.971528+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669721971_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-7429716278976468786
|
-8636355650190325311
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
FinderFileEditViewGoWindowHelp> 0(alo)PROD (ssh)181DEV (docker)₴82APP (-zsh)DOCKERDOCKER (docker-compose)docker_lamp_1docker_lamp_12026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot] ….1S DONEdocker_1amp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot >*/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan'dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountSJ2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:skip-lists:refresh › */proc/1/fd/1'2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan' mailbox:batch:process --max-batches=15]2S DONEdocker_Lamp_1L '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 >*/proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:18 Running ['artisan'conference:monitor:count]1S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall: check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > */proc/1/fd/1'2>&1docker_lamp_12s DONEdocker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]1 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1'2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_12026-05-13 10:55:08 Running ['artisan'meeting-bot:schedule-bot]SS DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' meeting-bot: schedule-bot > */proc/1/fd/1' 2>&1View in Docker Desktopo View Configw Enable WatchSupport Daily - in 1h 5 m-zsh84100% C8• Wed 13 May 13:55:21181ffmpegО 85PROD (ssh)Run 'do-release-upgrade' to upgrade to it.PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
34126
|
NULL
|
NULL
|
NULL
|
|
34129
|
1284
|
53
|
2026-05-13T10:55:21.883116+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669721883_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3088599111841370244
|
-8636775528843997756
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
PhostormVIewINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTVT:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU243& console EUlADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhost#S:A HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X™ Tw•GOODiduuid (UUID)72/1942fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0l1 email_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000Boniain activitv id<nul1>activitv idI created at2026-05-10 23:50:09rawrelmalaadeadabiamhkkmclaweaiiahtthhtdhthlaen© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X#console fEulA console [STAGING]A29 V1 ^ v 643І ПОНН 1648-649654655[657=6661IHHTx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:40 41 440 X.04select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/7595select * trom accounts where crm contiquration 1d = 557 and 1d = 19003658-select * from automated_report_results where 2d = 1976)select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WIERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuildor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:111111666 /select * from text relays where created at > '2026-05-01'and id = 32412:"suppon Dally • In 1h om100% S2• Wed 13 May 13:55:21AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi• Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)•TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email sent (SmcPelavSailed) < Thic is the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CSV yWN Windeurf Toame 6A745 UITC9Aensod...
|
34127
|
NULL
|
NULL
|
NULL
|
|
34130
|
1283
|
63
|
2026-05-13T10:55:23.563270+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669723563_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
6528046453831349223
|
-8213081093941629500
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
FinderFileEditViewGoWindowHelpPROD (ssh)$81DEV (docker)₴82APP (-zsh)DOCKERDOCKER (docker-compose)docker_lamp_1docker_lamp_12026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot] ….1S DONEdocker_1amp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot >*/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan'dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountSJ2S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:skip-lists:refresh › */proc/1/fd/1'2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan' mailbox:batch:process --max-batches=15]2S DONEdocker_Lamp_11 '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 >*/proc/1/fd/1' 2>&1docker_lamp_1 |2026-05-13 10:54:18 Running ['artisan'conference:monitor: count]1S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall: check-and-renew]2S DONEdocker_1amp_111 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1'2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_12026-05-13 10:55:08 Running ['artisan'meeting-bot:schedule-bot]9S DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' meeting-bot: schedule-bot > */proc/1/fd/1' 2>&1View in Docker Desktopo View Configw Enable Watch> 0(alo)Support Daily • in 1h 5 m*3-zshPROD (ssh)Run 'do-release-upgrade' to upgrade to it.84100% C8• Wed 13 May 13:55:23181ffmpegО 85PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X L3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X 4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0T6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34131
|
1283
|
64
|
2026-05-13T10:55:26.567855+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669726567_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-947265983466993404
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
34130
|
NULL
|
NULL
|
NULL
|
|
34132
|
1284
|
54
|
2026-05-13T10:55:25.375782+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669725375_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIeWINavigareCodeLaravelKeractorWindowFV f PhostormVIeWINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTVT:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU243& console EUlADEALRISKS IEUI4D1U)IdEU TEUv diminnv@localhost2474 console fiminnv@localho: 248Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X™ Tw•GOODiduuid (UUID)72/1942fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0l1 email_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000|Boniain activitv id<nul1>activitv idI created at2026-05-10 23:50:09rawrelmalaadeadabiamhkkmclaweaiiahtthhtdhthlaen© MailboxController.phpsms-relay-failed.blade.phpA29 V1 ^ v 643— 646=64— 65654655[657= 050=666LIHІHH664— 665666 v— 66= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X#console fEulA console [STAGING]Tx: Auto vSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/7595select * trom accounts where crm contiquration 1d = 557 and 1d = 19003658-select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WIERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuildor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * from auflated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:Cascade 97Command &select * from text relays where created at > '2026-05-01'and id = 32412:•/D."suppon Dally • In 1h om100% S2• Wed 13 May 13:55:24AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)•TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CsVyWN Windeud TaameUTE.OAensod...
|
NULL
|
-6290102998144562850
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIeWINavigareCodeLaravelKeractorWindowFV f PhostormVIeWINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTVT:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU243& console EUlADEALRISKS IEUI4D1U)IdEU TEUv diminnv@localhost2474 console fiminnv@localho: 248Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X™ Tw•GOODiduuid (UUID)72/1942fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0l1 email_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000|Boniain activitv id<nul1>activitv idI created at2026-05-10 23:50:09rawrelmalaadeadabiamhkkmclaweaiiahtthhtdhthlaen© MailboxController.phpsms-relay-failed.blade.phpA29 V1 ^ v 643— 646=64— 65654655[657= 050=666LIHІHH664— 665666 v— 66= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X#console fEulA console [STAGING]Tx: Auto vSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/7595select * trom accounts where crm contiquration 1d = 557 and 1d = 19003658-select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WIERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuildor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * from auflated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:Cascade 97Command &select * from text relays where created at > '2026-05-01'and id = 32412:•/D."suppon Dally • In 1h om100% S2• Wed 13 May 13:55:24AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)•TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CsVyWN Windeud TaameUTE.OAensod...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34133
|
1283
|
65
|
2026-05-13T10:55:27.460694+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669727460_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"}]...
|
-603380825844335797
|
-8825922624288592958
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
FinderFileEditViewGoWindowHelp> 0(alo)PROD (ssh)181DEV (docker)₴82APP (-zsh)DOCKERDOCKER (docker-compose)docker_lamp_1docker_lamp_12026-05-13 10:54:06 Running ['artisan'meeting-bot:schedule-bot] ….1S DONEdocker_1amp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot >*/proc/1/docker_lamp_12026-05-13 10:54:08 Running ['artisan'dialers:monitor-activities]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:11 Running ['artisan' jiminny:monitor-social-accountSJ2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:13 Running ['artisan' mailbox:skip-lists:refresh]2sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:skip-lists:refresh › */proc/1/fd/1'2>&1docker_1amp_12026-05-13 10:54:16 Running ['artisan' mailbox:batch:process --max-batches=15]2S DONEdocker_Lamp_1L '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 >*/proc/1/fd/1' 2>&1docker_lamp_112026-05-13 10:54:18 Running ['artisan'conference:monitor:count]1S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:monitor: count › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:20 Running ['artisan' activity:aircall: check-and-renew]2S DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' activity:aircall: check-and-renew > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:54:23 Running ['artisan' track:retry-failed-downloads]2s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' track:retry-failed-downloads › '/proc/1/fd/1'2>&1docker_1amp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_lamp_12026-05-13 10:55:08 Running ['artisan'meeting-bot:schedule-bot]SS DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' meeting-bot: schedule-bot > */proc/1/fd/1' 2>&1View in Docker Desktopo View Configw Enable WatchSupport Daily - in 1h 5 m-zsh84100% C8• Wed 13 May 13:55:27181screenpipe"О 85PROD (ssh)Run 'do-release-upgrade' to upgrade to it.PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XT6FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34134
|
1284
|
55
|
2026-05-13T10:55:27.484714+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669727484_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
678177376416212207
|
-8348263816798950460
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
PhostormVIewINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM+ WEBHOOK FILTERING_ IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeaders(Soavload->aetHeadersO0•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X™ T•GOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0lemail_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000¡oniain activitv id@ activity_idenulsI created at© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 11 ^ v 643І ПОННН 1-649654655[657TNHI1-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583*select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 877141SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report results WHERE uuid to bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = vuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppon Dally • In 1h om100% S2• Wed 13 May 13:55:27U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)• TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CSV ySIIM. 20112 141 MI Windeur Taame 666.1/72 chare 1 lind hrosk)UTE.OAensod...
|
34132
|
NULL
|
NULL
|
NULL
|
|
34135
|
1283
|
66
|
2026-05-13T10:55:29.435340+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669729435_m1.jpg...
|
PhpStorm
|
Export Data
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Export preview:
[
{
"id": 32412,
Export preview:
[
{
"id": 32412,
"uuid": "0x42FB40C562A4175CBD68F18E3513461A",
"email_provider": "gsuite",
"email_provider_id": "19e1447dea629ed0",
"email_sent_at": "2026-05-10 23:45:10",
"sender": "DE ZOETEN Scott <[EMAIL]>",
"recipient": "Meg Katsiouras <[EMAIL]>",
"status": "failed",
"code": 2000,
"origin_activity_id": null,
"activity_id": null,
"created_at": "2026-05-10 23:50:09",
"updated_at": "2026-05-10 23:50:09"
}
]
Computed
Add columns:
Generated
Transpose
Add table definition (DDL)
Output file:
/Users/lukas/Documents/jiminny_text_relays.json
Browse… (⇧⏎)...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Export preview:","depth":1,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"[\n {\n \"id\": 32412,\n \"uuid\": \"0x42FB40C562A4175CBD68F18E3513461A\",\n \"email_provider\": \"gsuite\",\n \"email_provider_id\": \"19e1447dea629ed0\",\n \"email_sent_at\": \"2026-05-10 23:45:10\",\n \"sender\": \"DE ZOETEN Scott <Scott.DE-ZOETEN@rewardgateway.com>\",\n \"recipient\": \"Meg Katsiouras <61485019435.64275138300.qnGl95el2l@txt.jiminny.com>\",\n \"status\": \"failed\",\n \"code\": 2000,\n \"origin_activity_id\": null,\n \"activity_id\": null,\n \"created_at\": \"2026-05-10 23:50:09\",\n \"updated_at\": \"2026-05-10 23:50:09\"\n }\n]","depth":2,"on_screen":true,"value":"[\n {\n \"id\": 32412,\n \"uuid\": \"0x42FB40C562A4175CBD68F18E3513461A\",\n \"email_provider\": \"gsuite\",\n \"email_provider_id\": \"19e1447dea629ed0\",\n \"email_sent_at\": \"2026-05-10 23:45:10\",\n \"sender\": \"DE ZOETEN Scott <Scott.DE-ZOETEN@rewardgateway.com>\",\n \"recipient\": \"Meg Katsiouras <61485019435.64275138300.qnGl95el2l@txt.jiminny.com>\",\n \"status\": \"failed\",\n \"code\": 2000,\n \"origin_activity_id\": null,\n \"activity_id\": null,\n \"created_at\": \"2026-05-10 23:50:09\",\n \"updated_at\": \"2026-05-10 23:50:09\"\n }\n]","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Computed","depth":1,"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add columns:","depth":1,"on_screen":false,"role_description":"text"},{"role":"AXCheckBox","text":"Generated","depth":1,"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Transpose","depth":1,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Add table definition (DDL)","depth":1,"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Output file:","depth":1,"on_screen":true,"role_description":"text"},{"role":"AXTextField","text":"/Users/lukas/Documents/jiminny_text_relays.json","depth":1,"on_screen":true,"value":"/Users/lukas/Documents/jiminny_text_relays.json","role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse… (⇧⏎)","depth":2,"bounds":{"left":0.0,"top":0.0,"width":0.013888889,"height":0.022222223},"on_screen":false,"help_text":"Browse… (⇧⏎)","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-2236025997193667134
|
-3232788764523649167
|
click
|
accessibility
|
NULL
|
Export preview:
[
{
"id": 32412,
Export preview:
[
{
"id": 32412,
"uuid": "0x42FB40C562A4175CBD68F18E3513461A",
"email_provider": "gsuite",
"email_provider_id": "19e1447dea629ed0",
"email_sent_at": "2026-05-10 23:45:10",
"sender": "DE ZOETEN Scott <[EMAIL]>",
"recipient": "Meg Katsiouras <[EMAIL]>",
"status": "failed",
"code": 2000,
"origin_activity_id": null,
"activity_id": null,
"created_at": "2026-05-10 23:50:09",
"updated_at": "2026-05-10 23:50:09"
}
]
Computed
Add columns:
Generated
Transpose
Add table definition (DDL)
Output file:
/Users/lukas/Documents/jiminny_text_relays.json
Browse… (⇧⏎)...
|
34133
|
NULL
|
NULL
|
NULL
|
|
34136
|
NULL
|
0
|
2026-05-13T10:55:30.238503+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669730238_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIewINavigareCodeLaravelKeractorWindowFV f PhostormVIewINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X Tx,™ T•GOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0lemail_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code20008oniain activitv id@ activity_idenulsI created atWorkenado accodiatod with hranch imactarl hac hoon roctorod Il Pollhark II Confiauro (odav 12.27)© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 11 ^ v 643І ПОННН 1-649654655[657TNHI1-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583*select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppon Dally • In 1h om100% S2• Wed 13 May 13:55:29U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..ExoectedFlow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)• TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CSV ySIIM. 20112 141 MI Windeur Taame 666.1/72 chare 1 lind hrosk)UTE.OAensod...
|
NULL
|
4169131707742146072
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIewINavigareCodeLaravelKeractorWindowFV f PhostormVIewINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost247A console fiminnv@localho: 2481Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X Tx,™ T•GOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0lemail_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code20008oniain activitv id@ activity_idenulsI created atWorkenado accodiatod with hranch imactarl hac hoon roctorod Il Pollhark II Confiauro (odav 12.27)© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 11 ^ v 643І ПОННН 1-649654655[657TNHI1-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583*select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppon Dally • In 1h om100% S2• Wed 13 May 13:55:29U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..ExoectedFlow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)• TextRelay status = PROCESSEDIf validation fails.TextRelayException thrown with reason codeCailure email cent (SmcPelavFailed) < This ic the cecond email Scott receivedTextRelay status = FAlLED«Code SWF-16CSV ySIIM. 20112 141 MI Windeur Taame 666.1/72 chare 1 lind hrosk)UTE.OAensod...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34137
|
NULL
|
0
|
2026-05-13T10:55:33.544812+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669733544_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-947265983466993404
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34138
|
1285
|
0
|
2026-05-13T10:55:59.185463+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669759185_m1.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8998697331175416135
|
-2340703212850653083
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}...
|
34137
|
NULL
|
NULL
|
NULL
|
|
34139
|
1286
|
0
|
2026-05-13T10:55:59.178318+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669759178_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"bounds":{"left":0.3723404,"top":0.15881884,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"}]...
|
-721825662379059413
|
-8249461597107257406
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
PhostormVIeWINavicareCodeLaravelKeractorWindowFV faVsco.js°9 master kProleteyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUIAD)1EUIdEU TEUv diminnv@localhost2474 console fiminnv@localho: 248Di liminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]A zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrows Excention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays X Tx,™ T•GOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e144dea620ed0lemail_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000|8oniain activitv id@ activity_idenulsI created atWorkenado accodiatod with hranch mactarl hac hoon roctorod I/ Pollhark II Confiauro (todav 12.27)© MailboxController.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]sms-relay-failed.blade.phpA console [STAGING]A29 V1 ^ v 643І ПОННН 1-649654655[657-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppon Dally • In 1h om100% S2• Wed 13 May 13:55:58U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..ExoectedFlow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)If validation passes:• SMS sent via Twilio to oriainal sender• Activitv created (TYpF SMS OUtROUND)•TextRelay status = PROCESSEDIf validation fails.Cailure email sent (SmcPelavSailed) < Thic is the cecond email Scott receivedTextRelay status = FAILEDHere is Scott's text relavs itemll«Code SWF-16•0 (+]CsVyWN Windeur Taame 666.1/72 chare 1 lind hrosk)UTE.OAensod...
|
34136
|
NULL
|
NULL
|
NULL
|
|
34140
|
1286
|
1
|
2026-05-13T10:56:01.350468+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669761350_m2.jpg...
|
PhpStorm
|
faVsco.js – console [PROD]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"bounds":{"left":0.3723404,"top":0.15881884,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.38464096,"top":0.15881884,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.39361703,"top":0.15722266,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.40093085,"top":0.15722266,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.40957448,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.41821808,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.42918882,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-2139424983648897740
|
-2340703212850685851
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34141
|
1285
|
1
|
2026-05-13T10:56:00.113147+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669760113_m1.jpg...
|
PhpStorm
|
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Undo
Redo
Cut
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Undo","depth":5,"bounds":{"left":0.0,"top":0.0,"width":0.065972224,"height":0.024444444},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Redo","depth":5,"bounds":{"left":0.0,"top":0.0,"width":0.065972224,"height":0.024444444},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Cut","depth":5,"bounds":{"left":0.0,"top":0.0,"width":0.065972224,"height":0.024444444},"on_screen":false,"role_description":"text"}]...
|
-4359152175493110010
|
4017696282325708110
|
click
|
hybrid
|
NULL
|
Undo
Redo
Cut
FinderFileEditViewGoWindowHelpld6]Su Undo
Redo
Cut
FinderFileEditViewGoWindowHelpld6]Support Daily • in 1h 5 m100% C8• Wed 13 May 13:55:59PROD (ssh)APP (-zsh)181DOCKERDOCKER (docker-compose)docker_lamp_1181DEV (docker)2026-05-13 10:55:18 Running ['artisan'dialers:monitor-activities]docker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities > '/proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:55:27 Running ['artisan'jiminny:monitor-social-accounts]7s DONEdocker_lamp_11 t '/usr/local/bin/php' 'artisan'jiminny:monitor-social-accounts > */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:55:35 Running ['artisan'mailbox:skip-lists:refresh]4S DONEdocker_lamp_11/fd/1'1 '/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › */proc/2>&1docker_1amp_12026-05-13 10:55:39 Running ['artisan'mailbox:batch: process--max-batches=15]2sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=15 > */proc/1/fd/1* 2>&1docker_lamp_112026-05-13 10:55:42 Running ['artisan' activity:purge-stale]2s DONEdocker_lamp_1 | '/usr/local/bin/php' 'artisan' activity:purge-stale › '/proc/1/fd/12>&1docker_lamp_1docker_lamp_1docker_1amp_12026-05-13 10:55:45 Running ['artisan' mailbox:text-relay:sync] {"invalid_request""eror description": "Invalid impersonation \u0026quot;sub\u0026quot,field: @"docker_lamp_11}docker_lamp_12s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/fd/1'2>&1docker_lamp_12026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notification]ZS DONEdocker_lamp_111 '/usr/local/bin/php' 'artisan' conference:pre-meeting-notification'/proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:55:50 Running ['artisan'conference:monitor:start] ...3S DONEdocker_lamp_1fd/1'1 '/usr/local/bin/php' 'artisan'conference:monitor: start › '/proc/1/2>&1docker_lamp_12026-05-13 10:55:54 Running ['artisan'conference:monitor:end]2s DONEdocker_lamp_1t '/usr/local/bin/php' 'artisan' conference:monitor:end › '/proc/1/fd/1'2>&1View in Docker Desktopo View Configw Enable WatchRun*3-zshT2PROD (ssh)'do-release-upgrade' to upgrade to it.84screenpipe"*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login:Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-JiminnyX Y5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001885PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34142
|
1285
|
2
|
2026-05-13T10:56:04.484713+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669764484_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh) FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh)DOCKER181DEV (docker)₴82XIDOCKER (docker-compose)docker_lamp_11 '/usr/local/bin/php' 'artisan"mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_1amp_12026-05-13 10:55:42 Running ['artisan'activity:purge-stale]docker_lamp_1t '/usr/local/bin/php' 'artisan'activity:purge-stale >* /proc/1/fd/1• 2>&1docker_lamp_1mailbox:text-relay:sync] {docker_1amp_1docker_lamp_12026-05-13 10:55:45 Running ['artisan'"error":"invalid_request""error_description": "Invalidimpersonation \u0026quot; sub\u0026quot;field: @"docker_lamp_11}docker_lamp_1docker_1amp_11 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notificationl2s DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:pre-meeting-notification> '/proc/1/fd/1' 2>&1docker_lamp_1 |2026-05-13 10:55:50 Running ['artisan' conference:monitor:start]3S DONEdocker_lamp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan' conference:monitor:start › */proc/1/docker_1amp_12026-05-13 10:55:54 Running ['artisan'conference:monitor: end]2S DONEdocker_lamp_1/1'L '/usr/local/bin/php' 'artisan' conference:monitor:end > '/proc/1/fddocker_lamp_12026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]6s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens > */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background9.06ms DONEdocker_1amp_11 ('/usr/local/bin/php''artisan' conference:pre-meeting-reminder >/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") >'/dev/null'docker_lamp_12026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]docker_1amp_11 ('/usr/local/bin/php' 'artisan' hubspot: journal-poll--start > '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finish "framework/schedule-e26d77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null' 2>&1 &> 0(alo)Support Daily • in 1h 4 mA-zshPROD (ssh)'do-release-upgrade' to upgrade to it.84100% C8• Wed 13 May13:56:04181screenpipe"О ₴5PRODView in Docker Desktop• View ConfigEnable Watch*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-JiminnyY5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
4543274237596334327
|
NULL
|
click
|
ocr
|
NULL
|
FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh) FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh)DOCKER181DEV (docker)₴82XIDOCKER (docker-compose)docker_lamp_11 '/usr/local/bin/php' 'artisan"mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_1amp_12026-05-13 10:55:42 Running ['artisan'activity:purge-stale]docker_lamp_1t '/usr/local/bin/php' 'artisan'activity:purge-stale >* /proc/1/fd/1• 2>&1docker_lamp_1mailbox:text-relay:sync] {docker_1amp_1docker_lamp_12026-05-13 10:55:45 Running ['artisan'"error":"invalid_request""error_description": "Invalidimpersonation \u0026quot; sub\u0026quot;field: @"docker_lamp_11}docker_lamp_1docker_1amp_11 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notificationl2s DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:pre-meeting-notification> '/proc/1/fd/1' 2>&1docker_lamp_1 |2026-05-13 10:55:50 Running ['artisan' conference:monitor:start]3S DONEdocker_lamp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan' conference:monitor:start › */proc/1/docker_1amp_12026-05-13 10:55:54 Running ['artisan'conference:monitor: end]2S DONEdocker_lamp_1/1'L '/usr/local/bin/php' 'artisan' conference:monitor:end > '/proc/1/fddocker_lamp_12026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]6s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens > */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background9.06ms DONEdocker_1amp_11 ('/usr/local/bin/php''artisan' conference:pre-meeting-reminder >/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") >'/dev/null'docker_lamp_12026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]docker_1amp_11 ('/usr/local/bin/php' 'artisan' hubspot: journal-poll--start > '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finish "framework/schedule-e26d77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null' 2>&1 &> 0(alo)Support Daily • in 1h 4 mA-zshPROD (ssh)'do-release-upgrade' to upgrade to it.84100% C8• Wed 13 May13:56:04181screenpipe"О ₴5PRODView in Docker Desktop• View ConfigEnable Watch*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-JiminnyY5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
34141
|
NULL
|
NULL
|
NULL
|
|
34143
|
1286
|
2
|
2026-05-13T10:56:04.469866+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669764469_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIeWINavigareCodeLaravelKeractorWindowFV f PhostormVIeWINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTJ Y :class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUI4D1U)IdEU TEUv diminnv@localhost2474 console fiminnv@localho: 248Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays XTx. 1™ Tw•GOOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0l1 email_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000|Boniain activitv id@ activity_idenulsI created atWorkenado accodiatod with hranch imactarl hac hoon roctorod Il Pollhark II Confiauro (odav 12.27)© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 11 ^ v 643І ПОННН 1-649654655[657TNHI1-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% L2• Wed 13 May 13:56:03AskJiminnyReportActivityServiceTest vCascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi•Message body not too large (s1600 characters via SmsMessage rule)Here is scott's text relays item u"id": 32412uid": "Ox42FBA0C562A4175CBD68F18E3513461A;• "Mea Katsiouras <61485019435.64275138300.anG|95e|2|@txt.liminnv.com>"«Code SWF-16CsVyWN Windeur TaameUTE.OAensod...
|
NULL
|
9055809296611130941
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIeWINavigareCodeLaravelKeractorWindowFV f PhostormVIeWINavigareCodeLaravelKeractorWindowFV faVsco.js°9 master kProledeyM.licenses.mdC) TextRelayService.onpcmalllextkelay.onpxTextmessagingservice.ongM MakefileJ package-lock.json= phpstan.neon.dist= phpstan-baseline.neor< phpunit.xmlTaraw_sqL_query.sq(C) SmsMessage.pnpTextRelayExceptionTJ Y :class EmailTextRelay extends Job implements ShouldQueue207M+ READMe.mo< sonar-project.propertiesE test.py<> Untitled Diagram.xmls vetur.config.isM. WEBHOOK FILTERING_IMPLEM 236›Uh exiernal Liorariesv E° Scratches and Consolesv Database ConsolesV AEU1232243& console EUl244ADEALRISKS IEUI4D1U)IdEU TEUv diminnv@localhost2474 console fiminnv@localho: 248Di lliminnv@localhost4 HS local fiminnv@localhc 2504 SF jiminny@localhost]& zoho_dev fiminny@localh 252V A PRODA console [PROD]# concole 1 [pponlA DI [PRODISTAAServicesv M DatabaseV AEUI consolev / iminnvalocalhostA HS_localv # pRODA console 2 s 32 ms# STAGINGA console→, Nockor* ocnos cxcepczonprivate function parseRecipient(string $recipient): stringl...}*ethrows Jexception1 usageprivate function parseRecipientIntoEntities(string Srecipient): arrav{...}* athrowsExcention1 usageprivate function checkIntegrity(GoogleGmail \MessagePart Spayload)Sheaders = Sthis->aetHeadersSoavload->getHeaders0n•$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser)->parse(Sbody):Steyt = Semail->aetVicihleTeytd•if (Stext ===thnow now Tov+DolavEvcontionhOutputiii jiminny.text_relays XTx. 1™ Tw•GOOa id32412uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasuiteo email_provider_id10e1447dea620ed0l1 email_sent_at2026-05-10 23:45:10I senderDE ZOETEN Scott <[EMAIL]>I• recipientMeg Katsiouras <61485019435.64275138300.anG195el210txt.jiminnv.com›statusfailedI code2000|Boniain activitv id@ activity_idenulsI created atWorkenado accodiatod with hranch imactarl hac hoon roctorod Il Pollhark II Confiauro (odav 12.27)© MailboxController.phpsms-relay-failed.blade.php= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 11 ^ v 643І ПОННН 1-649654655[657TNHI1-660664— 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:666 vselect * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% L2• Wed 13 May 13:56:03AskJiminnyReportActivityServiceTest vCascadeTrial Owner Role SeleSMS Failure Email Inve+0 ..Exoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi•Message body not too large (s1600 characters via SmsMessage rule)Here is scott's text relays item u"id": 32412uid": "Ox42FBA0C562A4175CBD68F18E3513461A;• "Mea Katsiouras <61485019435.64275138300.anG|95e|2|@txt.liminnv.com>"«Code SWF-16CsVyWN Windeur TaameUTE.OAensod...
|
34140
|
NULL
|
NULL
|
NULL
|
|
34144
|
1285
|
3
|
2026-05-13T10:56:06.197464+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669766197_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-7673782238848625796
|
-8646559087753982588
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
FinderFileEd Project: faVsco.js, menu
master, menu
FinderFileEditViewGoWindowHelpPROD (ssh)APP (-zsh)DOCKER181DEV (docker)₴82XIDOCKER (docker-compose)docker_lamp_11 '/usr/local/bin/php' 'artisan"mailbox:batch:process --max-batches=15 > '/proc/1/fd/1'docker_1amp_12026-05-13 10:55:42 Running ['artisan'activity:purge-stale]docker_lamp_1t '/usr/local/bin/php' 'artisan'activity:purge-stale >* /proc/1/fd/1• 2>&1docker_lamp_1mailbox:text-relay:sync] {docker_1amp_1docker_lamp_12026-05-13 10:55:45 Running ['artisan'"error":"invalid_request""error_description": "Invalidimpersonation \u0026quot; sub\u0026quot;field: @"docker_lamp_11}docker_lamp_1docker_1amp_11 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notificationl2s DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' conference:pre-meeting-notification> '/proc/1/fd/1' 2>&1docker_lamp_1 |2026-05-13 10:55:50 Running ['artisan' conference:monitor:start]3S DONEdocker_lamp_1fd/1'2>&11 '/usr/local/bin/php' 'artisan' conference:monitor:start › */proc/1/docker_1amp_12026-05-13 10:55:54 Running ['artisan'conference:monitor: end]2S DONEdocker_lamp_1/1'L '/usr/local/bin/php' 'artisan' conference:monitor:end > '/proc/1/fddocker_lamp_12026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]6s DONEdocker_lamp_1• '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens > */proc/1/fd/1' 2>&1docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background9.06ms DONEdocker_1amp_11 ('/usr/local/bin/php''artisan' conference:pre-meeting-reminder >/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") >'/dev/null'docker_lamp_12026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]docker_1amp_11 ('/usr/local/bin/php' 'artisan' hubspot: journal-poll--start > '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finish "framework/schedule-e26d77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null' 2>&1 &> 0(alo)Support Daily • in 1h 4 mA-zshPROD (ssh)'do-release-upgrade' to upgrade to it.84100% C8• Wed 13 May13:56:05181screenpipe"О ₴5PRODView in Docker Desktop• View ConfigEnable Watch*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-JiminnyY5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 27 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34145
|
1286
|
3
|
2026-05-13T10:56:07.384609+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669767384_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.27360374,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.3949468,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
114467221777913323
|
-8357266513322709564
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
PhostormVIewINavicareCodeLaravelKeractorWindowFV faVsco.js?9 master kProiect v(c) Createlnbox.ongg) DeleteFmailMessages.© TextRelayService.phpcmalltextkelay.onpxTextmessagingservice.ongC SmsMessage.pngEmalllextkelay.onpC ProcesstmalsonerasTextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue_ MeeuinabouC Middleware229Streaminab Teamw Telephony0 Userc) ChangeEmailJob.ohp@ DeactivateUser.Job.oh 244C) DeleteScheduledUser 249(C) SetuoDefaultSavedSe: 244© SyncTolntercom.php© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn248© ImportRecallAlRecordings 251© ImportRemoteTrackJob.p 252G Job.php(C).lohDicnatcher nhn© JobDispatcherInterface.p 255© PurgeSoftDeletedOpporti 256T SqsVisibilityControl.phpv C Listenersv @ Activities259v @ ActivityProvider> D JustCall|Servicesv O DatabaseV dEU& consolev Aliminnv@localhostA HS_localv APROD4 console 2 s 32 ms# STAGINGIconsole* dchrows Exception1 usageprivate function parserecip1entintoentitles(string Sreciplent: arrav-...* achrows Exceotion1 usageprivate function checkintegrity(GoogLeGmail \MessagePart $payload)Sheaders = $this->getHeaders(SpayLoad->getHeadersO);$body = Sthis->getBody($payload->getPartsO):// Parse the email body and check it can actually be sent.Semail = (new EmailParser()->parse(Sbody):Stext = Semail->getVisibleTextO:if (Stext === 1') {throw new TextRelayException(message. "message boay 1s un-readable or emocy.'code: self::REASON CODE MESSAGE BODY EMPTYOutoutŒ jiminny.text_relays x Tx. B@W 1wv GOO+-S@4 TxAutov# Q MEA072412(• uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providenasulteemanl orovider 1d19e1447deao29ed0lemai sent at2026-05-10 23:45:10fin senderDE ZOSTEN Scot+ <Scot+.0F.70FTENQnewardaatewav.com>…Docker1 recipientMeg Katsiouras <[EMAIL]›! statusfailedI code2000Moriain activitv id<null>Bactivitv id<nul1>imcnostod st2004-05-10 27-50-00© MailboxController.phpsms-relay-failed.blade.php= custom.log= laravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]A29 V1 ^ v 643І ПИНННН 1648- 649654655656657=658659=660=661= 662664- 665Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc'040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976)select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 87714:SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot':splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report_ results WHERE uuid to bin( '822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid:select * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% 2• Wed 13 May 13:56:06U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email InveExoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)nere is scotts tex_relays item L-uuid": DOxA2EBA0C5G2A4175CBD68F18E3513461A);+0 ..nt*: "Meg Katsiouras <[EMAIL])"_activity_id": nullupdated at". "2026-05-10 23:50:09CSVvWN Windsurf Teams250-41UTE.8Po 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34146
|
1285
|
4
|
2026-05-13T10:56:12.113841+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669772113_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4235983745889776938
|
-8204421443435123770
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
FinderFileEditViewGoWindowHelp> 0PROD (ssh)APP (-zsh)Support Daily • in 1h 4 mA-zshDOCKERDOCKER (docker-compose)docker_lamp_11}docker_lamp_1docker_1amp_1d/1'2>&1docker_lamp_1ation]2s DONEdocker_lamp_1'/proc/1/fd/1'2>&1docker_lamp_13S DONEdocker_lamp_1fd/1'2>&1docker_1amp_12s DONEdocker_lamp_1/1'2>&1docker_lamp_16s DONE181DEV (docker)₴822s DONE1 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/f2026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notific1 '/usr/local/bin/php' 'artisan'conference:pre-meeting-notification2026-05-13 10:55:50 Running ['artisan'conference:monitor:start]1 '/usr/local/bin/php' 'artisan' conference:monitor:Start › */proc/1/2026-05-13 10:55:54 Running ['artisan'conference:monitor:end]1 '/usr/local/bin/php' 'artisan'conference:monitor:end > '/proc/1/fd2026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]docker_lamp_1 | / '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens › */proc/docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background 9.06msdocker_1amp_1• ('/usr/local/bin/php' 'artisan' conference:pre-meeting-reminder >/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") > '/dev/null' 2>&1 &docker_lamp_1 |2026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]in background2.89ms DONEdocker_1amp_1• ('/usr/local/bin/php' 'artisan' hubspot: journal-poll --start › */proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finishd77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null'"framework/schedule-e26docker_lamp_12026-05-13 10:56:03 Running ['artisan'crm:bullhorn:ping --heartbeat]Starting HubSpot journal polling service...docker_lamp_11 0 social account(s) to be processeddocker_1amp_1docker_lamp_1docker_lamp_11 Done!7s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' crm:bullhorn:ping --heartbeat › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch84100% C8• Wed 13 May13:56:11181screenpipe"О 85PROD (ssh)Run 'do-release-upgrade' to upgrade to it.PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetrycould not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login:Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsPoetry could notfind a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lSTAGEFRONTENDEXTENSION...
|
34144
|
NULL
|
NULL
|
NULL
|
|
34147
|
1286
|
4
|
2026-05-13T10:56:12.113848+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669772113_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4235983745889776938
|
-8204421443435123770
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
PhostormVIewINavigareCodeLaravelKeractorWindowFV faVsco.js?9 master kProiect v(c) Createlnbox.ongg) DeleteFmailMessages.©) TeytRelavService.ongcmalllextkelay.onpxTextmessagingservice.ongEmalllextkelay.onpc ProcesstmalsonerasQ- TextRelayExceptionTL Y:class EmailTextRelay extends Job implements ShouldQueue_ MeeuinabouC MiddlewareStreaminab Teamw Telephony0 Userc) ChangeEmailJob.ohpDeactivateUserJob.phc) DeleteScheduledUser(C) SetuoDefaultSavedSe:© SyncTolntercom.php© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.pG Job.php(C).lohDicnatcher nhn© JobDispatcherinterface.p© PurgeSoftDeletedOpportiT SqsVisibilityControl.phpv C Listenersv @ Activitiesv @ ActivityProvider> D JustCallServicesv O DatabaseV dEUA consolev Aliminnv@localhost# HS locallv APROD4 console 2 s 32 ms# STAGINGIconsole…Docker1 usageorivate const REASON CODE NAULSOX MISMATCH = 10001orivate const REASON CODE SENDER UNKNOWN = 2000:lusageprivate const REASON CODE SENDER MISMAUCH = 2100;lusageprivate const REASON CODE SENDER FORBIDDEN = 2200;1usageprivate const REASON CODE RECIPIENT_ORIGIN INVALID = 3000;orivare const KEASUN LUUC KEUIFICNI UESILNA/LUNINVALIU = 5100private const REASON CODE RECIPIENT MISSING INVALID = 3200:private const REASUN CUDE_MESSAGE_BUDY1UU LARGE = 40007© MailboxController.phpsms-relay-failed.blade.phpA29 11 ^ v 643T HеНИ ШІ T654655657=658659=660E661=662=663664665666 vl= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]Tx: AutovSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583*select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 877141SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot':splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report results WHERE uuid to bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = vuid:select * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% L2• Wed 13 May 13:56:11U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email InveExoectedFlow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)nere is scotts tex_relays item L-uuid": DOxA2EBA0C5G2A4175CBD68F18E3513461A);+0 ..nt*: "Meg Katsiouras <[EMAIL])"_activity_id": nullupdated at". "2026-05-10 23:50:09Outoutf liminny.text_relays XfW 1rowv nl# Q MEA0Did(• uuid (UUID)email providenMemail provider idemail sent atfin sender1 recipient! statusI codeTx: Autov7241242fb40c5-62a4-175c-bd68-f18e3513461agsuite19e1447dea629ed02026-05-10 23:45:10DE ZOSTEN Scot+ <Scot+.0F.70FTENQnewardaatewav.com>Meg Katsiouras <[EMAIL]›failed2000Moriain activitv id<null>Bactivitv id<nul1>imcnostod st2004-05-10 27-50-00CSVvWN Windsurf Teamc47-10 UTF.8Po 4 spaces...
|
34145
|
NULL
|
NULL
|
NULL
|
|
34148
|
1285
|
5
|
2026-05-13T10:56:15.445368+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669775445_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
4805585396350839248
|
-2331696013192243099
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34149
|
1286
|
5
|
2026-05-13T10:56:15.445532+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669775445_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.10472074,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.11735372,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"bounds":{"left":0.12832446,"top":0.1292897,"width":0.043882977,"height":0.015961692},"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.18118352,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.19115691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.19980054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.20844415,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"bounds":{"left":0.22207446,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.24767287,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.25631648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.2649601,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
6528046453831349223
|
-8213081093941629500
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
PhostormVIewINavigareCodeLaravelKeractorJOOISWindowFV faVsco.js°9 master kProiect v(c) Createlnbox.ongg) DeleteFmailMessages.©) TeytRelavService.ongcmalllextkelay.onpxTextmessagingservice.ongEmalllextkelay.onpc ProcesstmalsonerasQ- TextRelayExceptionTL Y:0 MeetingBotC Middlewareclass EmailTextRelay extends Job implements ShouldQueueStreaminab Teamw Telephony0 Userc) ChangeEmailJob.ohpDeactivateUserJob.phc) DeleteScheduledUser(C) SetuoDefaultSavedSe:© SyncTolntercom.php© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.pG Job.php(C).lohDicnatcher nhn© JobDispatcherInterface.p© PurgeSoftDeletedOpportiT SqsVisibilityControl.phpv C Listenersv @ Activitiesv @ ActivityProvider> D JustCallServicesv O DatabaseV dEUA consolev Aliminnv@localhost# HS locallv APROD4 console 2 s 32 ms# STAGINGIconsole1 usageorivate const REASON CODE NAULSOX MISMATCH = 10001Cascade I-llCommand 2elprivate const REASON CODE SENDERUNKNOWN = 2000;lusageprivate const REASON CODE SENDER MISMAUCH = 2100;lusageprivate const REASON CODE SENDER FORBIDDEN = 2200;1usageprivate const REASON CODE RECIPIENT_ORIGIN INVALID = 3000;orivare const KEASUN LUUC KEUIFICNI UESILNA/LUNINVALIU = 5100private const REASON CODE RECIPIENT MISSING INVALID = 3200:private const REASUN CUDE_MESSAGE_BUDY1UU LARGE = 400071usadeOutoutŒ jiminny.text_relays x Tx. BfW 1rowv nlTx: Auto# Q MA®Did(• uuid (UUID)7241242fb40c5-62a4-175c-bd68-f18e3513461aemail providengsuiteMemail provider id19e1447dea629ed0email sent at2026-05-10 23:45:10fin senderDE ZOSTEN Scot+ <Scot+.0F.70FTENQnewardaatewav.com>…Docker1 recipientMeg Katsiouras <[EMAIL]›! statusfodlodI code2000M oriain activity id<null>Bactivitv id<nul1>imcnostod st2004-05-10 27-50-00© MailboxController.phpsms-relay-failed.blade.phpA29 11 ^ v 643I HiнMI T654655[657=658659=660E661=662=663664665= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]Tx: Auto vSo jiminnyand account 1d = 19005658 order by updated at desc:040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976)select * from automated_reports where id = 583;select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 877141SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot';splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report results WHERE uuid to bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = vuid:select * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% L2• Wed 13 May 13:56:14U AskJiminnyReportActivityServiceTest vcascadeTrial Owner Role SeleSMS Failure Email InveExoectedFlow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emoty.•Message body not too large (s1600 characters via SmsMessage rule)nere is scotts tex_relays item L-uuid": DOxA2EBA0C5G2A4175CBD68F18E3513461A);+0 ..it": "Meg Katsiouras <[EMAIL]>"_activity_id": nullupdated at". "2026-05-10 23:50:09CSVvWN Windsurf Teams22:15 (26 charc)UTE.8io 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34150
|
1285
|
6
|
2026-05-13T10:56:19.578556+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669779578_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id = 32412;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-947265983466993404
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id = 32412;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
34148
|
NULL
|
NULL
|
NULL
|
|
34151
|
1285
|
7
|
2026-05-13T10:56:24.502455+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669784502_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-1329812379600366896
|
-8168111033732059194
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
FinderFileEditViewGoWindowHelp> 0PROD (ssh)APP (-zsh)Support Daily • in 1h 4 mA-zshDOCKERDOCKER (docker-compose)docker_lamp_11}docker_lamp_1docker_1amp_1d/1'2>&1docker_lamp_1ation]2s DONEdocker_lamp_1'/proc/1/fd/1'2>&1docker_lamp_13S DONEdocker_lamp_1fd/1'2>&1docker_1amp_12s DONEdocker_lamp_1/1'2>&1docker_lamp_16s DONE181DEV (docker)₴822s DONE1 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/f2026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notific1 '/usr/local/bin/php' 'artisan'conference:pre-meeting-notification2026-05-13 10:55:50 Running ['artisan'conference:monitor:start]1 '/usr/local/bin/php' 'artisan' conference:monitor:Start › */proc/1/2026-05-13 10:55:54 Running ['artisan'conference:monitor: end]1 '/usr/local/bin/php' 'artisan'conference:monitor:end > '/proc/1/fd2026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]docker_lamp_1 | / '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens › */proc/docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background 9.06msdocker_1amp_1• ('/usr/local/bin/php' 'artisan" conference:pre-meeting-reminder ›/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") > '/dev/null' 2>&1 &docker_lamp_1 |2026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]in background2.89ms DONEdocker_1amp_1• ('/usr/local/bin/php' 'artisan' hubspot: journal-poll --start › */proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finish"framework/schedule-e26d77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null'docker_lamp_12026-05-13 10:56:03 Running ['artisan'crm:bullhorn:ping --heartbeat]i Starting HubSpot journal polling service...docker_lamp_11 0 social account(s) to be processeddocker_1amp_1docker_lamp_1docker_lamp_11 Done!7s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' crm:bullhorn:ping --heartbeat › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch84100% C8• Wed 13 May 13:56:24181screenpipe"О 85PROD (ssh)Run 'do-release-upgrade' to upgrade to it.PROD*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ 0X T3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsSTAGEPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login:Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ l...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
34152
|
1286
|
6
|
2026-05-13T10:56:24.486608+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669784486_m2.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3088599111841370244
|
-8636775528843997756
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
PhpStormVIewINavigareCodeLaravelRefactorJOOISWindowFV faVsco.js°9 master kProiect(c) Createlnbox.ongg) DeleteFmailMessages.©) TeytRelavService.ongcmalllextkelay.onpxTextmessagingservice.ongEmalllextkelay.onpc Processtmalsoneras© Synclnbox.phpQ- TextRelayExceptionTJ Y :class EmailTextRelay extends Job implements ShouldQueue_ MeeuinabouC MiddlewareStreaminab Teamw Telephony0 Userc) ChangeEmailJob.ohpDeactivateUserJob.phc) DeleteScheduledUser(C) SetuoDefaultSavedSe:© SyncTolntercom.php© SyncToPlanhat.php© SyncToUserPilot.php© BaseProcessingJob.php(c) Dummv.loh.nhn© ImportRecallAlRecordings© ImportRemoteTrackJob.pG Job.php(C).lohDicnatcher nhn© JobDispatcherInterface.p© PurgeSoftDeletedOpportiT SqsVisibilityControl.phpv C Listenersv @ Activitiesv @ ActivityProvider>C JustCallServicesv O DatabaseV dEUA consolev Aliminnv@localhost# HS locallv APROD4 console 2 s 32 ms# STAGING1 usageorivate const REASON CODE NAULSOX MISMATCH = 10001private const REASON CODE SENDER UNKNOWN = 2000;Extract Surround // = :lusageprivate const REASON CODE SENDER MISMAUCH = 2100;lusageprivate const REASON CODE SENDER FORBIDDEN = 2200;1usageprivate const REASON CODE RECIPIENT_ORIGIN INVALID = 3000;private const REASON CODE RECIPIENT DESTINATION INVALID = 3100:private const REASON CODE RECIPIENT MISSING INVALID = 3200:private const REASUN CUDE_MESSAGE_BUDY1UU LARGE = 40007private const REASON CODE MESSAGE BODY EMPTY = 4100:OutoutfiR liminny.text_relaysmW 1rowv ^Tx: Autoid72412(• uuid (UUID)42fb40c5-62a4-175c-bd68-f18e3513461aemail providengsuiteMemail provider id19e1447dea629ed0emai sent at2026-05-10 23:45:10fin senderDE ZOSTEN Scot+ <Scot+.0F.70FTENQnewardaatewav.com>Iconsole…Docker1 recipientMeg Katsiouras <[EMAIL]›! statusfodlodI code2000Moriain activitv id<null>Bactivitv id<nul1>imcnostod st2004-05-10 27-50-00© MailboxController.phpsms-relay-failed.blade.phpA29 11 ^ v 643T HеНИШ T- 651654655=657=658659=660E661=662=663664665666 vl= 66= custom.log|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]& console (PROD] X A console [EU]A console [STAGING]Tx: AutovSo jiminnyand account 1d = 19005658 order by updatedat desc'040 A1 A40 V 64 ^select * trom contacts where crm contiquration 1d = 55/ and 1d = 3595/759select * trom accounts where crm contiquration 1d = 557 and 1d = 19005658select * from automated_report_results where 2d = 1976;select * from automated reports where 1d = 583÷select * from activity_searches where id = 87714;select * from activity search filters where activity search 1d = 877141SELE * FROM activities WHERE uuid to bind 88274672-202d-4162-9d04-73ff5f0566a9' = uuidor uuid_to_bin(*47842446-af51-4bcb-854f-cc6560290101') = uuid;SELECT * FROM crm_configurations WHERE provider = 'hubspot':splect * from nate limits.select * fromated_report_results where media type = 'pdf' and status = 2and id IN (18, 1872);select * from automated_reports where id = 54SELECT * FROM users WHERE id IN (24623,29443,29613):SELECT * FROM automated report results WHERE uuid to bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = vuid:select * from text relays where created at > '2026-05-01'and id = 32412:"suppont Dally • In 1h 4m100% L2• Wed 13 May 13:56:23AskJiminnyReportActivityServiceTest vCascadeTrial Owner Role SeleSMS Failure Email InveExoected Flow1. Inbound SMS → Email Notification (First Email Scott Received)• External party sends SMS to Jiminny softphone number (e.g., 027 513 8300)Twilio webhook delivers the SMS to Jiminny• Activity created in Jiminny database (TYPE_SMS_INBOUND)• Email notitication sent to the user (Scott) about the incoming SMS• Email includes the SMS content and instructions to reply via emai2. Email Reply → Outbound SMS (Where Scott's Issue Occurred)• Scott replies to the email notification• EmailTextRelav iob processes the emailEmailParser extracts visible text from the email bodyValidation checks (in checkIntegrity()):• Message bodv not emotvi•Message body not too large (s1600 characters via SmsMessage rule)nere is scotts tex_relays item L-uuid": DOxA2EBA0C5G2A4175CBD68F18E3513461A);+0 ..nt*: "Meg Katsiouras <61485019435.64275138300.qnG195el21@txt. liminnv.comy"vity_ id": nullTndatea al, teneeaean eaae1 The code ic 2000CSVvWN Windsurf Teams22:15 126 charc)UTE.8io 4 spaces...
|
34149
|
NULL
|
NULL
|
NULL
|
|
34153
|
1285
|
8
|
2026-05-13T10:56:25.906958+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669785906_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4901915977382624086
|
-8240172924620526140
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
FinderFileEditViewGoWindowHelpDOCKERDOCKER (docker-compose)docker_lamp_11}docker_lamp_1docker_1amp_1d/1'2>&1docker_lamp_1ation]2s DONEdocker_lamp_1'/proc/1/fd/1'2>&1docker_lamp_13S DONEdocker_lamp_1fd/1'2>&1docker_1amp_12s DONEdocker_lamp_1/1'2>&1docker_lamp_16s DONE$81DEV (docker)₴822s DONE1 '/usr/local/bin/php' 'artisan' mailbox:text-relay:sync › */proc/1/f2026-05-13 10:55:48 Running ['artisan'conference:pre-meeting-notific1 '/usr/local/bin/php' 'artisan'conference:pre-meeting-notification2026-05-13 10:55:50 Running ['artisan'conference:monitor:start]1 '/usr/local/bin/php' 'artisan' conference:monitor:Start › */proc/1/2026-05-13 10:55:54 Running ['artisan'conference:monitor: end]1 '/usr/local/bin/php' 'artisan'conference:monitor:end > '/proc/1/fd2026-05-13 10:55:56 Running ['artisan' jiminny:fix-hubspot-tokens]docker_lamp_1 | / '/usr/local/bin/php' 'artisan' jiminny:fix-hubspot-tokens › */proc/docker_lamp_12026-05-13 10:56:03 Running ['artisan' conference:pre-meeting-reminder] in background 9.06msdocker_1amp_11 ('/usr/local/bin/php' 'artisan" conference:pre-meeting-reminder ›/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan' schedule:finish"framework/schedule-805efb160ee8d9da02e60364ace7970eb2b35f31" "$?") > '/dev/null' 2>&1 &docker_lamp_1 |2026-05-13 10:56:03 Running ['artisan' hubspot: journal-poll --start]in background2.89ms DONEdocker_1amp_1• ('/usr/local/bin/php' 'artisan' hubspot: journal-poll --start › */proc/1/fd/1' 2>&1 ; '/usr/local/bin/php' 'artisan"schedule:finish"framework/schedule-e26d77f915d2c55fe91ca4148a230e32eaa1865e" "$?") > '/dev/null'docker_lamp_12026-05-13 10:56:03 Running ['artisan'crm:bullhorn:ping --heartbeat]Starting HubSpot journal polling service...docker_lamp_11 0 social account(s) to be processeddocker_1amp_1docker_lamp_1docker_lamp_11 Done!7s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' crm:bullhorn:ping --heartbeat › '/proc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker Desktopo View Configw Enable Watch> 0lihlSupport Daily • in 1h 4 mA100% C8• Wed 13 May 13:56:25PROD (ssh)APP (-zsh)181*3-zshXIPROD (ssh)Run 'do-release-upgrade' to upgrade to it.84screenpipe"*** System restart required ***Last login: Tue May 12 07:53:08 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$X L3 EU (-zsh)Last login: Tue May 12 17:54:40on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.tomlfile in /Users/lukas or its parents-ukas-Kovaliks-MacBook-Pro-Jiminny ~ $ [|X T4 STAGE (-zsh)Last login: Tue May 12 17:54:40 on consolePoetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny$T5 QA (-zsh)Last login: Tue May 12 20:12:05 on ttys001Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parents$ 0XI16FE (-zsh)Last login:Tue May 12 20:12:05 on ttys001О 85PRODSTAGEPoetry could not find a pyproject.tomlfile in /Users/lukas or its parentsFRONTENDPoetry could notfind a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ lX 17 EXT (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetrycould not find a pyproject.tomlfile in /Users/lukas or its parentsLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ I...
|
34151
|
NULL
|
NULL
|
NULL
|
|
34154
|
1285
|
9
|
2026-05-13T10:56:28.345847+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778669788345_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"TextRelayException","depth":4,"on_screen":true,"value":"TextRelayException","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2/12","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"29","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-4722315046220029099
|
-2331696013594896283
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
TextRelayException
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
2/12
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
29
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error...
|
NULL
|
NULL
|
NULL
|
NULL
|